Vol. I · No. 46The protocol sectionSat, 10 Oct 2026
Layer 7 control · Routing · the internet’s master map

BGP

Border Gateway Protocol

BGP is how the internet agrees where things are. The net is tens of thousands of independent networks — autonomous systems — and BGP is the language they use to advertise which addresses they can reach and along what path. Every route between networks you’ve ever used was chosen by BGP.

BGP lets independent networks advertise the address blocks they reach and pick paths by policy, not just distance.

Kind
Path-vector
carries the AS path
Port
179
TCP
Scope
Between AS
the exterior gateway
Chooses by
Policy
business, not hops

How it works

A prefix propagates outward, each AS prepending itself
AS 64500
owns 203.0.113.0/24
path: 64500
AS 64510
transit provider
path: 64510 64500
AS 64520
your ISP
path: 64520 64510 64500
Announce

The origin AS tells its neighbours “I own this prefix.”

Prepend & pass on

Each AS adds its own number, then re-advertises — the path grows.

Detect loops

See your own AS in the path? Reject it — that’s how loops are avoided.

Every router ends up knowing not just that a prefix is reachable but the full list of networks to cross — and picks among competing paths by local policy first, shortest AS-path only after.

The main points

What BGP does, step by step

1
Peer over TCP

Two routers open a TCP 179 session and become neighbours — eBGP between AS, iBGP within one.

2
Exchange prefixes

Each peer advertises the address blocks it can reach, with the AS-path and other attributes attached.

3
Apply policy

Local preference, AS-path length and MED decide the best route — often about money, not distance.

4
Announce incrementally

Only changes are sent after the initial dump; withdrawals pull a prefix back when a link dies.

Path attributes that decide the winner
Local Pref — preferred exit, checked first
AS-Path — shorter usually wins
MED — a hint to a neighbour AS
Next-Hop — where to actually send it
Communities — tags that trigger policy
Origin — how the prefix entered BGP

In cybersecurity

BGP runs on trust between operators — it believes what peers announce — so a bad or forged advertisement can redirect a chunk of the internet.

Prefix hijacking

An AS announces a block it doesn’t own; traffic to those addresses is drawn to the wrong network.

Route leaks

Re-advertising routes you shouldn’t sends traffic down a path never meant to carry it — often by accident.

RPKI & ROV

Signed records say which AS may originate a prefix; origin validation drops announcements that disagree.

Traffic interception

A subtle hijack passes traffic through, inspects it, then forwards on — hard to notice from the endpoints.

Max-prefix & filters

Prefix limits and strict inbound filters contain a peer that suddenly floods bad or excessive routes.

Session hardening

TCP-AO/MD5 and TTL security stop an outsider from spoofing or resetting the peering itself.

Rides in the stack

IPTCPBGP

It rides on TCP 179 for a reliable, ordered session — peers stay up for months, exchanging only changes.

Works with

OSPFIPv4

See it on Linux

ip routetraceroute

Sessions & messages

Peering
eBGPbetween AS
iBGPwithin AS
Transitvs peer
Messages
OPENstart
UPDATEroutes
KEEPALIVEalive
NOTIFICATIONerror