BGP chooses permitted paths under administrative policy
Reason about autonomous systems, path attributes, import/export policy, and why a preferred BGP route need not minimize hops or geographic distance.
On this page
The question for today
What you’ll understand
- Describe BGP reachability advertisements and AS-path loop detection.
- Apply an explicitly stated preference policy to eligible paths.
- Separate BGP path selection, forwarding specificity, and service quality.
The Internet connects networks operated by different organizations with different agreements and constraints. BGP exchanges reachability and path attributes across these administrative boundaries. Its job is not to find a universally best physical path. Each network applies policies that determine which routes it accepts, prefers, and exports. A route can be attractive under that policy while having more AS hops or higher latency. To explain an observed path, ask what the operator permitted and valued before asking why the map looks indirect.
An AS path is useful evidence with limits
An autonomous system is a routing domain identified by an AS number. BGP advertisements associate destination prefixes with attributes, including an AS path that records inter-AS traversal in the protocol's representation. A receiving AS can reject a route containing its own AS number to prevent ordinary interdomain path loops. The attribute is not a list of every router or fiber segment. It therefore cannot directly provide physical distance, latency, or the internal path across another network.
BGP distinguishes routes learned across external peers from their distribution inside an AS. Next-hop reachability still depends on local routing and forwarding resolution. A session can remain established while a particular advertised route is unusable or rejected; a route can also be present in received data but absent from the installed forwarding table. Separate session health, received advertisements, policy acceptance, selected routes, and actual packet forwarding when gathering evidence. Each stage answers a different operational question.
Preference is not a single universal scalar
An operator may prefer one relationship or exit over another using local policy, including LOCAL_PREF inside an AS. For a worked comparison, explicitly state the ordering: first require acceptance and reachable next hops, then prefer higher local preference, then shorter AS path among the remaining ties. This is a deliberately partial policy for the example. Full BGP selection has further rules and contextual comparisons; implementation-specific controls can add decisions, so do not memorize this partial ordering as a universal vendor decision tree.
A higher local preference can intentionally select a longer AS path. MED has a narrower comparison context and should not be treated as a globally comparable Internet distance. Import and export policy also shape which alternatives ever appear: an absent route cannot win the selection process. Validate the exact prefix and peer, then inspect policy actions and attributes. Changing an attribute without understanding commercial and reachability constraints can move traffic unexpectedly or advertise a path to parties that should not receive it.
Policy success and application success differ
Selection applies to candidate paths for a prefix. Packet forwarding still chooses the longest matching installed prefix, so a more-specific advertisement can draw traffic away from a preferred aggregate. Outbound and inbound paths may differ because other networks apply their own policies. Observing a local egress change does not establish how replies return. Check both directions, the route granularity, and the forwarding installation before attributing an application latency change to one BGP attribute.
Use the queue lab to examine a consequence of concentrating traffic on a preferred exit. Interpret λ and μ as offered and served packet work in a normalized fluid model. Compare load cases as separate fresh runs: press Reset, set both desired rates, predict whether backlog grows, then Play or Step. The lab does not exchange BGP messages, select routes, or model actual packet buffers. Its separate M/M/1 residence-time readout requires stationary Poisson arrivals and exponential service with λ below μ, assumptions not established by the fluid drawing. Policy validity alone supplies none of those capacity guarantees.
Work it through
Explain a longer selected path
For the same prefix, accepted route A has LOCAL_PREF 180 and AS-path length four; accepted route B has LOCAL_PREF 120 and AS-path length two. Both next hops are reachable. Use the stated higher-preference-before-shorter-path policy.
Confirm that both candidates refer to the same prefix and pass acceptance and next-hop checks. If one were a more-specific prefix, this comparison would not replace longest-prefix forwarding.
Compare local preference first: 180 exceeds 120, so A wins without using AS-path length as the deciding tie-breaker. The difference of sixty is a configured preference difference, not sixty milliseconds.
Record that A's selected path has four AS entries despite B's two. Measure end-to-end behavior separately; the route choice is explained by the stated policy, while latency and return routing remain unproven.
Route A is selected under the example's policy. B's shorter AS path neither overrides local preference nor proves that B would have lower latency.
The living notebook
Explore the model
Interactive lab · queue
A preferred exit still needs capacity
For each fresh exit-load comparison, press Reset, set both arrival λ and service μ, predict whether the four-item initial backlog grows, then Play or Step. No BGP attributes, prefix advertisements, packet buffers, or routing decisions are simulated.
- Fluid backlog
- 4
- Net rate · λ − μ
- −1 /s
- M/M/1 mean residence
- 1 s
Fluid backlog starts at 4 and follows max(0, 4 + (λ − μ)t). The separate M/M/1 residence-time formula assumes Poisson arrivals, exponential service and λ < μ. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.
Look forRouting policy can concentrate load; it does not by itself establish adequate capacity or acceptable application latency.
Pause & reason
Check your understanding
Your turn
Try it yourself
Under the same partial policy, accepted route C has local preference 150 and AS length three; D has local preference 150 and AS length five. Which wins, and what cannot you conclude about latency?
Take a moment to make a prediction or work it out on paper. Open a hint when you need one.
Give me a hint
The first preference comparison ties. Apply the next stated comparison, then distinguish an AS count from elapsed time.
Compare with the solution
C wins the example's tie-break because three is shorter than five after equal local preference. You cannot conclude that C has fewer physical router hops, a shorter fiber path, or lower round-trip latency. Measure those properties and inspect return routing separately. Additional real selection rules matter if the stated criteria still tie or if the candidates are ineligible under actual policy.
Keep the idea
Take it with you
- BGP communicates prefix reachability and attributes across administrative boundaries.
- Accepted routes are selected under policy rather than a global geographic objective.
- Route preference, prefix specificity, forwarding installation, and service quality are separate layers.
Read further
Original sources and deeper explanations to follow at your own pace.
Optional progress, saved in this browser when available. Revisit any lesson at any time.
Lesson not marked complete.