BGP IPv4 - AS-PATH Attributes

AS-PATH Attributes

The BGP (Border Gateway Protocol) IPv4 AS-PATH attribute is a crucial component of BGP routing that provides information about the autonomous systems (ASes) through which a route has traversed. The AS-PATH attribute is a sequence of AS numbers that identifies the path a BGP route has taken to reach its current point in the network. BGP routers use the AS-PATH information to prevent routing loops and make informed decisions about the best path to a destination. Longer AS-PATHs are typically considered less desirable, as they imply a route has traversed through more ASes. Network administrators can leverage AS-PATH manipulation to influence route selection and traffic engineering, providing greater control over how BGP routes are propagated and preferred within the Internet. Understanding and strategically using AS-PATH attributes are fundamental to optimizing routing policies and maintaining the stability of BGP IPv4 networks.

Lab:

Disclaimer

This Configuration Guide is designed to assist members to enhance their skills in particular technology area. While every effort has been made to ensure that all material is as complete and accurate as possible, the enclosed material is presented on an “as is” basis. Neither the authors nor Forum assume any liability or responsibility to any person or entity with respect to loss or damages incurred from the information contained in this guide. This configuration guide was developed by Forum. Any similarities between material presented in this configuration guide and any other material is completely coincidental.

Cisco IOS Software, Linux Software (I86BI_LINUX-ADVENTERPRISEK9-M), Version 15.2(4)M1, DEVELOPMENT TEST SOFTWARE

Task 1: Configure BGP AS-PATH Attributes for Autonomous

Step 1: In the configuration mode of router configure BGP AS-PATH Attributes by following command:

R1:
interface loopback 100  
ip address 100.0.0.1 255.255.255.0
exit
router bgp 65100
address-family ipv4
network 100.0.0.0 mask 255.255.255.0
exit
R1:
interface loopback 100  
ip address 100.0.0.1 255.255.255.0
exit
router bgp 65100
address-family ipv4
network 100.0.0.0 mask 255.255.255.0
exit

Step 2: Verify IPv4 BGP routes by following command:

R2#show ip bgp
BGP table version is 14, local router ID is 22.0.3.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop        Metric   LocPrf    Weight     Path
 *>  11.0.1.0/24      11.0.1.1          0                  0        65100 i
 *>  11.0.2.0/24      11.0.1.1          0             	   0        65100 i
 *>  11.0.3.0/24      11.0.1.1          0                  0        65100 i
 *>  22.0.1.0/24      0.0.0.0           0                 32768     i
 *>  22.0.2.0/24      0.0.0.0           0                 32768     i
 *>  22.0.3.0/24      0.0.0.0           0                 32768     i
 *>i 33.0.1.0/24      33.0.1.3          0       100        0 	    i
 *>i 33.0.2.0/24      33.0.1.3          0       100        0 	    i
 *>i 33.0.3.0/24      33.0.1.3          0       100        0 	    i
 *>i 44.0.1.0/24      44.0.1.4          0       100        0 	    65200 i
 *>i 44.0.2.0/24      44.0.1.4          0       100        0 	    65200 i
 *>i 44.0.3.0/24      44.0.1.4          0       100        0 	    65200 i
 * i 100.0.0.0/24     44.0.1.4          0       100        0 	    65200 i
 *>                   11.0.1.1          0                  0        65100 i

R2 can reach 100 network via next hop 11.0.1.1 through AS 65100 and via 44.0.1.4 through AS 65200.

Best path for R2 to reach 100 network is via net hop 11.0.1.1 because 11.0.1.1 is EBGP neighbor with AD value 20 and 44.0.1.4 is received from IBGP neighbor with AD value 200.

Task 2: Configure BGP AS-PATH Manipulation for Autonomous

Step 1: Prepend AS for as-path manipulation

Router R2 wants to make via 44.0.1.4 as best path instead of 11.0.1.1

R2:
router bgp 65000
address-family ipv4
neighbor 11.0.1.1 route-map abc in
exit
exit
route-map abc permit 10
set as-path prepend 222 22
exit 

A policy is call on Router R2 that 100 network is prepended 222 22 via 11.0.1.1 through AS 65100 222 22 i.e. through 3 AS

R1:
router bgp 65100
address-family ipv4
neighbor 22.0.1.2 route-map abc out
exit
exit
route-map abc permit 10
set as-path prepend 111 11
exit

A policy is call on Router R1 that 100 network is prepended 111 11 via 11.0.1.1 through AS 111 11 65100 i.e. through 3 AS

Step 2: Verify IPv4 BGP routes by following command:

R2#show ip bgp
BGP table version is 27, local router ID is 22.0.3.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,

              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network         Next Hop        Metric    LocPrf     Weight     Path
 *>  11.0.1.0/24     11.0.1.1          0                  0 	     222 22 65100 111 11 i
 *>  11.0.2.0/24     11.0.1.1          0                  0          222 22 65100 111 11 i
 *>  11.0.3.0/24     11.0.1.1          0             	  0          222 22 65100 111 11 i
 *>  22.0.1.0/24     0.0.0.0           0         	      32768      i
 *>  22.0.2.0/24     0.0.0.0           0         	      32768      i
 *>  22.0.3.0/24     0.0.0.0           0         	      32768      i
 *>i 33.0.1.0/24     33.0.1.3          0    	 100      0          i
 *>i 33.0.2.0/24     33.0.1.3          0         100      0          i
 *>i 33.0.3.0/24     33.0.1.3          0         100      0          i
 *>i 44.0.1.0/24     44.0.1.4          0         100      0 	     65200 i
 *>i 44.0.2.0/24     44.0.1.4          0         100      0          65200 i
 *>i 44.0.3.0/24     44.0.1.4          0         100      0          65200 i
 *   100.0.0.0/24    11.0.1.1          0             	  0          222 22 65100 111 11 i
 *>i                 44.0.1.4          0         100      0          65200 i

Router R2 now selects 44.0.1.4 as best path because it can reach 100 network through As 65200, where as to reach 100 network via 11.0.1.1 through AS 222 22 65100 111 11 Hence AS-PATH is manipulated.