I wanted to provide a few notes on BGP route selection criteria, specifically on weights and local preference. First a quick recap. The weight attribute is only local to a single router. This value is not propagated by the BGP protocol to other routers, so can be considered a routing policy local to the router. However, local preference is assigned to a route as an attribute.
The local preference value is carried by the BGP protocol with the route to all internal BGP sessions. With local preference, all other BGP speaking routers within the autonomous system (AS) receive the same information. Normally, a router assigns a local preference to a route that is received on an external BGP session before it is accepted and entered in the BGP table of the border router. Routers propagate the local preference attribute on internal BGP sessions only. This policy constitutes a routing policy for the entire AS.
The router can assign the weight attribute to a route in two ways:
- All routes that are received from a specific neighbor can be assigned a default weight value. This weight value indicates that the neighbor is preferred over the other neighbors.
- A route-map that is applied on incoming routes from a neighbor can be used to select some routes and assign them weight values. Remember that a route-map also acts as a filter and will silently drop the routes that are not permitted by any statement in the route-map.
If configured, the default weight assignment on routes that are received from a neighbor is applied first. All routes that are received from the neighbor are assigned a weight value as defined by the default weight.