Part 19 – Routing Protocols and Traffic Forwarding

Routing Protocols and Traffic Forwarding

Introduction

Welcome to Part 19 of the Network Fundamentals study notes! If you haven’t already, we recommend watching the video first.

Static routes work, but they’re time-consuming to configure, easy to get wrong, and don’t react when the network changes. In this part, we explore dynamic routing — where routers share information and adapt automatically — and cover two critical forwarding concepts: longest prefix match and administrative distance.

Why Dynamic Routing?

Imagine a network with 100 routers. Configuring static routes on every one of them is a huge amount of work. Worse, every time something changes — a new network is added, a link fails, a router is replaced — you have to manually update routes on potentially many devices. Static routes don’t react to those changes on their own.

Dynamic routing protocols solve this. You configure the protocol on each router, and the routers share route information with their neighbours automatically. Each router builds and maintains its routing table based on what it learns, and if the network changes, the routing tables update to reflect it.

Link State vs Distance Vector

Routing protocols fall into two broad categories:

  • Link state (e.g. OSPF) – each router shares detailed information about every path it knows. This information floods through the network until every router has the same complete picture. The result is that each router builds a full map of the network and can calculate the best path to every destination independently.
  • Distance vector (e.g. RIP) – routers share simpler information: a network and how far away it is. Rather than a map, think of it as signposts. A router might say “I know how to get to 10.10.10.0, and it’s two hops from me.” The receiving router learns the direction but not the full path.

Regardless of which protocol is used, each router always makes its own forwarding decisions based on its own routing table. Routers share information, but they don’t ask each other what to do with a specific packet.

Longest Prefix Match (LPM)

What happens when a packet’s destination matches more than one route in the routing table? Consider these two routes:

  • 10.1.2.0/24
  • 10.0.0.0/8

A packet destined for 10.1.2.1 matches both — it’s within the /24 subnet and also within the broader /8 range. The router needs to pick one.

The rule is: always use the most specific route — the one with the longest subnet mask. This is called Longest Prefix Match (LPM). In the example above, the /24 route wins because 24 bits is more specific than 8 bits.

This is arguably the most important concept in this video. If you take away one thing, make it LPM.

Using LPM to Your Advantage

LPM can be used deliberately. If you want to test a different path for one specific IP address without changing routing for an entire subnet, add a host route (/32) for that specific IP pointing to the alternative path. The /32 will always beat the /24 or /8 route for that one address, while everything else continues using the normal route.

To check which route a router would use for a specific destination, use: show ip route <ip-address>

Administrative Distance (AD)

What if a router learns the same route from multiple sources — say from RIP, from OSPF, and as a static route? LPM can’t help here, since all three are identical routes. The router uses Administrative Distance to decide which source to trust.

Every routing information source has an AD value. Lower AD = more trusted. Common values on Cisco devices:

  • 0 – directly connected
  • 1 – static route
  • 90 – EIGRP
  • 110 – OSPF
  • 120 – RIP

So if a router has both a static route and an OSPF route for the same destination, the static route (AD 1) wins and goes into the routing table. If the static route is removed, the OSPF route (AD 110) takes its place.

The two numbers you see in square brackets in the routing table — e.g. [1/0] — are the administrative distance and the metric. The AD is the first number. Other vendors may use different names (e.g. “route preference”) and different values, but the concept is the same.

Floating Static Routes (Revisited)

The concept of floating static routes from Part 18 makes more sense now. By configuring a backup static route with a higher-than-normal AD (e.g. 20 instead of 1), you ensure it stays hidden as long as the primary route exists. When the primary fails and is removed from the table, the floating static route’s AD is now the lowest available, so it steps in. You can verify backup routes are active by checking the AD shown in the routing table — backups will show their configured higher AD rather than the usual 1.

Resources

Test your knowledge with the Introduction to Networking quizzes.