So we're now going to look at the weight. I've included weight in the list even though it's not really an attribute a bgp attribute is passed from bgp speaker and from as to as a weight isn't passed from any bgp speaker it's just local to the router and it's stored within the bgp rib when prefixes arrive on the router so i like to see weight as a local preference that only applies to the router and indeed it overrides the local preference as we'll see later highest weight wins easy to remember i think a little bit like local preference highest local preference wins it can be applied in a number of ways we can apply weight to all routes from a neighbor so you can apply weight directly on the neighbor peering it can be applied to routes based on a filter as well and it can be applied within the policy language that cisco ios and other vendors implement also so when would we actually use weight well we've got a couple of examples here which have been used and are used on networks on the internet today the first example is to help deploy rpf rpf is reverse path forwarding it's a common check used to catch spoofed source addresses coming from adjacent networks and the internet today so we refer to the diagram if we want to deploy rpf in this case and this is an example of an autonomous system that has got two links to a neighboring as if we want to deploy rpf on this then we need to use the weight otherwise we end up with severe problems with connectivity so let's look at the diagram the link from as1 to as4 from router b to router c is the primary link we also have a backup link from router a to router c and what we want to do is have all the traffic go from as1 to as4 over the b to c link so what we do as we've learned when we looked at the local pref attribute is set high local preference on it so i think that should be quite clear high local pref make it 200 outbound traffic from as1 to as4 goes from router b to router c we have the backup link from route a to router c so if the primary path fails then traffic will use the ac link what now if we want to implement rpf well reverse path forwarding check will check the source address of the packets coming from router c to make sure that they're reachable back through the link they came in on so if we turn on rpf and router a on the link to router c what would happen in the scenario we've set up here well as1 we've set local pref 200 on the path b to c so all prefixes from as4 as seen in as1 of local pref200 including those on route array so when router a does the rpf check a legitimate packet comes in from as4 the source address is as4 address space what's the best path well the best path has local preference 200 from router b not back on the direct link to router c so the rpf check will cause router a to drop that packet even though it is valid this is bad so to work around it what we do is all prefixes we learn on router a from router c we set a high weight if we make the weight even 100 it's the only path we're hearing prefixes directly on everything else we hear about ibgp has weight of zero so this path will win right so that means the rpf check will succeed because now the best path only from router a to router c is on on the direct link for the rest of as1 the local preference 200 will indicate that the best path is through router b and onwards to router c we have included a description of how urpf works elsewhere in this series the second example of the use of the weight is for traffic policy many operators use this if they're trying to give specific paths for specific end users and user customers of theirs here's an example that i've commonly been involved in and it shows how to give particular set of customers a particular transit to other autonomous systems the diagram has as1 as the service provider and maybe a couple of upstreams as4 and ar7 giving connection to the rest of the internet now what as1 wants to do is most of its customers that are connected to as1 walk head through router b to use the big link to as4 to get to the rest of the internet router a also has another connection to another upstream maybe a smaller link maybe a bigger bandwidth link who knows and it may have some customers that are also connected to router a there could be a particular class of customers they could be transit customers again whatever the operator has decided what we want to do is to have the customers connecting to router a to use the direct link through as7 and then to as4 to see the internet while the rest of as1 simply uses the main transit link from b to c to as4 now if we want the whole of as1 to use the main transit link we set local preference 200 on everything we hear from router c the problem with this is that router a then sees the best path through router b so any of the customers connected to router a would see best path to b even though they have an external link to air 7 and then on to as4 so where we fix it for router a customers is to set a weight of 100 and all the prefixes we learn from air 7 and then router a customers would use the outbound path to as7 for their internet access so this is how weight can be used to override local preferences for localized traffic policy it's an extremely useful feature for bgp and it's used by several operators in fairly specialized situations like this so as a recap the weight is not a bgp attribute but it is actually stored in the bgp rib it can be set on the local router and is used by the local router in a case where the network operator wants to override the local preference that's used for the autonomous system.
© Produced by Philip Smith and the Network Startup Resource Center, through the University of Oregon.
Attribution-NonCommercial 4.0 International (CC BY-NC 4.0)
This is a human-readable summary of (and not a substitute for) the license. Disclaimer. You are free to: Share — copy and redistribute the material in any medium or format Adapt — remix, transform, and build upon the material The licensor cannot revoke these freedoms as long as you follow the license terms. Under the following terms: Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. NonCommercial — You may not use the material for commercial purposes. No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.