BGP Attributes - Weight

In the previous posts I explained how AS-prepend, MED and Local Preference works. In this post I will explain how weight works.

Weight is commonly used to manipulate how traffic exits your network. Local preference does the same this is simply another way to reach the same goal.

Below the network-diagram I used for this post, it is the same network-diagram which I used in the Local Preference post.

MPLS

Weight uses these values :

Weight

- traffic going out

- Default = 0 Higher is preferred

- Paths that the router originates have a weight of 32768 by default

For this post we are going to configure a higher weight to manipulate the traffic-flow to go via router R13.

R2 :


router bgp 65010
 no synchronization
 bgp log-neighbor-changes
 network 10.10.2.0 mask 255.255.255.0
 neighbor 150.1.61.6 remote-as 65010
 neighbor 150.1.61.13 remote-as 65010
 neighbor 150.1.61.13 weight 10
 no auto-summary
    

R6 :


router bgp 65010
 no synchronization
 bgp log-neighbor-changes
 network 10.10.6.0 mask 255.255.255.0
 neighbor 150.1.46.4 remote-as 1
 neighbor 150.1.61.2 remote-as 65010
 neighbor 150.1.61.2 next-hop-self
 neighbor 150.1.61.13 remote-as 65010
 no auto-summary
    

R13 :


router bgp 65010
 no synchronization
 bgp log-neighbor-changes
 network 10.10.13.0 mask 255.255.255.0
 redistribute static route-map DS
 neighbor 150.1.31.3 remote-as 1
 neighbor 150.1.61.2 remote-as 65010
 neighbor 150.1.61.2 next-hop-self
 neighbor 150.1.61.6 remote-as 65010
 no auto-summary
    

Now let’s do a ping, traceroute and a “sh ip bgp” on router R2 to router R5 before configuring the weight :

R2 :


R2#ping 10.10.5.5 source loopback 1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.10.5.5, timeout is 2 seconds:
Packet sent with a source address of 10.10.2.2
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 140/166/220 ms

R2#traceroute
Protocol [ip]:
Target IP address: 10.10.5.5
Source address: 10.10.2.2
Numeric display [n]:
Timeout in seconds [3]:
Probe count [3]:
Minimum Time to Live [1]:
Maximum Time to Live [30]:
Port Number [33434]:
Loose, Strict, Record, Timestamp, Verbose[none]:
Type escape sequence to abort.
Tracing the route to 10.10.5.5

  1 150.1.61.6 92 msec 92 msec 36 msec
  2 150.1.46.4 [AS 1] 72 msec 36 msec 40 msec
  3 150.1.45.5 [AS 1] 116 msec *  100 msec

R2#sh ip bgp
BGP table version is 7, local router ID is 150.100.20.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
* i10.10.5.0/24     150.1.61.13              0    100      0 1 65011 i
*>i                 150.1.61.6               0    100      0 1 65011 i
*>i10.10.6.0/24     150.1.61.6               0    100      0 i
*>i10.10.13.0/24    150.1.61.13              0    100      0 i
* i150.1.31.0/24    150.1.61.13              0    100      0 1 ?
*>i                 150.1.61.6               0    100      0 1 ?
* i150.1.45.0/24    150.1.61.13              0    100      0 1 ?
*>i                 150.1.61.6               0    100      0 1 ?
* i150.1.46.0/24    150.1.61.13              0    100      0 1 ?
*>i                 150.1.61.6               0    100      0 1 ?
    

Now let’s configure the weight on router R2 like below :

R2 :


router bgp 65010
 no synchronization
 bgp log-neighbor-changes
 network 10.10.2.0 mask 255.255.255.0
 neighbor 150.1.61.6 remote-as 65010
 neighbor 150.1.61.13 remote-as 65010
 neighbor 150.1.61.13 weight 10
 no auto-summary
    

Now let’s do a ping, traceroute and a “sh ip bgp” after configuring the weight.

R2 :


R2#ping 10.10.5.5 source loopback 1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.10.5.5, timeout is 2 seconds:
Packet sent with a source address of 10.10.2.2
!!!!!

R2#traceroute
Protocol [ip]: 10.10.5.5
% Unknown protocol - "10.10.5.5", type "trace ?" for help
R2#tra
R2#traceroute
Protocol [ip]:
Target IP address: 10.10.5.5
Source address: 10.10.2.2
Numeric display [n]:
Timeout in seconds [3]:
Probe count [3]:
Minimum Time to Live [1]:
Maximum Time to Live [30]:
Port Number [33434]:
Loose, Strict, Record, Timestamp, Verbose[none]:
Type escape sequence to abort.
Tracing the route to 10.10.5.5

  1 150.1.61.13 92 msec 108 msec 68 msec
  2 150.1.31.3 [AS 1] 156 msec 88 msec 60 msec
  3 150.1.13.1 104 msec 192 msec 188 msec
  4 150.1.45.4 [AS 1] 292 msec 140 msec 136 msec
  5 150.1.45.5 [AS 1] 188 msec *  128 msec

R2#sh ip bgp
BGP table version is 25, local router ID is 150.100.20.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
*> 10.10.2.0/24     0.0.0.0                  0         32768 i
* i10.10.5.0/24     150.1.61.6               0    100      0 1 65011 i
*>i                 150.1.61.13              0    100     10 1 65011 i
*>i10.10.6.0/24     150.1.61.6               0    100      0 i
*>i10.10.13.0/24    150.1.61.13              0    100     10 i
* i150.1.31.0/24    150.1.61.6               0    100      0 1 ?
*>i                 150.1.61.13              0    100     10 1 ?
* i150.1.45.0/24    150.1.61.6               0    100      0 1 ?
*>i                 150.1.61.13              0    100     10 1 ?
* i150.1.46.0/24    150.1.61.6               0    100      0 1 ?
*>i                 150.1.61.13              0    100     10 1 ?
    

As you can see above the “>” sign is now saying that traffic goes via router R13

Leave a comment

Your comment