You can type routes into a router by hand. That works for a few networks, but not for hundreds, and not when links fail in the middle of the night. A routing protocol lets routers tell each other what they can reach and update their tables by themselves.
Static and dynamic routes
A static route is configured by an administrator. It is simple and predictable, but it does not find a new path on its own. A dynamic route is learned from a routing protocol and can change when the network changes.
Inside and between organisations
An autonomous system (AS) is a set of networks run under one routing policy, such as an internet provider or a large company.
- An interior gateway protocol (IGP) routes inside an AS. Examples are RIP, OSPF and IS-IS.
- An exterior gateway protocol routes between them. The one used on the internet is BGP.
Three styles
- Distance vector (RIP): each router tells its neighbours how far away each network is.
- Link state (OSPF, IS-IS): each router describes its own links, and every router builds a map.
- Path vector (BGP): each route carries the list of autonomous systems it passed through.
Cisco's EIGRP is often described as an advanced distance vector protocol.
When all routers again agree on working paths after a change, the network has converged. Faster convergence means shorter outages.
Seeing them on Linux
The kernel forwards packets, but it does not speak these protocols itself. A routing daemon does that and installs the results into the kernel table. FRRouting (FRR) and BIRD are common open source choices.
The proto field of ip route shows where a route came from:
$ ip route
default via 192.0.2.1 dev eth0 proto static
10.20.0.0/16 via 192.0.2.2 dev eth0 proto ospf metric 20
192.0.2.0/24 dev eth0 proto kernel scope link src 192.0.2.10How a name appears depends on the daemon and the version, so you may see slightly different labels.
If one router learns the same prefix from two protocols, it needs a way to choose. Cisco calls this ranking administrative distance, and other vendors use names such as route preference. Lower values win. This comes after longest prefix match has already separated routes of different lengths.
For a refresher on prefixes, see the subnetting guide.
Try it
Run ip route and note the proto value on each line. Which routes did the kernel add, and which came from DHCP or from you? On a typical laptop you will find no routing protocol at all, because one default gateway is enough.
Check your understanding
Routing Protocols
All 4 sections ยท no timer
Unlimited retries
Questions from every section are combined into one assessment. Answer them all correctly to complete the article.
Your completion saves in this browser. Sign in to sync it to your account.