RoutingEXEC

show ip route

Displays the current IP routing table, including directly connected, static, and dynamic routes learned via routing protocols.

Overview

The 'show ip route' command is a fundamental troubleshooting and verification tool on Cisco NX-OS devices. It displays the IP routing table, which contains all known routes to destination networks. The routing table is populated by directly connected interfaces, static routes, and dynamic routing protocols such as OSPF, EIGRP, BGP, and RIP. Each route entry includes the destination prefix, next-hop address, outgoing interface, administrative distance (called preference in NX-OS), metric, and the protocol that installed the route. On NX-OS, the routing table is per-VRF, meaning that each VRF maintains its own independent routing table. The command supports numerous filters to narrow down output, such as by protocol, prefix, or VRF. It is used extensively during initial configuration, ongoing monitoring, and troubleshooting of network connectivity issues. Understanding how to read the output is critical for network engineers to quickly identify missing routes, suboptimal paths, or routing loops. The command also provides insight into the best path selection process, as indicated by the 'ubest/mbest' counters and the asterisk marking the best path.

Syntax·EXEC
show ip route [vrf {vrf-name}] [ip-address [mask] [longer-prefixes]] [protocol [process-id]] [summary] [detail] [all] [next-hop] [connected] [static] [ospf [process-id]] [eigrp [process-id]] [bgp] [rip] [isis] [multicast] [unicast] [direct] [tag {tag-value}] [tracked] [updated] [pending] [best] [backup] [fib] [hardware] [software] [count] [sort] [xml]

When to Use This Command

  • Verify that a specific route is present in the routing table after configuring a static route or dynamic routing protocol.
  • Troubleshoot connectivity issues by checking if the expected route exists and has the correct next-hop and metric.
  • Examine the routing table for a specific VRF to ensure proper isolation and routing in multi-tenant environments.
  • Audit the routing table for route summarization, load balancing, or redistribution issues.

Parameters

ParameterSyntaxDescription
vrfvrf {vrf-name}Specifies the VRF context to display routes for. If omitted, the default VRF is used. Useful in multi-tenant environments.
ip-addressip-address [mask]Filters routes that match the given IP address and optional subnet mask. If mask is omitted, the command shows routes that match the address exactly.
longer-prefixeslonger-prefixesWhen used with an IP address and mask, displays all routes that are more specific than the specified prefix. Useful for checking subnets.
protocolprotocol [process-id]Filters routes learned by a specific routing protocol (e.g., ospf, bgp, static). Optionally, the process-id can be specified for protocols like OSPF.
summarysummaryDisplays a summary of the routing table, including route counts per protocol and network type.
detaildetailProvides more detailed information about each route, including backup paths and additional attributes.

Command Examples

Display the full routing table

show ip route
IP Route Table for VRF "default"
'*' denotes best ucast next-hop
'**' denotes best mcast next-hop
'[x/y]' denotes [preference/metric]
'%<string>' in via output denotes VRF <string>

10.1.1.0/24, ubest/mbest: 1/0, attached
    *via 10.1.1.1, Eth1/1, [0/0], 00:12:34, direct
10.2.2.0/24, ubest/mbest: 1/0
    *via 10.1.1.2, Eth1/2, [110/20], 00:10:00, ospf-100, intra
0.0.0.0/0, ubest/mbest: 1/0
    *via 10.1.1.254, Eth1/1, [1/0], 00:15:00, static

The output shows three routes: a directly connected network (10.1.1.0/24), an OSPF-learned route (10.2.2.0/24), and a default static route (0.0.0.0/0). Each line includes the prefix, best path indicator, next-hop IP and interface, administrative distance/metric, age, and source protocol.

Show routes for a specific IP address with longer prefixes

show ip route 10.2.2.0 255.255.255.0 longer-prefixes
IP Route Table for VRF "default"
'*' denotes best ucast next-hop
'[x/y]' denotes [preference/metric]

10.2.2.0/24, ubest/mbest: 1/0
    *via 10.1.1.2, Eth1/2, [110/20], 00:10:00, ospf-100, intra
10.2.2.128/25, ubest/mbest: 1/0
    *via 10.1.1.3, Eth1/3, [110/30], 00:05:00, ospf-100, intra

This command filters routes that match the given prefix and any more specific prefixes. It shows the exact /24 route and a /25 subroute, both learned via OSPF.

Understanding the Output

The output begins with a header indicating the VRF (default unless specified). Each route entry starts with the destination prefix. The 'ubest/mbest' field shows the number of unicast and multicast best paths. The asterisk (*) marks the best path. Next, the next-hop IP and outgoing interface are shown in the 'via' line. The brackets contain [administrative distance/metric]. The age (how long the route has been in the table) and the protocol source (e.g., direct, static, ospf) follow. For OSPF, the route type (intra, inter, etc.) is also displayed. A healthy routing table shows routes with appropriate metrics and next-hops that are reachable. Problematic indicators include missing routes, high metrics, or next-hops that are not reachable (e.g., via an interface that is down).

Configuration Scenarios

Verifying OSPF route installation

A network engineer has configured OSPF on a Nexus switch and wants to verify that routes are being learned correctly.

Topology

Nexus-A (Eth1/1) --- (Eth1/1) Nexus-B Nexus-A: 10.1.1.1/24 Nexus-B: 10.1.1.2/24, loopback0: 10.2.2.1/32

Steps

  1. 1.Configure OSPF on both switches.
  2. 2.On Nexus-A, issue 'show ip route ospf' to see OSPF-learned routes.
  3. 3.Verify that the loopback network from Nexus-B appears in the routing table.
Configuration
! On Nexus-A
router ospf 100
  router-id 1.1.1.1
  network 10.1.1.0 0.0.0.255 area 0
! On Nexus-B
router ospf 100
  router-id 2.2.2.2
  network 10.1.1.0 0.0.0.255 area 0
  network 10.2.2.1 0.0.0.0 area 0

Verify: On Nexus-A, run 'show ip route ospf'. Expected output includes '10.2.2.1/32' with next-hop 10.1.1.2 and metric 20.

Watch out: Ensure OSPF process IDs match if using the same process; otherwise, routes may not be exchanged.

Troubleshooting with This Command

When troubleshooting connectivity issues, the 'show ip route' command is often the first step. Start by checking if the destination network is present in the routing table. If not, verify that the appropriate routing protocol is configured and that neighbor adjacencies are established. For static routes, ensure the next-hop IP is reachable. If the route exists but traffic is not flowing, check the next-hop reachability using 'ping' or 'show ip arp'. Also, examine the administrative distance and metric to confirm that the best path is selected. For example, if a static route and an OSPF route exist for the same prefix, the one with lower administrative distance (preference) will be installed. On NX-OS, the 'ubest/mbest' counters are crucial: if 'ubest' is 0, no route is installed. Use the 'detail' option to see backup paths. If routes are missing, check for route filtering, distribute-lists, or prefix-lists that may be blocking them. Also, verify that the VRF is correct; a common mistake is to check the default VRF when the traffic is in a different VRF. The 'show ip route vrf <name>' command is essential in multi-VRF environments. Additionally, use 'show ip route summary' to get a quick overview of route counts and identify any unexpected changes.

CCNA Exam Tips

1.

Remember that the 'ubest/mbest' counters indicate the number of best paths; a value of 0 means no route is installed.

2.

Know that administrative distance (preference) determines route selection; lower values are preferred.

3.

Be able to interpret OSPF route types: intra (O), inter (O IA), and external (O E1/E2).

Common Mistakes

Confusing administrative distance with metric; they serve different purposes in route selection.

Assuming that a route appearing in the table is always reachable; verify next-hop reachability.

Forgetting to specify the VRF when troubleshooting in a multi-VRF environment, leading to incorrect conclusions.

Platform Notes

On Cisco NX-OS, the 'show ip route' command has several differences from Cisco IOS. First, NX-OS uses the term 'preference' instead of 'administrative distance'. The output format is also different, with the 'ubest/mbest' line indicating the number of best paths. NX-OS supports VRF-aware routing by default, so routes are always displayed per VRF. The command also supports additional filters like 'fib' to show routes in the forwarding information base, and 'hardware' or 'software' to indicate where the route is programmed. On IOS, the equivalent command is 'show ip route' with similar options, but the output format is more traditional. NX-OS also provides XML output with the 'xml' keyword for automation. For multicast routing, NX-OS uses 'show ip mroute' separately. The 'show ip route' command on NX-OS is part of the 'cisco-nx' feature set and is available in all software images.

Practice for the CCNA 200-301

Test your knowledge with hundreds of CCNA practice questions covering all exam domains.

Practice CCNA Questions