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
FieldExample ValueMeaning
Route codeOHow the route was learned (see Section 4)
Destination network10.0.0.0/24The network this entry routes traffic to
[AD/Metric][110/20]Administrative distance = 110, metric = 20
Next-hop IPvia 192.168.1.2IP address of the next router to forward to
Route age00:00:12Time since this route was last updated (hh:mm:ss)
Exit interfaceGigabitEthernet0/2Local interface to send the packet out of
S*S* 0.0.0.0/0Static default route — the gateway of last resort

4. Route Type Codes

CodeMeaningHow Installed
CConnectedAutomatically added when an interface is configured with an IP and is up/up
LLocalThe specific /32 host route for the router's own interface IP (added in IOS 15+)
SStaticManually configured with ip route command — see Static Routing Configuration
S*Static DefaultDefault route: ip route 0.0.0.0 0.0.0.0 [next-hop] — see Default Routes
OOSPFLearned via OSPF dynamic routing protocol (AD = 110)
O E2OSPF External Type 2OSPF redistributed external route
DEIGRPLearned via EIGRP dynamic routing protocol (AD = 90)
RRIPLearned via RIP dynamic routing protocol (AD = 120)
BBGPLearned via Border Gateway Protocol (eBGP AD = 20, iBGP AD = 200)
iIS-ISLearned 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 SourceAD ValueWhy This Value
Connected interface0Always perfectly accurate — directly attached
Static route1Manually configured by admin — trusted almost as much as connected
eBGP20External BGP from a trusted peer
EIGRP (internal)90Fast converging Cisco protocol
OSPF110Standard open protocol
IS-IS115Used by ISPs and service providers
RIP120Older distance-vector protocol, less trusted
iBGP200Internal BGP — lower priority than IGPs
Unknown / unreachable255Never installed in routing table
Memory tip: "Can Some Engineers Simply Operate Reliable Networks?" — Connected (0), Static (1), EIGRP (90), OSPF (110), RIP (120), iBGP (200). Lowest wins. See Administrative Distance.

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:

ProtocolMetric BasisLower Is Better
OSPFCost = 100 Mbps / Interface bandwidth (default reference)Yes
EIGRPComposite of bandwidth + delay (+ optional load, reliability)Yes
RIPHop count (max 15; 16 = unreachable)Yes
BGPAttributes (AS-path length, MED, local preference)Depends on attribute
StaticAlways 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

  1. Longest prefix match: The most specific matching route wins. /30 beats /24 beats /0 for the same destination IP.
  2. Lowest Administrative Distance: If multiple sources provide equally specific routes, pick the one with the lowest AD (most trusted source).
  3. Lowest Metric: If AD is equal (same protocol, multiple paths), pick the route with the lowest metric. Equal-metric routes are load-balanced (ECMP).
Example: Router receives routes to 10.0.0.0/24 from both OSPF (AD=110, metric=30) and RIP (AD=120, metric=2). OSPF wins because its AD (110) is lower, even though RIP's metric is lower. AD always takes priority over metric.

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

ProblemWhat to CheckCommand
PC cannot reach the internetIs 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 subnetDoes a route exist for that subnet? Is next-hop correct?show ip route 10.x.x.x
Route appears then disappearsRoute flapping — check interface stability, protocol timers, neighbour adjacencyshow ip interface, debug ip routing
Wrong path being takenAD/metric values — expected source may be overridden by a lower-AD sourceshow ip route [network] — check source code and AD
Missing OSPF routesOSPF neighbour adjacency, network statements, area configurationshow ip route ospf, show ip ospf neighbor
Real-World Scenario: User's PC (192.168.10.20) cannot reach the internet.
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

1. What is the main purpose of viewing the routing table on a router?

Correct answer is C. The routing table is the router's forwarding decision database. Viewing it tells you whether routes exist for specific destinations, where traffic will be forwarded next-hop, which protocol is sourcing each route, and what AD/metric values are in play — all essential for diagnosing connectivity problems.

2. Which command displays the full IPv4 routing table on a Cisco device?

Correct answer is A. show ip route displays the complete IPv4 routing table with all route codes, destinations, next-hops, AD/metric values, and exit interfaces. Use show ipv6 route for the IPv6 routing table. You can add filters: show ip route ospf or show ip route | include 10.0.0.

3. What does the route code 'O' represent in the Cisco routing table?

Correct answer is D. The code O indicates an OSPF-learned route with a default Administrative Distance of 110. Other key codes: C = Connected (AD 0), S = Static (AD 1), D = EIGRP (AD 90), R = RIP (AD 120), B = BGP. The code S* means static default route — see Default Routes.

4. What does Administrative Distance (AD) represent in the routing table?

Correct answer is B. Administrative Distance (AD) is a value from 0–255 that represents how trustworthy the source of a route is. Lower AD = more trusted. When the same destination is reachable via multiple protocols, the one with the lowest AD wins: Connected (0) > Static (1) > EIGRP (90) > OSPF (110) > RIP (120). See Administrative Distance.

5. How is the IPv4 default route represented in the routing table?

Correct answer is C. The IPv4 default route is 0.0.0.0/0 — it has a prefix length of /0, meaning it matches any IP address (all bits are "don't care"). It is the lowest-priority route (matched last) and is used for traffic where no more specific route exists. The IPv6 default route is ::/0.

6. How does a router select the best route when multiple routes exist to the same destination?

Correct answer is D. Route selection follows a strict three-step hierarchy: (1) Longest prefix match — /30 beats /24 beats /0; (2) Lowest AD — if prefix length is equal, most trusted source wins; (3) Lowest metric — if AD is also equal (same protocol), lowest metric wins. Equal-metric routes may be load-balanced.

7. What does the 'C' route code indicate in the routing table?

Correct answer is A. A C (Connected) route is automatically added to the routing table when an interface is configured with an IP address and the interface is in an up/up state. Connected routes have an AD of 0 — the most trusted source possible, since the network is directly attached. They disappear if the interface goes down.

8. What is the purpose of a floating static route?

Correct answer is B. A floating static route is configured with an AD higher than the primary route (e.g., AD=150 if primary is OSPF at AD=110). While the primary route is active, the floating static is hidden. If the primary fails (OSPF neighbour down, link failure), the static "floats up" into the routing table and traffic continues via the backup path.

9. Which command filters routing table output to show only routes learned via OSPF?

Correct answer is D. show ip route ospf filters the routing table to display only OSPF-learned routes (code O). Similarly: show ip route connected, show ip route static, show ip route eigrp, show ip route rip. Use show ip route | include [string] for text-based filtering.

10. A PC cannot reach the internet. What should be the first routing table check?

Correct answer is C. Without a default route, the router drops any packet destined for an internet IP (since no specific route exists for billions of internet addresses). Run show ip route and check the top line — it should say "Gateway of last resort is [IP] to network 0.0.0.0". If it says "not set", add ip route 0.0.0.0 0.0.0.0 [next-hop].

Related Topics & Step-by-Step Tutorials

Continue building your routing knowledge:

← Back to Home