📘 CCNA 200-301 v1.1
3.1 Interpret the components of routing table
3.1.b Prefix – Understanding the Prefix in a Routing Table
1. What is a Routing Table? (Quick Review)
A routing table is a list that routers use to decide where to send packets.
It contains routes — information about destination networks and how to reach them.
Each route entry (line) in the routing table includes:
- Prefix (network address and mask)
- Next-hop IP address
- Outgoing interface
- Administrative distance
- Metric
- Route source (e.g., static, OSPF, EIGRP, etc.)
Now, let’s focus on the Prefix part.
2. What is a Prefix?
A prefix represents the destination network that the route entry applies to.
It includes:
- The network address
- The subnet mask (in CIDR format)
Example:
192.168.10.0/24
Here, 192.168.10.0 is the network address,
and /24 is the prefix length (also known as subnet mask).
3. Prefix Length (/n)
The prefix length defines how many bits of the IP address represent the network portion.
For example:
| Prefix | Network Bits | Host Bits | Subnet Mask |
|---|---|---|---|
| /8 | 8 | 24 | 255.0.0.0 |
| /16 | 16 | 16 | 255.255.0.0 |
| /24 | 24 | 8 | 255.255.255.0 |
| /30 | 30 | 2 | 255.255.255.252 |
- The larger the prefix number, the smaller the network (fewer hosts per subnet).
- The smaller the prefix number, the larger the network (more hosts).
4. Why the Prefix is Important in Routing
When a router receives a packet, it:
- Looks at the destination IP address in the packet.
- Compares that address against the prefixes in the routing table.
- Chooses the best match (the most specific prefix) to forward the packet.
This process is called Longest Prefix Match (LPM).
5. Longest Prefix Match (LPM)
The longest prefix match rule means that the router selects the route that matches the most bits of the destination IP address.
Let’s see an example of how routers choose routes based on prefix length.
Example Routing Table Entries:
| Destination Prefix | Next Hop | Interface |
|---|---|---|
| 192.168.0.0/16 | 10.1.1.1 | G0/0 |
| 192.168.10.0/24 | 10.1.1.2 | G0/1 |
| 192.168.10.128/25 | 10.1.1.3 | G0/2 |
Packet Destination: 192.168.10.130
Now the router checks:
- Does
192.168.10.130match 192.168.0.0/16? ✅ Yes - Does it match 192.168.10.0/24? ✅ Yes
- Does it match 192.168.10.128/25? ✅ Yes
All match, but the most specific match (longest prefix) is /25.
So the router will choose the route 192.168.10.128/25.
✅ Final route chosen: 192.168.10.128/25 (next hop 10.1.1.3)
That’s why the prefix is so important — it decides which route is the most precise match.
6. Prefix in IPv6 Routing Tables
The same concept applies in IPv6.
Example IPv6 route:
2001:db8:abcd:1::/64
Here:
2001:db8:abcd:1::is the network address./64means the first 64 bits are the network portion.
Routers again use longest prefix match to find the best IPv6 route.
7. How Prefix Appears in Cisco IOS (Show Command)
When you check routing tables using:
show ip route
You will see prefixes for each route entry.
Example output:
R1# show ip route
Codes: C - connected, S - static, R - RIP, O - OSPF, D - EIGRP
C 192.168.10.0/24 is directly connected, GigabitEthernet0/0
S 10.0.0.0/8 [1/0] via 192.168.10.1
O 172.16.0.0/16 [110/2] via 192.168.10.2, 00:00:22, GigabitEthernet0/1
Explanation:
192.168.10.0/24→ Prefix for the directly connected network10.0.0.0/8→ Prefix for a static route172.16.0.0/16→ Prefix learned via OSPF
Every prefix tells which network this router knows how to reach.
8. Summary Table
| Concept | Description |
|---|---|
| Prefix | The destination network (network address + prefix length) |
| Prefix Length (/n) | Number of bits used for the network portion |
| Purpose | Identifies which network a route belongs to |
| Used In | IPv4 and IPv6 routing tables |
| Selection Rule | Router uses Longest Prefix Match to select best route |
9. Key Points for the CCNA Exam
- Prefix = network + prefix length (e.g., 10.0.0.0/8)
- Longer prefix = smaller network (more specific)
- Shorter prefix = larger network (less specific)
- Router uses Longest Prefix Match rule to select routes
- Both IPv4 and IPv6 use prefixes in the same way
- “
show ip route” and “show ipv6 route” display prefixes in the routing table
✅ Exam Tip:
If multiple routes match a destination, the route with the longest prefix length (most bits in network portion) wins — even if it has a higher administrative distance or metric.
