Saturday, 1 December 2018

What is BGP Weight Attribute? How to configure?

The BGP weight attribute is a Cisco-proprietary attribute used in the BGP best path selection process. It's the very first attribute that a Cisco router evaluates when choosing the best path to a destination.  

Here's a breakdown of what you need to know about the BGP weight attribute:

  • Local Significance: The weight attribute is only locally significant to the router on which it is configured. It is not advertised to any BGP neighbors. This means that setting the weight on one router will not influence the path selection on any other router.  
  • Preference: The path with the highest weight is preferred. If a router has multiple paths to the same destination, the path with the highest weight will be chosen as the best path, and the router will stop evaluating other attributes for that prefix.  
  • Default Values:
    • Routes originated by the local router (through network or aggregate commands, or redistribution) are assigned a default weight of 32768.  
    • Routes learned from BGP neighbors have a default weight of 0.  
  • Range: The weight attribute can be set to any value between 0 and 65535.  
  • Use Cases: The weight attribute is typically used to influence the outbound traffic path for a specific router. For example:  
    • Preferring a higher-bandwidth link over a lower-bandwidth link when multiple paths to the internet exist.
    • Forcing traffic to exit the autonomous system (AS) through a specific peering point.
    • Creating a primary and backup path for redundancy on a local router.
  • Configuration: You can configure the weight attribute on a Cisco router using the neighbor weight <value> command under the BGP configuration for a specific neighbor. You can also set it using route maps.  
  • Vendor Specific: Because the weight attribute is Cisco proprietary, it is not recognized by routers from other vendors like Juniper. On non-Cisco devices, the BGP best path selection process starts with other attributes like Local Preference.  

In summary, the BGP weight attribute is a powerful, yet locally scoped, tool on Cisco routers that allows administrators to quickly and easily influence the outbound path selection on that specific device.
















lets see the configuration:-

Topology:-
GOAL:

  • configure the topology as per the diagram.
  • configure the basic iBGP and EBGP peering using directly connected interfaces.
  • advertise all the interfaces as per the topology
  • configure the next-hop address should be the next router address
  • configure router 4 to prefer exit path via router1 to reach all the networks.



R1#show ip interface brief
Interface              IP-Address      OK? Method Status                Protocol
FastEthernet0/0        10.1.1.1        YES NVRAM  up                    up
Serial3/0                   1.1.1.1         YES NVRAM  up                    up
Serial3/3                  4.1.1.2         YES NVRAM  up                    up
Loopback0              11.0.0.1        YES NVRAM  up                    up
Loopback1              11.0.1.1        YES NVRAM  up                    up
Loopback2              11.0.2.1        YES NVRAM  up                    up
Loopback3              11.0.3.1        YES NVRAM  up                    up

R2#show ip interface brief
Interface              IP-Address      OK? Method Status                Protocol
FastEthernet0/0        20.1.1.1        YES NVRAM  up                    up
Serial3/0                    1.1.1.2         YES NVRAM  up                    up
Serial3/1                    2.1.1.1         YES NVRAM  up                    up
Loopback0              12.0.0.1        YES NVRAM  up                    up
Loopback1              12.0.1.1        YES NVRAM  up                    up
Loopback2              12.0.2.1        YES NVRAM  up                    up
Loopback3              12.0.3.1        YES NVRAM  up                    up


R3#show ip interface brief
Interface              IP-Address      OK? Method Status                Protocol
FastEthernet0/0        30.1.1.1        YES NVRAM  up                    up
Serial3/1                    2.1.1.2         YES NVRAM  up                    up
Serial3/2                    3.1.1.1         YES NVRAM  up                    up
Loopback0              13.0.0.1        YES NVRAM  up                    up
Loopback1              13.0.1.1        YES NVRAM  up                    up
Loopback2              13.0.2.1        YES NVRAM  up                    up
Loopback3              13.0.3.1        YES NVRAM  up                    up

R4#show ip interface brief
Interface              IP-Address      OK? Method Status                Protocol
FastEthernet0/0        40.1.1.1        YES NVRAM  up                    up
Serial3/2                    3.1.1.2         YES NVRAM  up                    up
Serial3/3                    4.1.1.1         YES NVRAM  up                    up
Loopback0              14.0.0.1        YES NVRAM  up                    up
Loopback1              14.0.1.1        YES NVRAM  up                    up
Loopback2              14.0.2.1        YES NVRAM  up                    up
Loopback3              14.0.3.1        YES NVRAM  up                    up


R1(config)#router bgp 65111
R1(config-router)#neighbor 1.1.1.2 remote-as 65111
R1(config-router)#neighbor 4.1.1.1 remote-as 65444
R1(config-router)#neighbor 1.1.1.2 next-hop-self
R1(config-router)#network 10.0.0.0
R1(config-router)#network 1.0.0.0
R1(config-router)#network 4.0.0.0
R1(config-router)#network 11.0.0.0 mask 255.255.255.0
R1(config-router)#no auto-summary
R1(config-router)#no synchronization


R2(config)#router bgp 65111
R2(config-router)#neighbor 1.1.1.1 remote-as 65111
R2(config-router)#neighbor 2.1.1.2 remote-as 65333
R2(config-router)#neighbor 1.1.1.1 next-hop-self
R2(config-router)#network 20.0.0.0
R2(config-router)#network 2.0.0.0
R2(config-router)#network 1.0.0.0
R2(config-router)#network 12.0.0.0 mask 255.255.255.0
R2(config-router)#no auto-summary
R2(config-router)#no synchronization

R3(config)#router bgp 65333
R3(config-router)#neighbor 2.1.1.1 remote-as 65111
R3(config-router)#neighbor 3.1.1.2  remote-as 65444
R3(config-router)#network 30.0.0.0
R3(config-router)#network 3.0.0.0
R3(config-router)#network 2.0.0.0
R3(config-router)#network 13.0.0.0 mask 255.255.255.0
R3(config-router)#no synchronization
R3(config-router)#no auto-summary

R4(config)#router bgp 65444
R4(config-router)#neighbor 3.1.1.1 remote-as 65333
R4(config-router)#neighbor 4.1.1.2 remote-as 65111
R4(config-router)#network 40.0.0.0
R4(config-router)#network 4.0.0.0
R4(config-router)#network 14.0.0.0 mask 255.255.255.0
R4(config-router)#network 3.0.0.0
R4(config-router)#no synchronization
R4(config-router)#no auto-summary


R1#show ip bgp summary
BGP router identifier 11.0.3.1, local AS number 65111
Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
1.1.1.2         4        65111      14      13       14    0    0 00:06:21        7
4.1.1.1         4        65444      14       9       14    0    0 00:02:07        7


R2#show ip bgp summary
BGP router identifier 12.0.3.1, local AS number 65111
Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
1.1.1.1         4        65111      13      14       14    0    0 00:06:56        7
2.1.1.2         4        65333      11      12       14    0    0 00:04:29        6

R3#show ip bgp summary
BGP router identifier 13.0.3.1, local AS number 65333
Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
2.1.1.1         4        65111      13      12       14    0    0 00:05:27        9
3.1.1.2         4        65444      11      14       14    0    0 00:03:59        9


R4#show ip bgp summary
BGP router identifier 14.0.3.1, local AS number 65444
Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
3.1.1.1         4        65333      14      12       21    0    0 00:04:25       10
4.1.1.2         4        65111      11      16       21    0    0 00:04:05        9

R4#sh ip bgp
BGP table version is 21, local router ID is 14.0.3.1
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
 *>  1.0.0.0          4.1.1.2                  0             0       65111 i
 *                          3.1.1.1                  0         65333 65111 i
 *   2.0.0.0          4.1.1.2                                0 65111 i
 *>                   3.1.1.1                  0             0 65333 i
 *>  3.0.0.0          0.0.0.0                  0         32768 i
 *                    3.1.1.1                  0             0 65333 i
 *>  4.0.0.0          0.0.0.0                  0         32768 i
 *                    4.1.1.2                  0             0 65111 i
 *                    3.1.1.1                                0 65333 65111 i
 *>  10.0.0.0         4.1.1.2                  0             0 65111 i
 *                    3.1.1.1                                0 65333 65111 i
 *>  11.0.0.0/24      4.1.1.2                  0             0 65111 i
 *                    3.1.1.1                                0 65333 65111 i
 *>  12.0.0.0/24      4.1.1.2                                0 65111 i
     Network          Next Hop            Metric LocPrf Weight Path
 *                    3.1.1.1                                0 65333 65111 i
 *   13.0.0.0/24      4.1.1.2                                0 65111 65333 i
 *>                   3.1.1.1                  0             0 65333 i
 *>  14.0.0.0/24      0.0.0.0                  0         32768 i
 *>  20.0.0.0         4.1.1.2                                0 65111 i
 *                    3.1.1.1                                0 65333 65111 i
 *   30.0.0.0         4.1.1.2                                0 65111 65333 i
 *>                   3.1.1.1                  0             0 65333 i
 *>  40.0.0.0         0.0.0.0                  0         32768 i


R4#traceroute 30.1.1.1
Type escape sequence to abort.
Tracing the route to 30.1.1.1
VRF info: (vrf in name/id, vrf out name/id)
  1 3.1.1.1 168 msec 60 msec 24 msec 

To reach the 30.1.1.1 router 4 by default using 3.1.1.1 interface because it has less numbers of AS.
but we want to router 4 go via 4.1.1.1 interface to reach all the networks.

R4(config)#router bgp 65444
R4(config-router)#neighbor 4.1.1.2 weight 20000
R4(config-router)#end

R4#clear ip bgp * soft

R4#traceroute 30.1.1.1
Type escape sequence to abort.
Tracing the route to 30.1.1.1
VRF info: (vrf in name/id, vrf out name/id)
  1 4.1.1.2 8 msec 56 msec 4 msec
  2 1.1.1.2 [AS 65111] 52 msec 40 msec 36 msec
  3 2.1.1.2 [AS 65111] 52 msec 40 msec 64 msec

R4#show ip bgp 30.1.1.1
BGP routing table entry for 30.0.0.0/8, version 22
Paths: (2 available, best #1, table default)
  Advertised to update-groups:
     1
  Refresh Epoch 2
  65111 65333
    4.1.1.2 from 4.1.1.2 (11.0.3.1)
      Origin IGP, localpref 100, weight 20000, valid, external, best
      rx pathid: 0, tx pathid: 0x0
  Refresh Epoch 3
  65333
    3.1.1.1 from 3.1.1.1 (13.0.3.1)
      Origin IGP, metric 0, localpref 100, valid, external
      rx pathid: 0, tx pathid: 0
R4#show ip bgp
R4#show ip bgp
BGP table version is 29, local router ID is 14.0.3.1
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
 *>  1.0.0.0          4.1.1.2                  0         20000 65111 i
 *                    3.1.1.1                                0 65333 65111 i
 *>  2.0.0.0          4.1.1.2                            20000 65111 i
 *                    3.1.1.1                  0             0 65333 i
 *>  3.0.0.0          0.0.0.0                  0         32768 i
 *                    3.1.1.1                  0             0 65333 i
 *>  4.0.0.0          0.0.0.0                  0         32768 i
 *                    4.1.1.2                  0         20000 65111 i
 *                    3.1.1.1                                0 65333 65111 i
 *>  10.0.0.0         4.1.1.2                  0         20000 65111 i
 *                    3.1.1.1                                0 65333 65111 i
 *>  11.0.0.0/24      4.1.1.2                  0         20000 65111 i
 *                    3.1.1.1                                0 65333 65111 i
 *>  12.0.0.0/24      4.1.1.2                            20000 65111 i
     Network          Next Hop            Metric LocPrf Weight Path
 *                        3.1.1.1                                0 65333 65111 i
 *>  13.0.0.0/24      4.1.1.2                            20000 65111 65333 i
 *                    3.1.1.1                  0             0 65333 i
 *>  14.0.0.0/24      0.0.0.0                  0         32768 i
 *>  20.0.0.0         4.1.1.2                            20000 65111 i
 *                    3.1.1.1                                0 65333 65111 i
 *>  30.0.0.0         4.1.1.2                            20000 65111 65333 i
 *                    3.1.1.1                  0             0 65333 i
 *>  40.0.0.0         0.0.0.0                  0         32768 i



 


 


Instagram

Facebook


Twitter



LINKEDIN








No comments:

What is OSPFv2 (Open Shortest Path First version 2) subcommand?

  OSPFv2 (Open Shortest Path First version 2  is a link-state routing protocol designed for IPv4 networks. It is defined in RFC 2328 and is ...