0Pricing
Network+ Academy · Lesson

Inside the Routing Table

Read the entries a router uses to choose the next hop.

Inside the Routing Table is a free Network+ Academy lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Network+ Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

How Routers Decide

A router job is to forward each packet toward its destination. To do this it consults a routing table, a list of known networks and how to reach them. Every packet that arrives is checked against this table to choose the next step. This lesson opens the routing table and explains the entries a router uses to make forwarding decisions.

What an Entry Contains

Each routing table entry maps a destination network to a next hop and an outgoing interface. The destination is written as a network and prefix, like 10.0.0.0/8. The next hop is the address of the next router on the path, and the interface is the port to send through. Some entries also list a metric and the route source.

Destination       Next Hop      Interface   Metric
0.0.0.0/0         203.0.113.1   eth0        1
192.168.1.0/24    connected     eth1        0
10.0.0.0/8        10.1.1.2      eth2        20

Directly Connected Routes

The simplest entries are connected routes. When you give a router interface an address on a network, the router automatically knows that network is directly attached. No next hop is needed; the router delivers locally out that interface. Connected routes are always trusted because the router can see the network on its own port.

The Next Hop

For networks not directly attached, the entry names a next hop, the IP of the neighboring router that is one step closer to the destination. The router does not need to know the full path, only the next router to hand the packet to. Each router along the way repeats this, forwarding hop by hop until the packet reaches its destination network.

Longest Prefix Match

A packet destination might match several entries. The router uses longest prefix match: it chooses the most specific route, the one with the longest matching prefix. For example, a packet to 10.1.1.5 matching both 10.0.0.0/8 and 10.1.1.0/24 follows the /24, since it is more specific. The default route 0.0.0.0/0 is the least specific and matches only when nothing else does.

The Metric

If two routes to the same network exist within one routing method, the router prefers the one with the lower metric. A metric measures how good a path is, such as hop count or a cost based on bandwidth. Lower means better. The metric helps the router pick the most efficient route among equally specific options.

Administrative Distance

When routes to the same network come from different sources, the router uses administrative distance (AD) to decide which to trust. AD ranks route sources: connected and static routes are trusted over learned ones. For example, a static route (low AD) is preferred over an OSPF-learned route to the same network. AD picks the source; metric breaks ties within a source.

The Default Route

The entry 0.0.0.0/0 is the default route, the catch-all used when no more specific entry matches. On edge routers it usually points toward the internet provider. Without a default route, a router drops packets to unknown networks. With one, anything unfamiliar is simply forwarded out toward the wider internet, which is exactly what small networks want.

Reading a Real Table

You view a routing table with a command like show ip route on a router or the route print or ip route tools on hosts. Letters often flag each entry source: C for connected, S for static, O for OSPF, and so on. Learning to read this output is a vital skill, it tells you exactly how a router will forward any given packet.

show ip route
  C    192.168.1.0/24 is directly connected, eth1
  S    172.16.0.0/16 [1/0] via 192.168.1.2
  O    10.0.0.0/8 [110/20] via 10.1.1.2

Route Sources at a Glance

Each table entry comes from a source. Connected routes are networks on the router own interfaces. Static routes are entered by an administrator. Dynamic routes (like those from OSPF) are learned automatically from a routing protocol. The router shows the source with a code letter and uses it, via administrative distance, to decide which to trust when sources overlap. Knowing the source explains why a particular route is in the table.

Why It Matters

The routing table is the brain of forwarding. Each entry pairs a destination network with a next hop and interface. The router applies longest prefix match to pick the most specific route, uses administrative distance to choose among sources, and metric to break ties. Understanding these rules lets you predict and troubleshoot exactly how traffic flows, a core Network+ skill.

Quick Check

Test your routing table knowledge.

Recap

A routing table maps each destination network to a next hop and interface. Connected routes are directly attached networks. Routers pick paths by longest prefix match (most specific wins), use administrative distance to choose among route sources, and metric to break ties within a source. The default route 0.0.0.0/0 catches anything unmatched. Reading the table shows exactly how a router forwards each packet.

Frequently asked questions

Is the “Inside the Routing Table” lesson free?

Yes — the full text of “Inside the Routing Table” is free to read here on the web, and the Network+ Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Network+ Academy course, upgrade to CoddyKit PRO.

What will I learn in “Inside the Routing Table”?

Read the entries a router uses to choose the next hop. You practise Network+ Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Network+ Academy?

No prior experience is required. Network+ Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Inside the Routing Table” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Network+ Academy lesson?

Yes. Every Network+ Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. The Default Gateway's Job
  2. Inside the Routing Table
  3. Static vs Dynamic Routing
  4. Meeting RIP, OSPF, and BGP
← Back to Network+ Academy