IPv6 - BGP Local Preference

BGP Local Preference

In IPv6 BGP (Border Gateway Protocol), the Local Preference attribute is a key metric used to influence the selection of the best path for outbound traffic within an autonomous system. The Local Preference value is assigned locally to incoming BGP routes and is not propagated to external BGP peers. Higher Local Preference values are considered more preferable, guiding the BGP decision-making process when multiple exit points exist within the same autonomous system. IPv6 BGP administrators can configure Local Preference to prioritize specific routes based on policies or performance considerations. This attribute is particularly valuable for traffic engineering purposes, allowing administrators to control the preferred exit points for outbound traffic, optimize network performance, and ensure efficient utilization of network resources. Careful configuration of Local Preference values is crucial for achieving desired routing behaviors within an IPv6 BGP environment.

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 
no ip address 
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 2001:0:0:13::3 route-map AS out 
neighbor 2002:0:2:1::2 activate 
exit-address-family 
! 
ipv6 router ospf 1 
router-id 1.1.1.1 
log-adjacency-changes 
! 
route-map AS permit 10 
set as-path prepend 11 111 
! 
route-map AS permit 20 
!

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 Serial1/2 
no ip address 
ipv6 address 2001:0:0:25::2/64 
ipv6 ospf 1 area 0 
serial restart-delay 0 
! 
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 2001:0:0:25::5 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 2001:0:0:25::5 activate 
neighbor 2001:0:0:25::5 next-hop-self 
neighbor 2002:0:1:1::1 activate 
exit-address-family 
! 
ipv6 router ospf 1 
router-id 2.2.2.2 
log-adjacency-changes 
!

R3 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 Serial1/3 
no ip address 
ipv6 address 2001:0:0:35::3/64 
ipv6 ospf 1 area 0 
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 2001:0:0:35::5 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:0:0:35::5 activate 
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 
!

R5 Router Config:

! 
ipv6 unicast-routing 
ipv6 cef 
! 
interface Serial1/2 
no ip address 
ipv6 address 2001:0:0:25::5/64 
serial restart-delay 0 
! 
interface Serial1/3 
no ip address 
ipv6 address 2001:0:0:35::5/64 
ipv6 ospf 1 area 0 
serial restart-delay 0 
! 
router bgp 65000 
no synchronization 
bgp router-id 5.5.5.5 
bgp log-neighbor-changes 
neighbor 2001:0:0:25::2 remote-as 65000 
neighbor 2001:0:0:35::3 remote-as 65000 
no auto-summary 
! 
address-family ipv6 
neighbor 2001:0:0:25::2 activate 
neighbor 2001:0:0:25::2 route-reflector-client 
neighbor 2001:0:0:35::3 activate 
exit-address-family 
! 
ipv6 router ospf 1 
router-id 5.5.5.5 
log-adjacency-changes 
!

Verification:

R3#sh bgp ipv6 unicast

BGP table version is 19, 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 
* i2002:0:1:2::1/128     2001:0:0:25::2                0            100         0           65100 i 
*>i                      2002:0:1:1::1                 0            100         0           65100 i 
*                        2001:0:0:13::1                0                        0           65100 11 111 
i 
* i2002:0:1:3::1/128     2001:0:0:25::2                0            100         0           65100 i 
*>i                      2002:0:1:1::1                 0            100         0           65100 i 
*                        2001:0:0:13::1                0                        0           65100 11 111 
i 
* i2002:0:2:2::2/128     2001:0:0:25::2                0            100         0           i 
*>i                      2001::23:C802:CFF:FE78:38     0            100         0           i 
* i2002:0:2:3::2/128     2001:0:0:25::2                0            100         0           i 
*>i                      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

Route-refelctor has been used on R5 to advertize iBGP routes of R2 on R3. Thus, R3 has learned routes 2002:0:1:2::1/128 and 2002:0:1:2::1/128 from three neighbors R1, R2 and R5. Initially best path for the above mentioned routes on R3 was through R1. (eBGP path prefered over iBGP paths) Hence route-map has been used on R1 to insert a few more AS while sending updates to R3. This make the best path for above mentioned routes via R2 on R3.

Modifications on R5:

R5(config)#router bgp 65000 
R5(config-router)#address-family ipv6 
R5(config-router-af)# neigh 2001:0:0:25::2 route-map LOCAL in (Set route-map for incoming uodates from this 
neighbor)
R5(config-router-af)#exit 
R5(config-router)#exit 
R5(config)#route-map LOCAL permit 10 
R5(config-route-map)#set local-preference 2000 (Set local-preference in this route-map for the updates where this 
route-map has been called)
R5(config-route-map)#exit
R5(config)#route-map LOCAL permit 20 
R5(config-route-map)#end 
R5#clear bgp ipv6 unicast 2001:0:0:25::2 

Verification:

R5#sh bgp ipv6 unicast

BGP table version is 23, local router ID is 5.5.5.5 
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 
* i2002:0:1:2::1/128    2001:0:0:25::2                0            100          0          65100 i 
*>i                     2002:0:1:1::1                 0            100          0          65100 i 
*                       2001:0:0:13::1                0                         0          65100 11 111 i 
* i2002:0:1:3::1/128    2001:0:0:25::2                0            100          0          65100 i 
*>i                     2002:0:1:1::1                 0            100          0          65100 i 
*                       2001:0:0:13::1                0                         0          65100 11 111 i 
* i2002:0:2:2::2/128    2001:0:0:25::2                0            100          0          i 
*>i                     2001::23:C802:CFF:FE78:38     0            100          0          i 
* i2002:0:2:3::2/128    2001:0:0:25::2                0            100          0          i 
*>i                     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
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 
*>i2002:0:1:2::1/128    2001:0:0:25::2                0            2000        0           65100 i 
* i                     2002:0:1:1::1                 0            100         0           65100 i 
*                       2001:0:0:13::1                0                        0           65100 11 111 
i 
*>i2002:0:1:3::1/128    2001:0:0:25::2                0            2000        0           65100 i 
* i                     2002:0:1:1::1                 0            100         0           65100 i 
*                       2001:0:0:13::1                0                        0           65100 11 111 i 
*>i2002:0:2:2::2/128    2001:0:0:25::2                0            2000        0           i 
* i                     2001::23:C802:CFF:FE78:38     0            100         0           i 
*>i2002:0:2:3::2/128    2001:0:0:25::2                0            2000        0           i 
* i                     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
  1. Local preference 2000 has been set on all incoming route updates from neighbor 2001:0:0:25::2
  2. This local preference has been propogated to iBGP neighbors (R3 in this case).
  3. The local preference need to be set only on one router and is propogated throughout the iBGP topology.
  4. Local Preference can not be set for a eBGP route.
  5. Higher the value of Local preference better the path is.