IPv6 - BGP Weight
BGP Weight
In IPv6 BGP (Border Gateway Protocol), the BGP weight attribute is a local and non-transitive metric used to influence the route selection process within an autonomous system. Unlike some BGP attributes that are exchanged between routers, the BGP weight is only significant within a router and is not propagated to other routers. When a router learns multiple routes to the same destination, it assigns a weight to each route, and the route with the highest weight is preferred. BGP weight is a Cisco-specific attribute and is primarily used to provide a simple and effective means of influencing route selection within an AS. It is important to note that BGP weight is not a standard attribute defined in the BGP protocol itself, so its usage is specific to Cisco routers and may not be recognized by routers from other vendors.
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
!
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 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
!
Weight attribute is used to change the path selection decision of BGP locally on a router. IT never propogates outside the router.
Weight attribute is CISCO proprietory attribute. More the weight, better the path.
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 reachability.
Verification:
R1#sh bgp ipv6 unicast
BGP table version is 11, 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 2002:0:2:1::2 0 0 65000 i
*> 2001:0:0:13::3 0 0 65000 i
* 2002:0:3:3::3/128 2002:0:2:1::2 0 0 65000 i
*> 2001:0:0:13::3 0 0 65000 i
* 2002:0:4:2::4/128 2002:0:2:1::2 0 0 65000 65200 i
*> 2001:0:0:13::3 0 0 65000 65200 i
* 2002:0:4:3::4/128 2002:0:2:1::2 0 0 65000 65200 i
*> 2001:0:0:13::3 0 0 65000 65200 i
Here the best paths selected by BGP are via R3.
Changes on R1
R1(config)#router bgp 65100
R1(config-router)#addr
R1(config-router)#address-family ipv6
R1(config-router-af)#neigh 2002:0:2:1::2 weight 100 (Command will set weight 100 on all the route updates
received by R2)
R1(config-router-af)#^Z
R1#clear bgp ipv6 unicast 2002:0:2:1::2
Verification:
R1#sh bgp ipv6 unicast
BGP table version is 11, 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 100 65000 i
* 2002:0:2:3::2/128 2001:0:0:13::3 0 0 65000 i
*> 2002:0:2:1::2 0 100 65000 i
*> 2002:0:3:2::3/128 2002:0:2:1::2 0 100 65000 i
* 2001:0:0:13::3 0 0 65000 i
*> 2002:0:3:3::3/128 2002:0:2:1::2 0 100 65000 i
* 2001:0:0:13::3 0 0 65000 i
*> 2002:0:4:2::4/128 2002:0:2:1::2 0 100 65000 65200 i
* 2001:0:0:13::3 0 0 65000 65200 i
*> 2002:0:4:3::4/128 2002:0:2:1::2 0 100 65000 65200 i
* 2001:0:0:13::3 0 0 65000 65200 i
The weight is increased from 0 to 100 for routes received via R2 (2002:0:0:1::2) and those paths have been selected as best paths by BGP.