At BGP best path selection algorithm the weight attribute is first.
The default weight for learned routes is 0 and the default weight for a locally originated route is 32768. Weight attribute is preferred large number weight. Only effect on outgoing traffic.
Weight attribute on neighbor
R1
router bgp 140
no synchronization
bgp log-neighbor-changes
network 1.1.1.0 mask 255.255.255.0
neighbor 10.1.12.2 remote-as 200
neighbor 10.1.14.4 remote-as 140
neighbor 10.1.14.4 next-hop-self
neighbor 10.1.14.4 weight 100
no auto-summary
R2
router bgp 200
no synchronization
bgp log-neighbor-changes
neighbor 10.1.12.1 remote-as 140
neighbor 10.1.25.5 remote-as 500
no auto-summary
R3
router bgp 300
no synchronization
bgp log-neighbor-changes
neighbor 10.1.34.4 remote-as 140
neighbor 10.1.35.5 remote-as 500
no auto-summary
R4
router bgp 140
no synchronization
bgp log-neighbor-changes
neighbor 10.1.14.1 remote-as 140
neighbor 10.1.14.1 next-hop-self
neighbor 10.1.34.3 remote-as 300
no auto-summary
R5
router bgp 500
no synchronization
bgp log-neighbor-changes
network 5.5.5.0 mask 255.255.255.0
neighbor 10.1.25.2 remote-as 200
neighbor 10.1.35.3 remote-as 300
no auto-summary
Verification
R1
Before
R1#sh ip bgp
BGP table version is 3, 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
*> 1.1.1.0/24 0.0.0.0 0 32768 i
* i5.5.5.0/24 10.1.14.4 0 100 0 300 500 i
*> 10.1.12.2 0 200 500 i
After
R1#sh ip bgp
BGP table version is 7, 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
*> 1.1.1.0/24 0.0.0.0 0 32768 i
*>i5.5.5.0/24 10.1.14.4 0 100 100 300 500 i
* 10.1.12.2 0 200 500 i
R1#trace 5.5.5.5 source 1.1.1.1
Type escape sequence to abort.
Tracing the route to 5.5.5.5
1 10.1.14.4 12 msec 52 msec 12 msec
2 10.1.34.3 12 msec 24 msec 20 msec
3 10.1.35.5 44 msec 20 msec 24 msec
R5#trace 1.1.1.1 so lo0
Type escape sequence to abort.
Tracing the route to 1.1.1.1
1 10.1.25.2 8 msec 8 msec 12 msec
2 10.1.12.1 32 msec 24 msec 44 msec
BGP weight attribute is not share to neighbor.
R4#sh ip bgp
BGP table version is 10, local router ID is 10.1.34.4
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
*>i1.1.1.0/24 10.1.14.1 0 100 0 i
*> 5.5.5.0/24 10.1.34.3 0 300 500 i
Weight attribute with Route map
Let add the network 55.55.55.0/24 network at R5. So we can compare 5.5.5.0/24 network and 55.55.55.0/24 network.
First remove the previous configure.
Configuration
R1
router bgp 140
no neighbor 10.1.14.4 weight 100
Clear ip bgp *
Be careful this command effect all routes.
access-list 1 permit 5.5.5.0 0.0.0.255
route-map R5_Weight permit 10
match ip address 1
set weight 200
router bgp 140
neighbor 10.1.14.4 route-map R5_Weight in
Verification
R1#sh ip bgp
BGP table version is 4, 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
*> 1.1.1.0/24 0.0.0.0 0 32768 i
* 5.5.5.0/24 10.1.12.2 0 200 500 i
*>i 10.1.14.4 0 100 200 300 500 i
*> 55.55.55.0/24 10.1.12.2 0 200 500 i
R1#traceroute 5.5.5.5 source 1.1.1.1
Type escape sequence to abort.
Tracing the route to 5.5.5.5
1 10.1.14.4 16 msec 36 msec 44 msec
2 10.1.34.3 20 msec 24 msec 20 msec
3 10.1.35.5 44 msec 24 msec 44 msec
R1#traceroute 55.55.55.55 source 1.1.1.1
Type escape sequence to abort.
Tracing the route to 55.55.55.55
1 10.1.12.2 12 msec 32 msec 44 msec
2 10.1.25.5 88 msec 64 msec 24 msec
The default weight for learned routes is 0 and the default weight for a locally originated route is 32768. Weight attribute is preferred large number weight. Only effect on outgoing traffic.
Figure 1.1
In this scenario by default R1 will choose AS200 to reach AS500. We want to use AS300 path to reach to AS500. So let play with weight. We have two options using to Weight
- Set the weight attribute on the neighbor (That will affect all routes learn from that neighbor)
- Using Route map can specific routes to have the weight set.
Weight attribute on neighbor
R1
router bgp 140
no synchronization
bgp log-neighbor-changes
network 1.1.1.0 mask 255.255.255.0
neighbor 10.1.12.2 remote-as 200
neighbor 10.1.14.4 remote-as 140
neighbor 10.1.14.4 next-hop-self
neighbor 10.1.14.4 weight 100
no auto-summary
R2
router bgp 200
no synchronization
bgp log-neighbor-changes
neighbor 10.1.12.1 remote-as 140
neighbor 10.1.25.5 remote-as 500
no auto-summary
R3
router bgp 300
no synchronization
bgp log-neighbor-changes
neighbor 10.1.34.4 remote-as 140
neighbor 10.1.35.5 remote-as 500
no auto-summary
R4
router bgp 140
no synchronization
bgp log-neighbor-changes
neighbor 10.1.14.1 remote-as 140
neighbor 10.1.14.1 next-hop-self
neighbor 10.1.34.3 remote-as 300
no auto-summary
R5
router bgp 500
no synchronization
bgp log-neighbor-changes
network 5.5.5.0 mask 255.255.255.0
neighbor 10.1.25.2 remote-as 200
neighbor 10.1.35.3 remote-as 300
no auto-summary
Verification
R1
Before
R1#sh ip bgp
BGP table version is 3, 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
*> 1.1.1.0/24 0.0.0.0 0 32768 i
* i5.5.5.0/24 10.1.14.4 0 100 0 300 500 i
*> 10.1.12.2 0 200 500 i
After
R1#sh ip bgp
BGP table version is 7, 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
*> 1.1.1.0/24 0.0.0.0 0 32768 i
*>i5.5.5.0/24 10.1.14.4 0 100 100 300 500 i
* 10.1.12.2 0 200 500 i
R1#trace 5.5.5.5 source 1.1.1.1
Type escape sequence to abort.
Tracing the route to 5.5.5.5
1 10.1.14.4 12 msec 52 msec 12 msec
2 10.1.34.3 12 msec 24 msec 20 msec
3 10.1.35.5 44 msec 20 msec 24 msec
R5#trace 1.1.1.1 so lo0
Type escape sequence to abort.
Tracing the route to 1.1.1.1
1 10.1.25.2 8 msec 8 msec 12 msec
2 10.1.12.1 32 msec 24 msec 44 msec
BGP weight attribute is not share to neighbor.
R4#sh ip bgp
BGP table version is 10, local router ID is 10.1.34.4
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
*>i1.1.1.0/24 10.1.14.1 0 100 0 i
*> 5.5.5.0/24 10.1.34.3 0 300 500 i
Weight attribute with Route map
Let add the network 55.55.55.0/24 network at R5. So we can compare 5.5.5.0/24 network and 55.55.55.0/24 network.
First remove the previous configure.
Configuration
R1
router bgp 140
no neighbor 10.1.14.4 weight 100
Clear ip bgp *
Be careful this command effect all routes.
access-list 1 permit 5.5.5.0 0.0.0.255
route-map R5_Weight permit 10
match ip address 1
set weight 200
router bgp 140
neighbor 10.1.14.4 route-map R5_Weight in
Verification
R1#sh ip bgp
BGP table version is 4, 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
*> 1.1.1.0/24 0.0.0.0 0 32768 i
* 5.5.5.0/24 10.1.12.2 0 200 500 i
*>i 10.1.14.4 0 100 200 300 500 i
*> 55.55.55.0/24 10.1.12.2 0 200 500 i
R1#traceroute 5.5.5.5 source 1.1.1.1
Type escape sequence to abort.
Tracing the route to 5.5.5.5
1 10.1.14.4 16 msec 36 msec 44 msec
2 10.1.34.3 20 msec 24 msec 20 msec
3 10.1.35.5 44 msec 24 msec 44 msec
R1#traceroute 55.55.55.55 source 1.1.1.1
Type escape sequence to abort.
Tracing the route to 55.55.55.55
1 10.1.12.2 12 msec 32 msec 44 msec
2 10.1.25.5 88 msec 64 msec 24 msec
Comments
Post a Comment