show route
Displays the current routing table entries on Cisco IOS-XR, including directly connected, static, and dynamic routes.
Overview
The 'show route' command is one of the most fundamental and frequently used commands in Cisco IOS-XR for examining the routing table. It provides a snapshot of all routes known to the router, including directly connected networks, static routes, and routes learned via dynamic routing protocols such as OSPF, IS-IS, BGP, and EIGRP. The routing table is the core database that the router uses to make forwarding decisions; every packet's destination IP is looked up in the routing table to determine the next-hop and outgoing interface. Understanding how to read and interpret the output of this command is essential for network engineers to verify routing configurations, troubleshoot connectivity issues, and ensure optimal path selection.
In Cisco IOS-XR, the routing table is organized by address family (IPv4 or IPv6) and by route type (unicast or multicast). The command supports various filters to narrow down the output, such as displaying routes for a specific VRF, protocol, or prefix. The 'detail' option provides additional information like the routing protocol, process ID, route type, and the router ID of the advertising neighbor. The 'summary' option gives a high-level count of routes by protocol. IOS-XR also supports advanced features like route policy filtering and SR-TE policies, which can be displayed with the appropriate keywords.
When troubleshooting, the 'show route' command is often the first step to verify if a route exists and if it has the correct next-hop. For example, if a remote network is unreachable, checking the routing table will reveal whether the route is missing, has a wrong next-hop, or is being overridden by a different route with a lower administrative distance. The command can also be used to check for routing loops, suboptimal paths, or unexpected routes that may indicate a misconfiguration or security issue. In a multi-VRF environment, the 'vrf' keyword is crucial to inspect the routing table of a specific VRF, as each VRF maintains its own independent routing table.
show route [ipv4|ipv6] [unicast|multicast] [vrf vrf-name] [protocol] [prefix/length] [longer-prefixes] [detail] [summary] [backup] [best] [extcommunity] [label] [next-hop] [policy] [sr-policy] [table] [te] [topology] [traffic-engineering] [verbose]When to Use This Command
- Verify that a specific route is present in the routing table after configuration.
- Troubleshoot routing issues by checking the next-hop and outgoing interface for a destination.
- Compare routing tables across multiple VRFs to ensure proper isolation.
- Monitor the routing table for unexpected routes that may indicate a misconfiguration or security issue.
Parameters
| Parameter | Syntax | Description |
|---|---|---|
| ipv4|ipv6 | ipv4 | ipv6 | Specifies the address family. If omitted, both IPv4 and IPv6 routes are displayed (default behavior may vary). |
| unicast|multicast | unicast | multicast | Filters routes by type. Unicast is the default for most deployments. |
| vrf vrf-name | vrf vrf-name | Displays routes for a specific VRF. If omitted, the default VRF is used. |
| protocol | bgp | ospf | isis | static | connected | ... | Filters routes learned via a specific routing protocol. |
| prefix/length | A.B.C.D/length | Displays route(s) matching the specified prefix and length. Use 'longer-prefixes' to include more specific routes. |
| detail | detail | Provides detailed information about each route, including protocol, process ID, route type, and advertising router. |
| summary | summary | Displays a summary of the routing table, including route counts by protocol. |
Command Examples
Display all IPv4 routes
show route ipv4 unicastCodes: C - connected, S - static, R - RIP, B - BGP, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2, i - IS-IS L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area * - candidate default Gateway of last resort is 10.0.0.1 to network 0.0.0.0 O 10.1.1.0/24 [110/2] via 10.0.0.2, 00:12:34, GigabitEthernet0/0/0/0 C 10.2.2.0/24 is directly connected, 00:45:12, GigabitEthernet0/0/0/1 S 10.3.3.0/24 [1/0] via 10.0.0.3, 00:05:00 B 10.4.4.0/24 [200/0] via 10.0.0.4, 00:10:00 O E2 10.5.5.0/24 [110/20] via 10.0.0.5, 00:08:00, GigabitEthernet0/0/0/2
The output shows routing table entries with codes indicating the protocol. Each line shows the destination network, administrative distance/metric, next-hop IP, age, and outgoing interface. For example, 'O' indicates OSPF, 'C' connected, 'S' static, 'B' BGP.
Display a specific route with detail
show route 10.1.1.0/24 detailRouting entry for 10.1.1.0/24
Known via "ospf 100", distance 110, metric 2, type intra area
Installed Dec 15 12:34:56.789 for 00:12:34
Routing Descriptor Blocks:
10.0.0.2, from 10.0.0.2, via GigabitEthernet0/0/0/0
Route metric is 2
No advertising protos.The detail output shows the protocol (OSPF process 100), administrative distance, metric, route type, installation time, next-hop, and outgoing interface. It also shows the router ID of the advertising router.
Understanding the Output
The show route command output begins with a legend explaining the route codes (e.g., C for connected, O for OSPF, B for BGP). Each route entry displays the destination network prefix, followed by the administrative distance and metric in brackets, the next-hop IP address, the age of the route (how long since it was last updated), and the outgoing interface. The 'Gateway of last resort' line indicates the default route if present. In the detailed view, additional information such as the routing protocol, process ID, route type (intra-area, inter-area, external), and the router ID of the advertising neighbor are shown. A healthy routing table should have routes with appropriate metrics and next-hops that are reachable. Problematic entries may show high metrics, stale ages, or next-hops that are not reachable (e.g., via an interface that is down).
Configuration Scenarios
Verifying OSPF Route Installation
After configuring OSPF on two routers, verify that routes are being exchanged correctly.
Topology
RouterA (10.0.0.1) --- Gig0/0/0/0 --- RouterB (10.0.0.2)
RouterB has loopback 10.1.1.1/32 advertised into OSPF.Steps
- 1.Configure OSPF on both routers.
- 2.On RouterA, use 'show route ospf' to see OSPF-learned routes.
- 3.Verify that 10.1.1.1/32 appears with next-hop 10.0.0.2.
! RouterA router ospf 100 network 10.0.0.0 0.0.0.255 area 0 ! RouterB router ospf 100 network 10.0.0.0 0.0.0.255 area 0 network 10.1.1.1 0.0.0.0 area 0
Verify: On RouterA: show route ospf Expected output includes 'O 10.1.1.1/32 [110/2] via 10.0.0.2, 00:01:00, GigabitEthernet0/0/0/0'
Watch out: Ensure OSPF network statements match the correct interfaces; otherwise, routes may not be advertised.
Checking BGP Route in a VRF
In a MPLS L3VPN environment, verify that a BGP route is present in a specific VRF.
Topology
PE1 (10.0.0.1) --- P --- PE2 (10.0.0.2)
VRF CUSTOMER has route 192.168.1.0/24 learned via BGP.Steps
- 1.On PE1, use 'show route vrf CUSTOMER bgp' to see BGP routes in that VRF.
- 2.Check that 192.168.1.0/24 is present with correct next-hop.
! PE1 vrf CUSTOMER rd 100:1 address-family ipv4 unicast import route-target 100:1 export route-target 100:1 ! router bgp 100 vrf CUSTOMER neighbor 10.0.0.2 remote-as 100 address-family ipv4 unicast route-policy PASS-ALL in route-policy PASS-ALL out
Verify: show route vrf CUSTOMER bgp Expected output: 'B 192.168.1.0/24 [200/0] via 10.0.0.2, 00:10:00'
Watch out: VRF routes are isolated; ensure you specify the correct VRF name.
Troubleshooting with This Command
When troubleshooting routing issues with 'show route' on Cisco IOS-XR, start by checking if the expected route exists. If a route is missing, verify that the routing protocol is configured correctly and that neighbors are established. Use 'show route protocol' to filter by protocol and confirm that the protocol is learning routes. If the route exists but traffic is not flowing, check the next-hop reachability: the next-hop IP must be reachable via a directly connected interface or a recursive route. Use 'ping' to test reachability to the next-hop. Also, examine the administrative distance: if multiple protocols provide the same route, the one with the lowest AD is installed. Use 'show route backup' to see alternative routes. If the route is present but has a high metric, it may indicate a suboptimal path; check the metric values and compare with expected values. In case of routing loops, look for routes that point back to the same router. The 'detail' option reveals the route source and age; a stale route (high age) might indicate a neighbor failure. For BGP, ensure that the next-hop is reachable via an IGP; otherwise, the route may be hidden. Use 'show route next-hop' to verify. In multi-VRF environments, always specify the VRF to avoid confusion. Finally, use 'show route summary' to get an overview of route counts; a sudden drop in routes may indicate a protocol issue.
CCNA Exam Tips
Memorize the route codes (C, S, O, B, etc.) as they are commonly tested in CCNP exams.
Understand the difference between administrative distance and metric; the show route output shows both.
Practice interpreting the 'via' and 'is directly connected' phrases to identify next-hop vs. directly attached routes.
Common Mistakes
Confusing the administrative distance with the metric; the first number in brackets is AD, the second is metric.
Forgetting to specify VRF when troubleshooting in a multi-VRF environment; the command defaults to the default VRF.
Misinterpreting the route age; a high age may indicate a stable route, not necessarily a problem.
Platform Notes
In Cisco IOS-XR, the 'show route' command has several differences from classic Cisco IOS. IOS-XR uses a modular architecture and the routing table is stored in the Routing Information Base (RIB). The command syntax is more granular, with explicit address family and VRF keywords. Unlike IOS, IOS-XR does not support the 'show ip route' alias; you must use 'show route ipv4 unicast'. Additionally, IOS-XR supports advanced features like Segment Routing (SR) and Traffic Engineering (TE), which can be displayed with 'show route sr-policy' or 'show route traffic-engineering'. The output format is also different: IOS-XR uses a consistent columnar format and includes the route type (e.g., intra area, external). For BGP, IOS-XR shows the route as 'B' with the AD and metric, but the metric is typically 0 for eBGP and 0 for iBGP unless modified. In IOS, the 'show ip route' command is simpler and does not require specifying the address family. For equivalent commands on other platforms, Juniper Junos uses 'show route', while Arista EOS uses 'show ip route'. Version differences: In IOS-XR 6.x and later, the command supports additional keywords like 'sr-policy' and 'te'.
Practice for the CCNA 200-301
Test your knowledge with hundreds of CCNA practice questions covering all exam domains.
Practice CCNA Questions