What it means
The internet is made of tens of thousands of independently run networks, each called an autonomous system (AS). BGP is how they exchange routes. A network announces the address ranges, or prefixes, it can deliver to. Neighbours pass that on, adding their own AS number to the path.
When a router hears several routes to the same prefix, it picks one by comparing attributes in a fixed order. Local policy comes first, then the length of the AS path, then finer tie-breakers. BGP was built on trust between operators. On its own it does not check that a network is entitled to announce a prefix. A mistaken or malicious announcement can pull traffic the wrong way, which is why operators add route origin validation and strict filters. A route origin authorization, or ROA, is a signed record naming the AS allowed to announce a prefix, and its longest allowed length. Route origin validation checks routes against these records.
See the idea / Networks
BGP picks one path by policy first, path length second.
Meridian has two routes to the same prefix. Watch the router compare them in a fixed order and stop at the first difference.
Meridian is AS 64512. An AS, or autonomous system, is a group of networks under one routing policy. Kestrel, AS 64510, announces the prefix 203.0.113.0/24. A prefix is a range of addresses. Meridian Core learns two routes to it. One comes through Edge North and Transit A (AS 64496) and crosses three systems. One comes through Edge South and Transit B (AS 64500) and crosses two. AS_PATH lists the systems a route has crossed. LOCAL_PREF is a preference number Meridian sets on routes it learns. It is 100 unless an operator changes it, which is a common vendor default.
01 / 04
Two routes
Both routes lead to Kestrel's prefix. The Edge South route is one AS shorter, but Meridian has set LOCAL_PREF 150 on the Edge North route.
More about this step
Meridian Core learns both routes from its own edge routers. LOCAL_PREF is set by Meridian and is never sent to another AS. An operator has set 150 on routes that arrive at Edge North, to send outbound traffic through Transit A. The Edge South route keeps 100.
Step through at your own pace.
Keep in mindThis compares two routes to the same prefix. A more specific prefix, such as a /25 inside this /24, never enters this comparison. It gets its own best path, and forwarding prefers it for the addresses it covers. BGP alone does not check who may announce a prefix; that needs route origin validation. Later tie-breakers and vendor-specific steps are not drawn. The AS numbers and the prefix are reserved for documentation or private use.
Read the visual, step by step
Set to 150
- Two routes. Both routes lead to Kestrel's prefix. The Edge South route is one AS shorter, but Meridian has set LOCAL_PREF 150 on the Edge North route. Meridian Core learns both routes from its own edge routers. LOCAL_PREF is set by Meridian and is never sent to another AS. An operator has set 150 on routes that arrive at Edge North, to send outbound traffic through Transit A. The Edge South route keeps 100.
- LOCAL_PREF. The router compares LOCAL_PREF first. Higher wins: 150 beats 100, so the Edge North route is preferred. RFC 4271 selects the route with the highest degree of preference before any tie-breaker. On routes learned inside the AS, that preference is LOCAL_PREF. This is policy: it says what Meridian wants, not which path is shorter or faster.
- AS_PATH. A check has picked a winner, so the router stops. AS_PATH length is never compared, and the shorter route loses. The Edge South route crosses two systems and the Edge North route crosses three. That would matter only if LOCAL_PREF had tied. Choose "Left at 100" to see that case.
- Install. The router installs the Edge North route as its one best path. Traffic to 203.0.113.0/24 now leaves through Transit A. Only the best path for a prefix goes into the forwarding table. The Edge South route stays known as a backup. If the Edge North route is withdrawn, the comparison runs again and Edge South wins.
Left at 100
- Two routes. Both routes lead to Kestrel's prefix. Both have LOCAL_PREF 100. The Edge South route is one AS shorter. Meridian Core learns both routes from its own edge routers. LOCAL_PREF is set by Meridian and is never sent to another AS. Here nobody has changed it, so both routes carry the same value.
- LOCAL_PREF. The router compares LOCAL_PREF first. Both routes have 100, so this check picks no winner. A tie does not end the comparison. The router keeps both candidates and moves to the next check in the fixed order.
- AS_PATH. The next check is AS_PATH length. Two systems beats three, so the Edge South route is preferred. The Edge South path is 64500 64510. The Edge North path is 64496 64505 64510. Fewer AS numbers wins. This counts systems, not distance or speed, so the winner is not always the faster path.
- Install. The router installs the Edge South route as its one best path. Traffic to 203.0.113.0/24 now leaves through Transit B. If AS_PATH had also tied, the router would go on to further checks. They are the route's ORIGIN value, then MED, a hint compared only between routes from the same neighboring AS. Then come external over internal routes, the internal cost to the next hop, and finally router identifiers. It stops at the first check that separates the routes.
This compares two routes to the same prefix. A more specific prefix, such as a /25 inside this /24, never enters this comparison. It gets its own best path, and forwarding prefers it for the addresses it covers. BGP alone does not check who may announce a prefix; that needs route origin validation. Later tie-breakers and vendor-specific steps are not drawn. The AS numbers and the prefix are reserved for documentation or private use.
Flow references: RFC 4271: BGP-4 route selection · RFC 6811: BGP prefix origin validation
AN ILLUSTRATIVE SCENARIO
A regional internet provider
A regional internet provider takes a new business customer and accepts every route that customer announces. One morning the customer misconfigures a router and announces prefixes belonging to a large video service. The provider passes them on, and for forty minutes part of the region sends that traffic into a small office link. The provider now accepts from each customer only the prefixes that customer is registered to hold, and rejects routes that fail origin validation.
Put it to work
- Publish route origin authorizations for your own prefixes, so others can tell a false announcement from yours.
- Filter what you accept from each neighbour and what you send. Deny by default and allow named prefixes.
- Monitor how the rest of the internet sees your prefixes, and alert on a new origin or a more specific announcement.
How to check your work
Look up your prefix in a public route collector and confirm the origin AS and prefix length are what you announce. In a lab, announce an unauthorized prefix and confirm your routers reject it.
Connect the ideas
- IP address
A numeric locator used to deliver packets to a host on a network.
- DNS
The lookup system that maps a name people type to an address a computer can contact.
- Availability
The property that authorized people can use a system or record when they need it.
- Integrity
The property that data and processes remain complete and unaltered except by authorized action.