Overview
Getting a packet from one network to another across the internet is the job of routing. Routers make forwarding decisions using a routing table — a set of rules mapping destinations to next hops. This lesson explains what routes are and how a router uses them.
Learning objectives
- Define routing and the routing table.
- Explain how a router chooses a route (longest-prefix match).
- Describe the concept of a next hop.
Core concept
Routing is the process of moving packets between networks. Each router holds a routing table: a list of routes, where each route says "for this destination network, send the packet to this next hop (or out this interface)." Destinations are expressed as network prefixes in CIDR (e.g. 10.0.0.0/8).
When a packet arrives, the router looks up its destination IP in the table and forwards it toward the matching next hop, hop by hop, until it reaches the destination network.
How it works
A destination may match several routes of different specificity, so routers use longest-prefix match: the route with the most specific (longest) matching prefix wins. For example, a packet to 10.1.2.3 matching both 10.0.0.0/8 and 10.1.0.0/16 is sent via the /16 route because it is more specific. The router does not need to know the full path — only the next hop. Each subsequent router repeats the lookup, collectively delivering the packet across many networks.
Practical example
A router's table might contain:
| Destination | Next hop |
|---|---|
| 192.168.1.0/24 | directly connected |
| 10.0.0.0/8 | 203.0.113.1 |
| 0.0.0.0/0 | 203.0.113.254 (default) |
A packet to 10.5.6.7 matches 10.0.0.0/8 → forwarded to 203.0.113.1. A packet to some unrelated internet address matches only the default route → sent to 203.0.113.254. The most specific matching route is always chosen.
Cybersecurity relevance
Routing shapes what is reachable from where, which is a security concern. Misconfigured or overly permissive routes can expose networks that should be isolated. Segmentation depends on controlling routes between zones. At internet scale, route hijacking (advertising false routes) can divert traffic — a serious attack class. Understanding routing helps analysts reason about traffic paths, reachability, and where interception could occur.
Common mistakes
- Assuming a router knows the whole path — it only knows the next hop.
- Ignoring longest-prefix match — a more specific route overrides a general one.
- Overlooking the default route, which handles everything not otherwise matched.
Key takeaways
- Routing moves packets between networks using routers and their routing tables.
- Each route maps a destination prefix to a next hop; routers forward hop by hop, needing only the next hop.
- Longest-prefix match selects the most specific route; a default route (
0.0.0.0/0) catches the rest.
Check your understanding
- If a destination matches both a
/8and a/16route, which is used and why? - What does a router actually need to know to forward a packet — the full path or just the next hop?

