BGP Weight Attribute Configure
BGP Weight Attribute Configure
BGP Weight Attribute is a Cisco Proprietary attribute that influences a router how to reach a certain prefix. The difference between Local Preference and Weight is that the former is propagated within an AS and the latter is router locally significant. Weight can be used if there is one router connected to two or more AS’s or just to just one with two or more eBGP peers. Now, lets configure weight and later use a route-map for more complex use of weight.
- 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.
In this lab, BGP Weight Attribute will be configured and will be using route map for more flexibility. Check the diagram below for details.
All routers have BGP established and within its own AS.R4 is announcing 4 prefixes and the condition is
for R1 to reach routes 22.214.171.124/32, 126.96.36.199/32 and 188.8.131.52/32, it must take AS2. Then later
configure a route-map to so that R1 with take AS 3 to reach 184.108.40.206/32.
Here are the initial BGP configurations on the routers.
R1# ! router bgp 1 no synchronization bgp log-neighbor-changes neighbor 220.127.116.11 remote-as 2 neighbor 18.104.22.168 remote-as 3 no auto-summary R2# ! router bgp 2 no synchronization bgp log-neighbor-changes neighbor 22.214.171.124 remote-as 1 neighbor 126.96.36.199 next-hop-self neighbor 188.8.131.52 remote-as 4 no auto-summary R3# ! router bgp 3 no synchronization bgp log-neighbor-changes neighbor 184.108.40.206 remote-as 1 neighbor 220.127.116.11 next-hop-self neighbor 18.104.22.168 remote-as 4 no auto-summary R4# ! router bgp 4 no synchronization bgp log-neighbor-changes network 22.214.171.124 mask 255.255.255.255 network 126.96.36.199 mask 255.255.255.255 network 188.8.131.52 mask 255.255.255.255 neighbor 184.108.40.206 remote-as 2 neighbor 220.127.116.11 remote-as 3 no auto-summary
Lets see how R1 reaches the prefixes announced by R4.
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 18.104.22.168 weight 100 R1(config-router)#do clear ip bgp * soft
Now let’s see if that changes after clearing the BGP session “softly”.
It’s now taking AS 2. Let’s configure a route-map so R1 will take AS3 to reach 22.214.171.124/32. The weight should be 200. We will apply the route-map towards neighbor 126.96.36.199.
R1(config)#access-list 1 permit host 188.8.131.52 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 184.108.40.206 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.
Now, R1 will take AS3 to reach 220.127.116.11/32. Notice that the weight now is 200, and its more preferred.