Differences

Compared

OSPF vs BGP

OSPF routes inside one organisation: every router holds the same map and computes the shortest path by link cost. BGP routes between organisations, the autonomous systems of the internet: each announces its networks, and the path through the fewest systems wins unless policy says otherwise.

Side by side

OSPFBGP
Runs Inside one autonomous systemBetween autonomous systems
Kind Link state: every router holds the same map and runs Dijkstra on itPath vector: each announcement carries the list of systems it crossed (the AS path)
Best path Lowest total link costLocal preference first, then the shortest AS path; link speed plays no part
Neighbours Found by Hello packets on a shared linkConfigured by hand
Carried in Its own IP protocol, number 89A TCP connection to port 179
After a failure Every router recomputes within secondsA silent peer is dropped after the hold time, and its routes withdrawn

Each one explained

OSPF
A routing protocol inside one organisation: routers share a map and compute shortest paths.
BGP
The protocol between autonomous systems: how the networks of the internet find each other.
Autonomous system
A network run by one organisation, with a number of its own, as seen by the rest of the internet.
AS path
The list of autonomous systems a BGP route crossed: used to choose paths and to prevent loops.
Local preference
A BGP value an AS sets on routes it receives to choose its own way out, checked before the AS path.

See the difference on real machines

Each lab is a small network of real Linux machines in your browser.

Open OSPF routing: every router holds the same map

Sources

Learn it on real machines.

Every lab is a small network of real Linux machines in your browser. Sign in with Google or email to start.

Start this lab