Routing Tables Explained
# CHAPTER 3
Routing Tables Explained
1. Introduction
In the previous chapters, we referred to the router's internal database as a "Signpost." In professional networking, this signpost is called a Routing Table. The Routing Table is the absolute brain of the router. If a destination is not listed in the Routing Table, the router will drop the packet into the void. To troubleshoot network outages, an engineer must know how to read and interpret this table perfectly. In this chapter, we will dissect the anatomy of a Routing Table, understanding how Destination Networks, Next-Hop IPs, Metrics, and Administrative Distance dictate the flow of global data.2. Learning Objectives
By the end of this chapter, you will be able to:- Identify the core columns and structure of a standard Routing Table.
- Explain how a router matches a packet's Destination IP to a Route entry.
- Understand the role of the "Next-Hop" IP address vs an "Exit Interface".
- Define Routing Metrics (Cost) and how they influence path selection.
- Explain the concept of Administrative Distance (Trustworthiness).
3. Anatomy of a Routing Table
If you log into a Cisco router and type the command to view the table, you will see a list of rules. Every rule (Route) contains four critical pieces of information:-
1.
Destination Network: Where is the traffic trying to go? (e.g.,
10.5.0.0/24).
-
2.
Next-Hop / Interface: How do I get there? (e.g., Hand it to IP
192.168.1.2, or push it outGigabitEthernet0/1).
- 3. Metric (Cost): How "expensive" or slow is this path? (Lower is better).
- 4. Administrative Distance (AD): How "trustworthy" is the source that told me about this path? (Lower is better).
4. The Matching Process (Longest Prefix Match)
When a packet arrives destined for10.5.0.50, the router scans the table.
What if the table has *two* matching rules?
-
Rule 1: Send
10.0.0.0/8out Port 1.
-
Rule 2: Send
10.5.0.0/24out Port 2.
*The Router's Golden Rule:* Longest Prefix Match.
The router will *always* choose the most specific, precise rule. Because /24 is a smaller, more specific network than the massive /8 network, the router will choose Rule 2 and send the packet out Port 2.
5. Understanding Metrics (Cost)
What if the router has two completely valid paths to Tokyo that are equally specific?- Path A: Goes through a high-speed Fiber Optic cable.
- Path B: Goes through a slow, older DSL cable.
The routing protocol assigns a Metric (a mathematical cost) to each path. The slow DSL cable might have a metric of 100, while the fast Fiber cable has a metric of 10. The router compares the metrics and always chooses the path with the lowest cost.
6. Administrative Distance (Trust)
What if the router receives instructions from two different routing protocols?- A human engineer typed a manual static rule: "Go left."
- An automated dynamic protocol (OSPF) says: "Go right."
The router uses Administrative Distance (AD) to decide who to trust. It is a ranking system of believability.
-
Connected Interface AD:
0(Absolute trust)
-
Static Route AD:
1(Extremely high trust)
-
OSPF Protocol AD:
110(Medium trust)
1) is more trustworthy than OSPF (110), the router obeys the human and goes left, completely ignoring the OSPF rule.
7. Command Examples
Let's look at a conceptual, simplified routing table output:- Line 1: A directly connected local network.
-
Line 2: A remote network reachable by handing the packet to router
192.168.1.5.
-
Line 3: The Default Route (
0.0.0.0/0). The "catch-all" for internet traffic.
8. Best Practices
- Keeping Tables Small: A massive internet backbone router might have 1,000,000 routes in its table. Searching a list that long takes CPU time and slows down the network. Network engineers use "Route Summarization" to compress 100 small rules into 1 large rule, keeping the Routing Table small, efficient, and fast.
9. Common Mistakes
- The Missing Return Route: A junior engineer configures Router A with a path to Router B. The packet successfully reaches Router B. But Router B's table does *not* have a path back to Router A! The packet reaches the destination, but the reply is dropped into the void. Routing is a two-way street; tables on both ends must be configured.
10. Mini Project: Read a Local Routing Table
Even your personal computer has a routing table!- 1. Open Terminal or Command Prompt.
-
2.
Windows: run
route print| Mac/Linux: runnetstat -nr
-
3.
Look for the
0.0.0.0destination. Look at the "Gateway" column next to it.
- 4. You are reading your OS's actual routing table, which tells your laptop to send all unknown internet traffic to your home router's IP!
11. Practice Exercises
-
1.
A router's table has a route for
192.168.0.0/16out Port 1, and a route for192.168.5.0/24out Port 2. If a packet arrives destined for192.168.5.50, which port will it exit, and why?
- 2. Explain the difference between a Route Metric and Administrative Distance.
12. MCQs with Answers
When a router evaluates its routing table, what is the primary rule it uses to select between two overlapping network destinations?
Which value determines the "trustworthiness" of the source that provided the routing information (e.g., Static vs OSPF)?
13. Interview Questions
- Q: Explain the Longest Prefix Match rule. Why is it necessary in modern IP routing?
- Q: Walk me through the hierarchy of decision-making a router uses when choosing a path (Prefix length vs AD vs Metric).
- Q: What is the Administrative Distance of a standard Static Route, and why is it preferred over a dynamically learned route?
14. FAQs
Q: What happens if a packet arrives and matches absolutely nothing in the routing table? A: The router instantly drops (deletes) the packet. A router will never guess where to send data. If it doesn't have an explicit rule, or a catch-all Default Route (0.0.0.0/0), the packet is destroyed.