Viewing the IP Routing Table – Understanding Network Paths
1. What Is the Routing Table?
The routing table (also called the Routing Information Base or RIB) is a database maintained by every router and Layer 3 switch that lists all known network destinations and the best path to reach each one. When a packet arrives, the router performs a longest-prefix match lookup in this table to determine the correct forwarding decision.
Viewing the routing table is one of the most fundamental troubleshooting and verification tasks in networking — it tells you exactly how a device will forward any given packet.
Packet arrives (Dest: 10.0.0.50)
|
v
Router checks routing table:
- 10.0.0.0/8 via 192.168.1.2 (match, /8)
- 10.0.0.0/24 via 192.168.2.1 (match, /24 -- more specific, wins!)
- 0.0.0.0/0 via 203.0.113.1 (default, last resort)
|
v
Forward via 192.168.2.1 (longest prefix match wins)
Related pages: show ip route | show ip protocols | show ip interface brief | Static Routing Configuration | Default Routes | Floating Static Routes | Route Summarization | OSPF Configuration | OSPF Overview | EIGRP Overview | RIP Concepts | BGP Overview | Administrative Distance | Metric | Traceroute | ping
2. Commands to View the Routing Table
Router# show ip route ! Full IPv4 routing table
Router# show ipv6 route ! Full IPv6 routing table
Router# show ip route 10.0.0.0 ! Detail for a specific network
Router# show ip route ospf ! Only OSPF-learned routes
Router# show ip route static ! Only static routes
Router# show ip route connected ! Only directly connected networks
Router# show ip route | include 192.168 ! Filter output by string
Router# show ip route | begin Gateway ! Start display from "Gateway" line
Router# show ip route summary ! Route count by protocol
3. Reading Routing Table Entries — Full Example
Router# show ip route
Codes: C - connected, S - static, O - OSPF, D - EIGRP, R - RIP,
B - BGP, i - IS-IS, * - candidate default, L - local
Gateway of last resort is 192.168.1.1 to network 0.0.0.0
C 192.168.10.0/24 is directly connected, GigabitEthernet0/1
L 192.168.10.1/32 is directly connected, GigabitEthernet0/1
O 10.0.0.0/24 [110/20] via 192.168.1.2, 00:00:12, GigabitEthernet0/2
D 172.16.0.0/16 [90/156160] via 192.168.2.1, 01:14:32, GigabitEthernet0/3
R 192.168.50.0/24 [120/5] via 192.168.1.5, 00:00:21, Serial0/0/0
S* 0.0.0.0/0 [1/0] via 192.168.1.1
| Field | Example Value | Meaning |
|---|---|---|
| Route code | O | How the route was learned (see Section 4) |
| Destination network | 10.0.0.0/24 | The network this entry routes traffic to |
| [AD/Metric] | [110/20] | Administrative distance = 110, metric = 20 |
| Next-hop IP | via 192.168.1.2 | IP address of the next router to forward to |
| Route age | 00:00:12 | Time since this route was last updated (hh:mm:ss) |
| Exit interface | GigabitEthernet0/2 | Local interface to send the packet out of |
| S* | S* 0.0.0.0/0 | Static default route — the gateway of last resort |
4. Route Type Codes
| Code | Meaning | How Installed |
|---|---|---|
C | Connected | Automatically added when an interface is configured with an IP and is up/up |
L | Local | The specific /32 host route for the router's own interface IP (added in IOS 15+) |
S | Static | Manually configured with ip route command — see Static Routing Configuration |
S* | Static Default | Default route: ip route 0.0.0.0 0.0.0.0 [next-hop] — see Default Routes |
O | OSPF | Learned via OSPF dynamic routing protocol (AD = 110) |
O E2 | OSPF External Type 2 | OSPF redistributed external route |
D | EIGRP | Learned via EIGRP dynamic routing protocol (AD = 90) |
R | RIP | Learned via RIP dynamic routing protocol (AD = 120) |
B | BGP | Learned via Border Gateway Protocol (eBGP AD = 20, iBGP AD = 200) |
i | IS-IS | Learned via IS-IS dynamic routing protocol |
5. Administrative Distance (AD)
Administrative distance is a value (0–255) that represents the trustworthiness of a routing source. When a router has multiple routes to the same destination from different sources, it installs the one with the lowest AD into the routing table.
| Route Source | AD Value | Why This Value |
|---|---|---|
| Connected interface | 0 | Always perfectly accurate — directly attached |
| Static route | 1 | Manually configured by admin — trusted almost as much as connected |
| eBGP | 20 | External BGP from a trusted peer |
| EIGRP (internal) | 90 | Fast converging Cisco protocol |
| OSPF | 110 | Standard open protocol |
| IS-IS | 115 | Used by ISPs and service providers |
| RIP | 120 | Older distance-vector protocol, less trusted |
| iBGP | 200 | Internal BGP — lower priority than IGPs |
| Unknown / unreachable | 255 | Never installed in routing table |
6. Metric
When multiple routes to the same destination exist from the same routing protocol (same AD), the router selects the route with the lowest metric. Each protocol calculates metric differently:
| Protocol | Metric Basis | Lower Is Better |
|---|---|---|
| OSPF | Cost = 100 Mbps / Interface bandwidth (default reference) | Yes |
| EIGRP | Composite of bandwidth + delay (+ optional load, reliability) | Yes |
| RIP | Hop count (max 15; 16 = unreachable) | Yes |
| BGP | Attributes (AS-path length, MED, local preference) | Depends on attribute |
| Static | Always 0 (no metric — manually specified) | N/A |
In the output [110/20] — the AD is 110 (OSPF) and the metric/cost is 20.
7. Route Selection — How the Router Chooses
- Longest prefix match: The most specific matching route wins.
/30beats/24beats/0for the same destination IP. - Lowest Administrative Distance: If multiple sources provide equally specific routes, pick the one with the lowest AD (most trusted source).
- Lowest Metric: If AD is equal (same protocol, multiple paths), pick the route with the lowest metric. Equal-metric routes are load-balanced (ECMP).
8. Default Route and Gateway of Last Resort
A default route (0.0.0.0/0 for IPv4, ::/0 for IPv6) matches any destination not found elsewhere in the routing table. It is the "catch-all" route used for internet access or to forward unknown traffic to an upstream router.
! Configure a static default route
Router(config)# ip route 0.0.0.0 0.0.0.0 192.168.1.1
! Verify — look for "Gateway of last resort" in show ip route output
Router# show ip route
Gateway of last resort is 192.168.1.1 to network 0.0.0.0
S* 0.0.0.0/0 [1/0] via 192.168.1.1
The Gateway of Last Resort is displayed at the top of show ip route output. If it says "not set", the router will drop any packet to an unknown destination — common cause of no internet connectivity.
9. Floating Static Routes
A floating static route is a backup route with a higher AD than the primary route. It stays hidden in the configuration but only enters the routing table when the primary route disappears.
! Primary route via OSPF (AD=110) — this will be preferred normally
! Floating static backup with AD=150 — only activates if OSPF route fails
Router(config)# ip route 10.0.0.0 255.255.255.0 192.168.2.1 150
While OSPF advertises the 10.0.0.0/24 route, the static with AD=150 is invisible. If OSPF fails (neighbour down, interface failure), the static route activates and traffic continues to flow via the backup path. See Floating Static Routes.
10. Summary Routes and Route Aggregation
A summary route represents multiple specific subnets as a single, less-specific route entry:
10.0.1.0/24
10.0.2.0/24 -- all summarised as --> 10.0.0.0/22
10.0.3.0/24
10.0.4.0/24 (excluded)
Benefits: reduces routing table size, speeds up lookups, limits LSA/update flooding in OSPF/EIGRP, and improves stability by hiding topology changes from other routers. See Route Summarization.
11. Troubleshooting with the Routing Table
| Problem | What to Check | Command |
|---|---|---|
| PC cannot reach the internet | Is there a default route (0.0.0.0/0) pointing to the gateway? | show ip route — look for Gateway of last resort |
| Cannot reach a specific subnet | Does a route exist for that subnet? Is next-hop correct? | show ip route 10.x.x.x |
| Route appears then disappears | Route flapping — check interface stability, protocol timers, neighbour adjacency | show ip interface, debug ip routing |
| Wrong path being taken | AD/metric values — expected source may be overridden by a lower-AD source | show ip route [network] — check source code and AD |
| Missing OSPF routes | OSPF neighbour adjacency, network statements, area configuration | show ip route ospf, show ip ospf neighbor |
1.
show ip route — is there a default route? If "Gateway of last resort is not set" → add ip route 0.0.0.0 0.0.0.0 [ISP-IP]2. Is there a route to 192.168.10.0/24? If not, the router doesn't know how to return traffic to the user — check connected interface.
3. Use traceroute to verify the actual forwarding path matches the expected routing table entries.
View Routing Table Quiz
Related Topics & Step-by-Step Tutorials
Continue building your routing knowledge:
- show ip route — full command reference and output interpretation
- show ip protocols — verify which routing protocols are running
- show ip interface brief — confirm interfaces are up/up before checking routes
- Administrative Distance — full AD table and how it affects route selection
- Metric — how each protocol calculates the best path
- Route Sources — connected, static, and dynamic routes compared
- Static Routing Configuration — configuring S and S* routes
- Default Routes — 0.0.0.0/0 and Gateway of Last Resort
- Floating Static Routes — backup routes with elevated AD
- Route Summarization — aggregating subnets to shrink the routing table
- OSPF Overview — most common IGP; code O in the routing table
- OSPF Single-Area Configuration
- OSPF Single-Area (Step-by-Step)
- OSPF Neighbor States — missing adjacency = missing O routes
- EIGRP Overview — code D in the routing table
- EIGRP Configuration (Step-by-Step)
- RIP Concepts — code R; hop-count metric; max 15 hops
- RIP Configuration
- BGP Overview — code B; used between autonomous systems
- traceroute — verify the actual path packets take
- ping — test reachability after confirming routing table
- Static Routing (Step-by-Step)
- Troubleshooting Layer 3 Routing (Step-by-Step)