BGP Route Selection Explained

BGP is a policy protocol. When a router learns multiple valid routes to the same prefix, it does not simply choose the path with the fewest hops or the lowest bandwidth. It evaluates attributes in a defined sequence, including administrative policy such as local preference and path characteristics such as AS_PATH length. Understanding that sequence is essential for troubleshooting because the “best” BGP path is the path that wins the decision process, not necessarily the path an engineer expected from the physical topology.

This topic is core knowledge for Cisco 350-401, Cisco 300-410, and the broader network engineering certification path. Vendor implementations add details such as Cisco weight, but the durable skill is learning to read the attributes on competing paths and stop at the first criterion that differs.

Start by verifying that each path is valid

A route cannot win if the next hop is unreachable or policy rejected it before the decision process. Troubleshooting should therefore begin with route validity, next-hop reachability, and inbound policy rather than immediately comparing attributes.

Many “BGP best-path” problems are actually route-admission problems. The missing candidate never reached the stage where best-path comparison could occur.

Weight is Cisco-specific and local to the router

On Cisco platforms that support the weight attribute, a higher weight is preferred and the value is not advertised to neighbors. That makes weight useful for a local override but poor for autonomous-system-wide policy because every router would need its own configuration.

Engineers should keep this distinction clear: weight is an implementation-specific local preference mechanism, not a standard BGP attribute shared between routers.

Local preference expresses outbound policy across an AS

Higher local preference is normally preferred and the attribute is distributed within the autonomous system. That makes it a common tool for choosing the preferred exit from an enterprise or provider network.

If one ISP should be primary for outbound traffic, local preference is usually more scalable than configuring router-local weight everywhere. Communities can be used to classify routes and drive the local-preference policy.

Locally originated routes receive preference before AS_PATH comparison

Routes originated by the local router through appropriate BGP mechanisms can receive preference over learned alternatives, depending on the implementation’s decision process. This matters when troubleshooting aggregates, network statements, and redistributed routes.

The operational lesson is to identify the source of each candidate. Two routes to the same prefix may look similar in the table while entering BGP through very different mechanisms.

AS_PATH length is an important but not first criterion

A shorter AS_PATH is generally preferred after earlier policy attributes have been considered. This is why AS-path prepending can influence routing but does not override a higher local preference inside a network that deliberately prefers another path.

Engineers who assume “shortest AS path always wins” often misdiagnose routing behavior. Policy attributes can intentionally outweigh path length.

Origin and MED refine otherwise similar paths

Origin type can break ties after AS_PATH length. MED is then commonly used to communicate a preferred entry point, with lower MED favored under the relevant comparison conditions. MED behavior has nuances across implementations and neighboring autonomous systems, so engineers should confirm platform rules rather than rely on slogans.

The safe troubleshooting habit is to display both candidate paths and compare the actual values in order.

eBGP and IGP reachability matter later in the process

When earlier attributes tie, a path learned from eBGP may be preferred over an iBGP alternative. The internal cost to reach the BGP next hop can also become a deciding factor. This connects BGP policy to the IGP topology underneath it.

A change in OSPF or IS-IS can therefore change traffic even when no BGP attributes changed, because the cost to reach the next hop moved.

Tie-breakers exist so one path can be selected deterministically

Router ID, cluster-list length, neighbor address, route age, and other implementation details can appear late in the algorithm. These are useful to understand, but if an important production policy relies on a final tie-breaker, the intent is probably not explicit enough.

Networks are easier to operate when primary and backup paths differ through a deliberate policy attribute rather than an obscure final comparison.

Multipath changes forwarding without erasing best-path logic

Some designs install multiple equal or suitably equivalent BGP paths for load sharing. The platform still evaluates attributes and applies multipath eligibility rules; it does not simply forward across every received route.

When troubleshooting multipath, verify both the best-path decision and the additional-path criteria. A path can be valid but still fail the equality requirements for installation.

Inbound and outbound traffic are separate engineering problems

Local preference primarily affects how your AS chooses an exit. AS-path prepending, MED, and provider communities can influence how other networks enter, but you do not directly control another AS’s policy. This is why traffic engineering often needs different mechanisms for each direction.

A symmetric physical topology does not guarantee symmetric traffic. BGP policies on either side can produce different ingress and egress paths.

Cloud connectivity still obeys policy logic

Cloud routers, transit services, VPNs, and dedicated interconnects may hide some implementation details, but route preference still depends on advertised prefixes, attributes, service-specific priorities, and reachability. Architects need enough BGP knowledge to predict failover and avoid accidental route attraction.

Candidates working toward Amazon AWS advanced networking will encounter the same need to understand route propagation and preference even when the service interface is managed.

Troubleshoot by finding the first difference

The fastest method is to place the competing paths side by side and compare attributes in decision order. The first criterion with unequal values explains the winner. This is more reliable than changing random route maps until traffic moves.

After identifying the deciding attribute, trace where that value came from. Was it received from the neighbor, set by import policy, derived from a community, or configured locally? That step turns symptom analysis into root cause.

Policy clarity is more important than memorizing every final tie-breaker

BGP expertise grows when engineers can explain the intended policy in plain language, then show how configuration enforces it. The concepts explored in architect-level cloud networking and enterprise routing are easier to operate when each preferred path has an explicit business reason.

A route-selection algorithm is not trivia. It is the mechanism that converts business routing policy into one forwarding choice.

Policy changes should be tested on both routing and traffic

Changing a BGP attribute can produce the expected best path while still creating undesirable traffic flow because return paths, capacity, filtering, or downstream policy differ. Validation should therefore include routing state and actual application traffic.

A successful change answers two questions: did the intended route win, and did the resulting traffic behavior meet the business objective without creating a new failure mode?

Work a best-path problem like a decision tree

The most effective way to learn BGP selection is to solve small comparisons repeatedly. Start with two valid routes to the same prefix and write down every attribute that can differ. Check weight if the platform uses it, then local preference, origin of the route, AS_PATH length, origin code, MED under the applicable rules, external versus internal learning, and the later tie-breakers. Stop as soon as one attribute determines the winner.

Then change only one variable and predict the new result before looking at the router output. Raising local preference should override a shorter AS_PATH because local preference is evaluated earlier. Prepending the AS_PATH may have no effect if a higher-priority policy attribute already differs. These exercises teach the order much faster than memorizing a numbered list.

Production troubleshooting adds route policy. If the winning local preference is unexpected, find where it was set. It may come from an inbound route map, a community match, a peer template, or a platform default. The best-path output tells you what won; the policy trace tells you why that value exists.

Also verify what the routing table installed and what forwarding actually uses. Recursive next-hop resolution, equal-cost multipath, policy-based routing, or data-plane programming issues can create a gap between the BGP table and observed traffic. Best-path knowledge is necessary but not always sufficient to explain forwarding.

Finally, document the intended primary and backup path in plain language. If the configuration is so complicated that the team cannot predict a failure scenario without a lab, the routing policy may need simplification rather than another attribute tweak.

Route reflectors add another layer of reasoning in large iBGP designs. They reduce the need for a full mesh, but a reflected path is still subject to BGP policy and loop-prevention attributes such as originator information and cluster lists. When troubleshooting, engineers should distinguish between a route that was never learned, a route rejected by policy, and a route learned correctly but not selected as best.

Deterministic backup design is equally important. A network should not depend on an accidental tie-breaker to decide what happens after the preferred path fails. Primary and secondary paths should differ through an intentional policy attribute—such as local preference or an agreed external policy—so failover behavior can be predicted and tested. If the intended backup wins only because of router ID or route age, the design is fragile.