Troubleshooting guide
Additional BGP Configuration
26 Copyright © 2012 ADTRAN, Inc. 61200860L1-29.4E
Filtering Routes According to AS Path
Routes can also be filtered according to the hops listed in the AS_PATH field. For advertised routes,
this type of filtering allows a degree of influence over which autonomous systems external neighbors
can access. For example, service provider routers can filter routes with paths that include customer AS
numbers to prevent themselves from advertising private customer routes to unauthorized peers. Private
networks do not typically transmit traffic from AS to AS. Therefore, filtering advertised routes
according to AS path is not usually necessary when configuring eBGP in a private network.
A list of the AS paths to be filtered is created first. The AS path list is then referenced in a route map
entry to define the paths to be filtered. Lastly, the route map is applied to a BGP neighbor (refer to
Applying a Route Map Entry to a BGP Neighbor on page 30).
Use the ip as-path-list command to create AS path lists for route map use:
(config)#ip as-path-list <name>
<name> Specifies the name of the AS path list.
Next, specify the AS numbers to be filtered and specify whether the routes containing these AS
numbers should be permitted or denied:
(config-as-path-list)#[deny | permit] <value>
<value> Specifies permitting or denying routes that contain this value in their AS_PATH attribute.
This is a numeric value that can be an integer from 1 to 4294967295 or a string that follows the format
of AS regular expressions to filter an AS path. Refer to
AS Regular Expressions on page 83 for a
detailed list of valid AS regular expressions.
The AS path list is only compared against the AS_PATH attribute on a BGP prefix, which is also
displayed in the output of the show ip bgp command.
For example, a router can be permitted to advertise only routes that use both AS 200 and AS 400:
(config-as-path-list)#permit (\b200\b.*400\b)|(\b400\b.*200\b)
However, the statement above only permits routes that use both AS 200 and AS 400. Permit any routes
that use either AS by entering separate statements:
(config-as-path-list)#permit \b200\b
(config-as-path-list)#permit \b400\b
Permitting AS number 200 selects any routes that include that value, even if the AS field also includes
other values. In other words, entering permit 200 permits routes containing AS 200, as well as AS 200
and AS 400, while entering permit 200 400 only permits routes containing both AS 200 and AS 400.
Therefore, it might be necessary to explicitly deny any values that should not be included in the field.
Another example might be where the router is allowed to advertise routes that use AS 200 or AS 400,
but not routes that force traffic to travel through both AS 200 and AS 400:
(config-as-path-list)#deny (\b200\b.*400\b)|(\b400\b.*200\b)
(config-as-path-list)#\b200\b
Refer to Example 6 on page 46 for a detailed BGP configuration example featuring the
use of route maps to filter routes according to network address.