4.3.17 · D1Computer Networks

Foundations — BGP — path vector, AS, policy routing

1,996 words9 min readBack to topic

Before you can read a single BGP advertisement you must own a small toolkit of ideas. We build each one from nothing — plain words, then a picture, then why the topic needs it. Nothing later uses a thing that came earlier only as a name.


1. An IP address — a house number for a machine

Picture it as a single dot on an enormous map of all machines. On its own it is just one house.

Why the topic needs it: BGP never talks about single houses — that would be billions of entries. It talks about streets (the next idea). But you must know the house exists first.


2. A prefix / CIDR block — a whole street of addresses

The slash-number is called the prefix length: bigger number → fewer fixed-free bits → smaller block.

Figure — BGP — path vector, AS, policy routing

Look at the figure: the whole address space is the board; a prefix is a boxed rectangle covering one contiguous run of houses. /24 boxes 256 houses; /25 boxes half that.

Related reading: IP addressing and CIDR prefixes.

Why the topic needs it: every BGP message is about a prefix. When you later see "advertises who can reach which prefix", this is that prefix.


3. An Autonomous System (AS) — one owner's whole neighbourhood

Picture it as a walled district on the map: inside, one owner decides everything (which internal protocol, which links). Outside, it is a single labelled blob.

Figure — BGP — path vector, AS, policy routing

In the figure each coloured blob is one AS; the number on it is its ASN; the small boxes inside are the prefixes it owns.

Related reading: Autonomous Systems and ASN allocation.

Why the topic needs it: BGP is the protocol between ASes. The AS is the atom of the whole story — every path is a list of these blobs.


4. eBGP vs iBGP — talking outside vs inside the wall

Picture it: eBGP is a handshake over the wall between two districts; iBGP is a group chat inside one district so everyone hears news that arrived at one gate.

Why the topic needs it: the loop rule and the "prepend your ASN" step happen on eBGP (crossing walls). Inside an AS, iBGP moves the news without changing the AS path. Keeping the two straight prevents confusion later.


5. An attribute — a labelled sticky-note on a route

Picture it as a route being an envelope, with coloured sticky-notes on it: one lists the districts it visited, one is my personal ranking score.

Why the topic needs it: every rule in the parent note ("highest LOCAL_PREF", "shortest AS_PATH") is really "compare this sticky-note across the competing envelopes". You must know an envelope has notes before you compare them.


6. The AS_PATH — the trail of breadcrumbs

The square brackets just mean "an ordered list". The symbol is "the AS whose number is 2". The whole thing is a trail.

Figure — BGP — path vector, AS, policy routing

Follow the arrows in the figure: the prefix starts at the far-right blob and each AS that forwards it writes its own number on the front (the left end). So the list grows leftward as the news travels.

Why the topic needs it: this list is the heart of "path vector". Loop prevention, hop-count tie-breaking, and valley-free policy all read this one attribute.


7. The set-membership symbols and

Picture it: you scan the breadcrumb trail with your finger; if you spot your own number, that's .

Why the topic needs it: the entire loop rule is one line — . The symbol means if and only if: accept exactly when you are not already in the path — no other condition.


8. Business relationships — the reason paths aren't shortest

Picture it as arrows of money: down to a customer (money flows up to you), up to a provider (money flows up from you), sideways to a peer (no money).

Figure — BGP — path vector, AS, policy routing

In the figure the vertical arrows are provider/customer links and the flat arrow is a peer link. A valley-free path climbs up these arrows, takes at most one flat step, then climbs down — it never dips back up after coming down.

Related reading: Internet topology — Tier-1, transit, peering and Hot-potato vs Cold-potato routing.

Why the topic needs it: these relationships set the LOCAL_PREF sticky-note (customer > peer > provider) and the Gao–Rexford export rules. Without them BGP would just be shortest-path — the money is why it isn't.


9. LOCAL_PREF and the tie-break ladder — how one route wins

Why the topic needs it: BGP picks the winning route down a ladder of comparisons — LOCAL_PREF first, AS_PATH length only second. This is why "BGP = shortest path" is wrong: policy sits above distance. You will see this ladder in full in the parent note; here you just need to know the top rung is money, not hops.


How it all feeds the topic

IP address one machine

Prefix a block of addresses

Autonomous System one owner

ASN unique number

AS_PATH list of ASes

Membership test in or not in

Loop prevention

eBGP across the wall

iBGP inside the wall

Prepend own ASN

Business relationships

LOCAL_PREF policy score

BGP path vector plus policy

Read top-to-bottom: addresses group into prefixes, prefixes live inside ASes, ASes are numbered, numbers form paths, paths enable loop-detection, relationships set policy — and both loop-freedom and policy meet in BGP.


Equipment checklist

An IP address identifies what?
One network interface (one machine) on the internet.
What does 200.0.0.0/24 mean?
The 256 addresses whose first 24 bits are fixed at 200.0.0; a prefix (CIDR block).
Bigger prefix-length number means a bigger or smaller block?
Smaller block (more bits fixed, fewer free).
What is an AS?
A set of prefixes under one administrative/routing policy, identified by a unique ASN.
Is an AS one router?
No — it can be thousands of routers; it is one policy domain.
eBGP vs iBGP?
eBGP runs between different ASes (across the wall); iBGP runs inside one AS.
What is an attribute?
An extra labelled field carried with a route, e.g. AS_PATH or LOCAL_PREF.
What does AS_PATH hold and which way do you read it?
The ordered list of ASes traversed; read right-to-left from the origin AS.
What does mean?
The ASN appears somewhere in the path list .
What does prepend () do?
Sticks my own ASN on the front of the path before re-advertising.
Why a list instead of a single cost number?
A list lets a router detect loops directly and avoids count-to-infinity.
Name the three neighbour relationships.
Provider (you pay), Customer (they pay), Peer (free swap).
What is LOCAL_PREF and what sits above AS_PATH length?
A policy preference score; LOCAL_PREF is compared before AS_PATH length.