CCNP Route Lab 6-2, Using the AS_PATH Attribute

CCNP Route Lab 6-2, Using the AS_PATH Attribute




  • Use BGP commands to prevent private AS numbers from being advertised to the outside world.
  • Use the AS_PATH attribute to filter BGP routes based on their source AS numbers.

The International Travel Agency’s ISP has been assigned an AS number of 300. This provider uses BGP to exchange routing information with several customer networks. Each customer network is assigned an AS number from the private range, such as AS 65000. Configure the ISP router to remove the private AS numbers from the AS Path information of CustRtr. In addition, the ISP would like to prevent its customer networks from receiving route information from International Travel Agency’s AS 100. Use the AS_PATH attribute to implement this policy.

Note: This lab uses Cisco 1841 routers with Cisco IOS Release 12.4(24)T1 and the Advanced IP Services image c1841 -advipservicesk9-mz.124-24.T1 .bin. You can use other routers (such as 2801 or 2811) and Cisco IOS Software versions, if they have comparable capabilities and features. Depending on the router model and Cisco IOS Software version, the commands available and output produced might vary from what is shown in this lab.

Required Resources

  • 3 routers (Cisco 1841 with Cisco IOS Release 12.4(24)T1 Advanced IP Services or comparable)
  • Serial and console cables

Step 1: Prepare the routers for the lab.
Cable the network as shown in the topology diagram. Erase the startup configuration and reload each router to clear previous configurations.

Step 2: Configure the hostname and interface addresses.
a. You can copy and paste the following configurations into your routers to begin.

Router R1 (hostname SanJose)

Router R2 (hostname ISP)

Router R3 (hostname CustRtr)

b. Use ping to test the connectivity between the directly connected routers.

Note: SanJose will not be able to reach either ISP’s loopback ( or CustRtr’s loopback (, nor will it be able to reach either end of the link joining ISP to CustRtr ( and

Step 3: Configure BGP.
a. Configure BGP for normal operation. Enter the appropriate BGP commands on each router so that they identify their BGP neighbors and advertise their loopback networks.

b. Verify that these routers have established the appropriate neighbor relationships by issuing the show ip bgp neighbors command on each router.

Step 4: Remove the private AS.
a. Display the SanJose routing table using the show ip route command. SanJose should have a route to both and Troubleshoot if necessary.

b. Ping the address from SanJose.

Why does this fail?
This fails because SanJose sources the ping with its closest connected interface s0/0/0 with IP address CustRtr does not have a route back to that interface, so the ping replies cannot return to SanJose.

c. Ping again, this time as an extended ping, sourcing from the Loopback0 interface address.

Note: You can bypass extended ping mode and specify a source address using one of these commands:

d. Check the BGP table from SanJose by using the show ip bgp command. Note the AS path for the network. The AS 65000 should be listed in the path to

Why is this a problem?
AS 65000 is a private AS, which should not be publicly advertised on the Internet. Otherwise, clients of two interconnected ISPs having the same private AS number would see their own AS in the route advertisements of each other. As a result, each client would incorrectly conclude that the advertisement came from itself and it would ignore it.

e. Configure ISP to strip the private AS numbers from BGP routes exchanged with SanJose using the following commands.

f. After issuing these commands, use the clear ip bgp * command on ISP to reestablish the BGP relationship between the three routers. Wait several seconds and then return to SanJose to check its routing table.

Note: The clear ip bgp * soft command can also be used to force each router to resend its BGP table.

Does SanJose still have a route to
Yes, learned via BGP from ISP

SanJose should be able to ping using its loopback 0 interface as the source of the ping.

g. Now check the BGP table on SanJose. The AS_ PATH to the network should be AS 300. It no longer has the private AS in the path.

Step 5: Use the AS_PATH attribute to filter routes.
As a final configuration, use the AS_PATH attribute to filter routes based on their origin. In a complex environment, you can use this attribute to enforce routing policy. In this case, the provider router, ISP, must be configured so that it does not propagate routes that originate from AS 100 to the customer router CustRtr.

AS-path access lists are read like regular access lists. The statements are read sequentially, and there is an implicit deny at the end. Rather than matching an address in each statement like a conventional access list, AS path access lists match on something called a regular expression. Regular expressions are a way of matching text patterns and have many uses. In this case, you will be using them in the AS path access list to match text patterns in AS paths.

a. Configure a special kind of access list to match BGP routes with an AS_PATH attribute that both begins and ends with the number 100. Enter the following commands on ISP.

The first command uses the ^ character to indicate that the AS path must begin with the given number 100. The $ character indicates that the AS_PATH attribute must also end with 100. Essentially, this statement matches only paths that are sourced from AS 100. Other paths, which might include AS 100 along the way, will not match this list.

In the second statement, the . (period) is a wildcard, and the * (asterisk) stands for a repetition of the wildcard. Together, .* matches any value of the AS_PATH attribute, which in effect permits any update that has not been denied by the previous access-list statement.

For more details on configuring regular expressions on Cisco routers, see: _Configuration_Guide_Chapter.html

b. Apply the configured access list using the neighbor command with the filter-list option.

The out keyword specifies that the list is applied to routing information sent to this neighbor.

c. Use the clear ip bgp * command to reset the routing information. Wait several seconds and then check the routing table for ISP. The route to should be in the routing table.

Note: To force the local router to resend its BGP table, a less disruptive option is to use the clear ip bgp
* out or clear ip bgp * soft command (the second command performs both outgoing and incoming route resync).

d. Check the routing table for CustRtr. It should not have a route to in its routing table.

e. Return to ISP and verify that the filter is working as intended. Issue the show ip bgp regexp ^100$ command.

The output of this command shows all matches for the regular expressions that were used in the access list. The path to matches the access list and is filtered from updates to CustRtr.

f. Run the following Tcl script on all routers to verify whether there is connectivity. All pings from ISP should be successful. SanJose should not be able to ping the CustRtr loopback or the WAN link CustRtr should not be able to ping the SanJose loopback 10.1.1 .1 or the WAN link

Router Interface Summary Table

Router Interface Summary
Router Model Ethernet Interface
Ethernet Interface
Serial Interface
Serial Interface
1700 Fast Ethernet 0
Fast Ethernet 1
Serial 0 (S0) Serial 0/0/1
1800 Fast Ethernet 0/0
Fast Ethernet 0/1
Serial 0/0/0
Serial 0/0/1
2600 Fast Ethernet 0/0
Fast Ethernet 0/1
Serial 0/0 (S0/0) Serial 0/1 (S0/1)
2800 Fast Ethernet 0/0
Fast Ethernet 0/1
Serial 0/0/0
Serial 0/0/1
Note: To find out how the router is configured, look at the interfaces to identify the type of router and how many interfaces the router has. Rather than list all combinations of configurations for each router class, this table includes identifiers for the possible combinations of Ethernet and serial interfaces in the device. The table does not include any other type of interface, even though a specific router might contain one. For example, for an ISDN BRI interface, the string in parenthesis is the legal abbreviation that can be used in Cisco IOS commands to represent the interface.

More Resources

About the author


Leave a Comment