Weight is a Cisco Proprietary attribute for BGP that is "locally significant."
Local Preference is a Well-known Discretionary attribute, Weight doesn't belong to any category.
Default Weight for locally originated routes is 32768.Zero is the default for other routes.
Weight is not propagated to other routers within the AS.
All routers have BGP established and within its own AS.R4 is announcing 4 prefixes and the condition is
for R1 to reach routes 4.4.4.4/32, 44.44.4.44/32 and 144.144.144.144/32, it must take AS2. Then later
configure a route-map to so that R1 with take AS 3 to reach 144.144.144.144/32.
Lets see how R1 reaches the prefixes announced by R4.
R1#sh ip bgp
BGP table version is 12, local router ID is 13.13.13.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
* 4.4.4.4/32 12.12.12.2 0 2 4 i
*> 13.13.13.3 0 3 4 i
* 44.44.44.44/32 12.12.12.2 0 2 4 i
*> 13.13.13.3 0 3 4 i
* 144.144.144.144/32
12.12.12.2 0 2 4 i
*> 13.13.13.3 0 3 4 i
Ok, it takes AS3 to reach the prefixes. Now, lets configure Weight to make AS2 the more preferred path to reach the prefixes.
R1(config)#router bgp 1
R1(config-router)#neighbor 12.12.12.2 weight 100
R1(config-router)#do clear ip bgp * soft
Now let's see if that changes after clearing the BGP session "softly".
R1#sh ip bgp
BGP table version is 15, local router ID is 13.13.13.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
*> 4.4.4.4/32 12.12.12.2 100 2 4 i
* 13.13.13.3 0 3 4 i
*> 44.44.44.44/32 12.12.12.2 100 2 4 i
* 13.13.13.3 0 3 4 i
*> 144.144.144.144/32
12.12.12.2 100 2 4 i
* 13.13.13.3 0 3 4 i
It's now taking AS 2. Let's configure a route-map so R1 will take AS3 to reach 144.144.144.144/32. The weight should be 200. We will apply the route-map towards neighbor 13.13.13.3.
R1(config)#access-list 1 permit host 144.144.144.144
R1(config)#route-map TAKE_AS3 permit 10
R1(config-route-map)#match address 1
R1(config-route-map)#set weight 200
R1(config-router)#neighbor 13.13.13.3 route-map TAKE_AS3 in
R1(config-router)# do clear ip bgp * soft
The ACL is to filter which routes be given a weight of 200. The reason the route-map was configured inbound direction because we are receiving the routes from that neighbor. Let's see what happens to the BGP table.
R1#sh ip bgp
BGP table version is 16, local router ID is 13.13.13.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
*> 4.4.4.4/32 12.12.12.2 100 2 4 i
*> 44.44.44.44/32 12.12.12.2 100 2 4 i
* 144.144.144.144/32
12.12.12.2 100 2 4 i
*> 13.13.13.3 200 3 4 i
Now, R1 will take AS3 to reach 144.144.144.144/32. Notice that the weight now is 200, and its more prefered.
What an excellence explanation! I'd like to request more articles/tutorials. :)
brilliant explanation
Awesome explanation :)
This is a simple explanation but nailed all the target..:)