host1(config)#ip as-path access-list 2 permit ^300_
Access list 1 permits any route whose AS-path attribute begins with 100 (specified by
^). This permits routes that pass through router Boston, whether they originate in AS 100
(AS path = 100) or AS 200 (AS path = 100 200) or AS 300 (AS path = 100 200 300).
Access list 2 permits any route whose AS-path attribute begins with 300. This permits
routes that pass through router NY, whether they originate in AS 300 (AS path = 300)
or AS 200 (AS path = 300 200) or AS 100 (AS path = 300 200 100).
The neighbor filter-list commands assign a weight attribute of 1000 to routes passing
through router Boston and a weight attribute of 500 to routes passing through router
NY. Regardless of the origin of the route, routes learned through router Boston are
preferred.
ip as-path access-list
• Use to define a BGP access list; use the neighbor filter-list command to apply a specific
access list.
• You can apply access list filters on inbound or outbound BGP routes, or both.
• You can permit or deny access for a route matching the condition(s) specified by the
regular expression.
• If the regular expression matches the representation of the AS path of the route as an
ASCII string, then the permit or deny condition applies.
• The AS path allows substring matching. For example, the regular expression 20 matches
AS path = 20 and AS path = 100 200 300, because 20 is a substring of each path. To
disable substring matching and constrain matching to only the specified attribute
string, place the underscore (_) metacharacter on both sides of the string, for example
_20_.
• The AS path does not contain the local AS number.
• Use the no version to remove a single access list entry if permit or deny and a
path-expression are specified. Otherwise, the entire access list is removed.
• See ip as-path access-list.
neighbor filter-list
• Use to apply an AS-path access list to advertisements inbound from or outbound to
the specified neighbor, or to assign a weight to incoming routes that match the AS-path
access list.
• You can specify an optional weight value with the weight keyword to assign a relative
importance to incoming routes matching the AS-path access list.
• The name of the access list is a string of up to 32 characters.
• You can apply the filter to incoming or outgoing advertisements with the in or out
keywords.
• If you specify a BGP peer group by using the peerGroupName argument, all the members
of the peer group inherit the characteristic configured with this command unless it is
111Copyright © 2010, Juniper Networks, Inc.
Chapter 1: Configuring BGP Routing