IPv6 - BGP AS-PATH

BGP AS-PATH

In IPv6, the BGP AS-PATH attribute serves a critical role in path selection and routing decisions within the Border Gateway Protocol (BGP). Similar to its IPv4 counterpart, the AS-PATH attribute in IPv6 BGP contains a sequence of Autonomous System (AS) numbers that a route has traversed. This information helps prevent routing loops and aids in selecting the best path for packet forwarding. As BGP routers exchange routing information, the AS-PATH attribute accumulates the AS numbers, providing insights into the route's journey across various autonomous systems. Network administrators leverage AS-PATH data to implement routing policies, optimize network traffic, and enhance the overall stability and efficiency of IPv6 BGP routing. Understanding and manipulating the IPv6 BGP AS-PATH attribute are crucial skills for network engineers managing large-scale, global IPv6 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, 7200 Software (C7200-ADVENTERPRISEK9-M), Version 15.0(1)M9, RELEASE SOFTWARE (fc1)

R1 Router Config:

! 
ipv6 unicast-routing 
ipv6 cef
! 
interface Loopback0 
no ip address 
ipv6 address 2002:0:1:1::1/128 
ipv6 ospf 1 area 0 
! 
interface Loopback1 
no ip address 
ipv6 address 2002:0:1:2::1/128 
ipv6 ospf 1 area 0 
! 
interface Loopback2 
no ip address 
ipv6 address 2002:0:1:3::1/128 
ipv6 ospf 1 area 0 
! 
interface Serial1/0 
no ip address 
ipv6 address 2001:0:0:12::1/128 
ipv6 ospf 1 area 0 
no fair-queue 
serial restart-delay 0 
! 
interface Serial1/1 
ipv6 address 2001:0:0:13::1/64 
serial restart-delay 0 
! 
router bgp 65100 
bgp router-id 1.1.1.1 
no bgp default ipv4-unicast 
bgp log-neighbor-changes 
neighbor 2001:0:0:13::3 remote-as 65000 
neighbor 2002:0:2:1::2 remote-as 65000 
neighbor 2002:0:2:1::2 ebgp-multihop 5 
neighbor 2002:0:2:1::2 update-source 
Loopback0 
! 
address-family ipv6 
no synchronization 
network 2002:0:1:2::1/128 
network 2002:0:1:3::1/128 
neighbor 2001:0:0:13::3 activate 
neighbor 2002:0:2:1::2 activate
exit-address-family 
! 
ipv6 router ospf 1 
router-id 1.1.1.1 
log-adjacency-changes 
!

R4 Router Config:

! 
ipv6 unicast-routing 
ipv6 cef 
! 
interface Loopback0 
no ip address 
ipv6 address 2002:0:4:1::4/128 
! 
interface Loopback1 
no ip address 
ipv6 address 2002:0:4:2::4/128 
! 
interface Loopback2 
no ip address 
ipv6 address 2002:0:4:3::4/128 
! 
interface Serial1/0 
no ip address 
ipv6 address 2001:0:0:34::4/128 
serial restart-delay 0 
clock rate 64000 
! 
router bgp 65200 
bgp router-id 4.4.4.4 
no bgp default ipv4-unicast 
bgp log-neighbor-changes 
neighbor 2002:0:3:1::3 remote-as 65000 
neighbor 2002:0:3:1::3 ebgp-multihop 5 
neighbor 2002:0:3:1::3 update-source 
Loopback0 
! 
address-family ipv6 
no synchronization 
network 2002:0:4:2::4/128 
network 2002:0:4:3::4/128 
neighbor 2002:0:3:1::3 activate 
exit-address-family 
! 
ipv6 route 2001:0:0:34::3/128 Serial1/0 
ipv6 route 2002:0:3:1::3/128 Serial1/0 
!

R2 Router Config:

! 
ipv6 unicast-routing 
ipv6 cef 
! 
interface Loopback0 
no ip address 
ipv6 address 2002:0:2:1::2/128 
ipv6 ospf 1 area 0 
! 
interface Loopback1 
no ip address 
ipv6 address 2002:0:2:2::2/128 
ipv6 ospf 1 area 0 
! 
interface Loopback2 
no ip address 
ipv6 address 2002:0:2:3::2/128 
ipv6 ospf 1 area 0 
! 
interface Serial1/0 
no ip address 
ipv6 address 2001:0:0:12::/64 eui-64 
ipv6 ospf 1 area 0 
no fair-queue 
serial restart-delay 0 
clock rate 64000 
! 
interface FastEthernet2/0 
no ip address 
duplex full 
speed 100 
ipv6 address 2001:0:0:23::/64 eui-64 
ipv6 ospf 1 area 0 
!
router bgp 65000 
bgp router-id 2.2.2.2 
no bgp default ipv4-unicast 
bgp log-neighbor-changes 
neighbor 2001::23:C803:CFF:FE78:38 
remote-as 65000 
neighbor 2002:0:1:1::1 remote-as 65100 
neighbor 2002:0:1:1::1 ebgp-multihop 5 
neighbor 2002:0:1:1::1 update-source 
Loopback0 
! 
address-family ipv6 
no synchronization 
network 2002:0:2:2::2/128 
network 2002:0:2:3::2/128 
neighbor 2001::23:C803:CFF:FE78:38 
activate 
neighbor 2002:0:1:1::1 activate 
exit-address-family 
! 
ipv6 router ospf 1 
router-id 2.2.2.2 
log-adjacency-changes 
! 

R2 Router Config:

! 
ipv6 unicast-routing 
ipv6 cef 
! 
interface Loopback0 
no ip address 
ipv6 address 2002:0:3:1::3/128 
ipv6 ospf 1 area 0 
! 
interface Loopback1 
no ip address
ipv6 address 2002:0:3:2::3/128 
ipv6 ospf 1 area 0 
! 
interface Loopback2 
no ip address 
ipv6 address 2002:0:3:3::3/128 
ipv6 ospf 1 area 0 
! 
interface Serial1/0 
no ip address 
ipv6 address 2001:0:0:34::3/128 
no fair-queue 
serial restart-delay 0 
clock rate 64000 
! 
interface Serial1/1 
no ip address 
ipv6 address 2001:0:0:13::3/64 
serial restart-delay 0 
! 
interface FastEthernet2/0 
mac-address ca03.0c78.0038 
no ip address
duplex auto 
speed auto 
ipv6 address 2001:0:0:23::/64 eui-64 
ipv6 ospf 1 area 0 
! 
router bgp 65000 
bgp router-id 3.3.3.3 
no bgp default ipv4-unicast 
bgp log-neighbor-changes 
neighbor 2001:0:0:13::1 remote-as 65100 
neighbor 2001::23:C802:CFF:FE78:38 
remote-as 65000 
neighbor 2002:0:4:1::4 remote-as 65200 
neighbor 2002:0:4:1::4 ebgp-multihop 5 
neighbor 2002:0:4:1::4 update-source 
Loopback0 
! 
address-family ipv6 
no synchronization 
network 2002:0:3:2::3/128 
network 2002:0:3:3::3/128 
neighbor 2001:0:0:13::1 activate 
neighbor 2001::23:C802:CFF:FE78:38 
activate 
neighbor 2001::23:C802:CFF:FE78:38 
next-hop-self 
neighbor 2002:0:4:1::4 activate 
exit-address-family 
! 
ipv6 route 2001:0:0:34::4/128 Serial1/0 
ipv6 route 2002:0:4:1::4/128 Serial1/0 
! 
ipv6 router ospf 1 
router-id 3.3.3.3 
log-adjacency-changes 
!

Note 1: In above topology OSPFv3 has been run over R1, R2 and R3 within same area AREA 0. Note 2: Static routes has been used between R3 and R4 for reach-ability.

Verification:

R1#sh bgp ipv6 unicast 

BGP table version is 15, local router ID is 1.1.1.1 
Status codes: s suppressed, d damped, h history, * valid, > best, i – internal, 
r RIB-failure, S Stale 
Origin codes: i – IGP, e – EGP, ? – incomplete

Network                  Next Hop        Metric      LocPrf      Weight      Path 
*> 2002:0:1:2::1/128     ::                0                     32768         i 
*> 2002:0:1:3::1/128     ::                0                     32768         i 
*> 2002:0:2:2::2/128     2001:0:0:13::3    0                       0         65000 i 
*                        2002:0:2:1::2     0                       0         65000 i 
*> 2002:0:2:3::2/128     2001:0:0:13::3    0                       0         65000 i 
*                        2002:0:2:1::2     0                       0         65000 i 
*> 2002:0:3:2::3/128     2001:0:0:13::3    0                       0         65000 i 
*                        2002:0:2:1::2     0                       0         65000 i 
*> 2002:0:3:3::3/128     2001:0:0:13::3    0                       0         65000 i 
*                        2002:0:2:1::2     0                       0         65000 i 
*> 2002:0:4:2::4/128     2001:0:0:13::3    0                       0         65000 65200 i 
*                        2002:0:2:1::2     0                       0         65000 65200 i 
*> 2002:0:4:3::4/128     2001:0:0:13::3    0                       0         65000 65200 i 
*                        2002:0:2:1::2     0                       0         65000 65200 i 

Here we can observe that all the routes have crossed the same AS though learnt via different next-hops.

Modifications on R3

R3(config)#route-map AS permit 10 
R3(config-route-map)# set as-path prepend 33 
R3(config)#route-map AS permit 20 
R3(config)#router bgp 65000 
R3(config-router)#address-family ipv6 
R3(config-router-af)#neighbor 2001:0:0:13::1 route-map AS out 
The above configurations will add an extra AS 33 to all route updates send to neighbor 2001:0:0:13::1.

Verification:

R1#sh bgp ipv6 unicast

BGP table version is 57, local router ID is 1.1.1.1 
Status codes: s suppressed, d damped, h history, * valid, > best, i – internal, 
r RIB-failure, S Stale 
Origin codes: i – IGP, e – EGP, ? – incomplete 

 Network                  Next Hop        Metric      LocPrf      Weight      Path 
*> 2002:0:1:2::1/128      ::                0                     32768       i 
*> 2002:0:1:3::1/128      ::                0                     32768       i
* 2002:0:2:2::2/128       2001:0:0:13::3    0                     0           65000 33 i 
*>                        2002:0:2:1::2     0                     0           65000 i 
* 2002:0:2:3::2/128       2001:0:0:13::3    0                     0           65000 33 i 
*>                        2002:0:2:1::2     0                     0           65000 i 
* 2002:0:3:2::3/128       2001:0:0:13::3    0                     0           65000 33 i 
*>                        2002:0:2:1::2     0                     0           65000 i 
* 2002:0:3:3::3/128       2001:0:0:13::3    0                     0           65000 33 i 
*>                        2002:0:2:1::2     0                     0           65000 i 
* 2002:0:4:2::4/128       2001:0:0:13::3    0                     0           65000 33 65200 i 
*>                        2002:0:2:1::2     0                     0           65000 65200 i 
* 2002:0:4:3::4/128       2001:0:0:13::3    0                     0           65000 33 65200 i 
*>                        2002:0:2:1::2     0                     0           65000 65200 i

Now we can see that all updates are learn via 2001:0:0:13::3 have an extra AS 33 added to them. The result is that now the routes are learn via 2002:0:2:1::2 have become best as they have crossed less AS that the routes learnt via 001:0:0:13::3. Hence it is proved that BGP prefers the path that has crossed less AS. Another thing that can be noted here is though the best has been changed yet previous best path is installed as valid path.

R3#sh bgp ipv6 unicast

BGP table version is 23, local router ID is 3.3.3.3 
Status codes: s suppressed, d damped, h history, * valid, > best, i – internal, 
r RIB-failure, S Stale 
Origin codes: i – IGP, e – EGP, ? – incomplete 

 Network                  Next Hop                      Metric      LocPrf      Weight      Path  
*> 2002:0:1:2::1/128      2001:0:0:13::1                0                       0           65100 i 
* i                       2002:0:1:1::1                 0            100        0           65100 i 
*> 2002:0:1:3::1/128      2001:0:0:13::1                0                       0           65100 i 
* i                       2002:0:1:1::1                 0            100        0           65100 i 
*>i2002:0:2:2::2/128      2001::23:C802:CFF:FE78:38     0            100        0           i 
*>i2002:0:2:3::2/128      2001::23:C802:CFF:FE78:38     0            100        0           i 
*> 2002:0:3:2::3/128      ::                            0                       32768       i 
*> 2002:0:3:3::3/128      ::                            0                       32768       i 
*> 2002:0:4:2::4/128      2002:0:4:1::4                 0                       0           65200 i 
*> 2002:0:4:3::4/128      2002:0:4:1::4                 0                       0           65200 i 

Modifications on R1:

R1(config)#route-map AS permit 10 
R1(config-route-map)#set as-path prepend 11 111 
R1(config-route-map)#exit 
R1(config)#route-map AS permit 20 
R1(config-route-map)#exit 
R1(config)#router bgp 65100 
R1(config-router)#address-family ipv6 
R1(config-router-af)#neigh 2002:0:2:1::2 route-map AS out 

Effects: R1 will add additional AS 11 and 111 to all route updates send to neighbor 2002:0:2:1::2.

Verification:

R2#sh bgp ipv6 unicast

BGP table version is 11, local router ID is 2.2.2.2 
Status codes: s suppressed, d damped, h history, * valid, > best, i – internal, 
r RIB-failure, S Stale 
Origin codes: i – IGP, e – EGP, ? – incomplete 

 Network                  Next Hop                      Metric      LocPrf      Weight      Path
* 2002:0:1:2::1/128       2002:0:1:1::1                 0                       0           65100 11 111 
i 
*>i                       2001::23:C803:CFF:FE78:38     0           100         0           65100 i 
* 2002:0:1:3::1/128       2002:0:1:1::1                 0                       0           65100 11 111 
i 
*>i                       2001::23:C803:CFF:FE78:38     0           100         0           65100 i 
*> 2002:0:2:2::2/128      ::                            0                       32768       i 
*> 2002:0:2:3::2/128      ::                            0                       32768       i 
*>i2002:0:3:2::3/128      2001::23:C803:CFF:FE78:38     0           100         0           i 
*>i2002:0:3:3::3/128      2001::23:C803:CFF:FE78:38     0           100         0           i 
*>i2002:0:4:2::4/128      2001::23:C803:CFF:FE78:38     0           100         0           65200 i 
*>i2002:0:4:3::4/128      2001::23:C803:CFF:FE78:38     0           100         0           65200 i

Here it can be noted that routes are learn via 2002:0:1:1::1 have added AS 11 and 111 to them. Now the paths learn via eBGP are not the best path, instead path via iBGP has become best.

R3#sh bgp ipv6 unicast

BGP table version is 27, local router ID is 3.3.3.3 
Status codes: s suppressed, d damped, h history, * valid, > best, i – internal, 
r RIB-failure, S Stale 
Origin codes: i – IGP, e – EGP, ? – incomplete 

 Network                  Next Hop                      Metric      LocPrf      Weight      Path
*> 2002:0:1:2::1/128      2001:0:0:13::1                0                       0           65100 i
*> 2002:0:1:3::1/128      2001:0:0:13::1                0                       0           65100 i 
*>i2002:0:2:2::2/128      2001::23:C802:CFF:FE78:38     0           100         0           i 
*>i2002:0:2:3::2/128      2001::23:C802:CFF:FE78:38     0           100         0           i 
*> 2002:0:3:2::3/128      ::                            0                       32768       i 
*> 2002:0:3:3::3/128      ::                            0                       32768       i 
*> 2002:0:4:2::4/128      2002:0:4:1::4                 0                       0           65200 i 
*> 2002:0:4:3::4/128      2002:0:4:1::4                 0                       0           65200 i 

The paths previously learnt via 2002:0:1:1::1 (iBGP routes) were not best. When administrator configured R1 such that those path become inferior (in other words paths via 2001:0:0:13::1 has been declared superior by administrator) on R3 BGP has removed paths via 2002:0:1:1::1 from its BGP table.