This command displays the routing table. The ip-address specifies the network for which the route is to be displayed and displays the best matching best-route for the address. The mask specifies the subnet mask for the given ip-address. When you use the longer-prefixes keyword, the ip-address and mask pair becomes the prefix, and the command displays the routes to the addresses that match that prefix. Use the protocol parameter to specify the protocol that installed the routes. The value for protocol can be connected, ospf, rip, or static, or bgp. Use the all parameter to display all routes including best and nonbest routes. If you do not use the all parameter, the command displays only the best route.
Note
If you use the connected keyword for protocol, the all option is not available because there are no best or nonbest connected routes.Note
If you use the static keyword for protocol, the description option is also available, for example: show ip route ip-address static description. This command shows the description configured with the specified static route(s).Format | show ip route ip-address [protocol] | {ip-address mask [longer-prefixes] [protocol] | protocol} [all] | all}] |
Modes |
|
Route Codes | The key for the routing protocol codes that might appear in the routing table output. |
The show ip route command displays the routing tables in the following format:
Code IP-Address/Mask [Preference/Metric] via Next-Hop, Route-Timestamp, Interface, Truncated
The columns for the routing table display the following information:
Code | The codes for the routing protocols that created the routes. |
Default Gateway | The IP address of the default gateway. When the system does not have a more specific route to a packet's destination, it sends the packet to the default gateway. |
IP-Address/Mask | The IP-Address and mask of the destination network corresponding to this route. |
Preference | The administrative distance associated with this route. Routes with low values are preferred over routes with higher values. |
Metric | The cost associated with this route. |
via Next-Hop | The outgoing router IP address to use when forwarding traffic to the next router (if any) in the path toward the destination. |
Route-Timestamp | The last updated time for dynamic routes. The format of Route-Timestamp will be
|
Interface | The outgoing router interface to use when forwarding traffic to the next destination. For reject routes, the next hop interface would be Null0 interface. |
T | A flag appended to a route to indicate that it is an ECMP (Equal Cost Multi Paths) route, but only one of its next hops has been installed in the forwarding table. The forwarding table may limit the number of ECMP routes or the number of ECMP groups. When an ECMP route cannot be installed because such a limit is reached, the route is installed with a single next hop. Such truncated routes are identified by a T after the interface name. |
To administratively control the traffic destined to a particular network and prevent it from being forwarded through the router, you can configure a static reject route on the router. Such traffic would be discarded and the ICMP (Internet Control Message Protocol) destination unreachable message is sent back to the source. This is typically used for preventing routing loops. The reject route added in the RTO is of the type OSPF Inter-Area. Reject routes (routes of REJECT type installed by any protocol) are not redistributed by OSPF/RIP (Routing Information Protocol). Reject routes are supported in both OSPFv2 and OSPFv3 (Open Shortest Path First version 3).
The following example shows CLI display output for the command.
(Extreme 220) (Routing) #show ip route Route Codes: R - RIP Derived, O - OSPF Derived, C - Connected, S - Static B - BGP Derived, IA - OSPF Inter Area E1 - OSPF External Type 1, E2 - OSPF External Type 2 N1 - OSPF NSSA External Type 1, N2 - OSPF NSSA External Type 2 L-Leaked Route K - Kernel P - Net Prototype Default gateway is 1.1.1.2 C 1.1.1.0/24 [0/1] directly connected, 0/11 C 2.2.2.0/24 [0/1] directly connected, 0/1 C 5.5.5.0/24 [0/1] directly connected, 0/5 S 7.0.0.0/8 [1/0] directly connected, Null0 OIA 10.10.10.0/24 [110/6] via 5.5.5.2, 00h:00m:01s, 0/5 C 11.11.11.0/24 [0/1] directly connected, 0/11 S 12.0.0.0/8 [5/0] directly connected, Null0 S 23.0.0.0/8 [3/0] directly connected, Null0 C 1.1.1.0/24 [0/1] directly connected, 0/11 C 2.2.2.0/24 [0/1] directly connected, 0/1 C 5.5.5.0/24 [0/1] directly connected, 0/5 C 11.11.11.0/24 [0/1] directly connected, 0/11 S 10.3.2.0/24 [1/0] via 1.1.1.2, 0/11
The following example shows CLI display output for the command to indicate a truncated route.
(router) #show ip route
Route Codes: R - RIP Derived, O - OSPF Derived, C - Connected, S - Static
B - BGP Derived, IA - OSPF Inter Area
E1 - OSPF External Type 1, E2 - OSPF External Type 2
N1 - OSPF NSSA External Type 1, N2 - OSPF NSSA External Type 2
L-Leaked Route K - Kernel P - Net Prototype
O E1 100.1.161.0/24 [110/10] via 172.20.11.100, 00h:00m:13s, 2/11 T
O E1 100.1.162.0/24 [110/10] via 172.20.11.100, 00h:00m:13s, 2/11 T
O E1 100.1.163.0/24 [110/10] via 172.20.11.100, 00h:00m:13s, 2/11 T
The following shows an example of output that displays leaked routes.
Subnetwork 9.0.0.0/24 is a connected subnetwork in global table and subnet 56.6.6.0/24 is reachable via a gateway 9.0.0.2 in the global table. These two routes leak into the virtual router Red and leak the connected subnet 8.0.0.0/24 from Red to global table.
When leaking connected route in the global routing table to a virtual router, the /32 host route for the leaked host is added in the virtual router instance‘s route table. Leaking of non /32 connected routes into the virtual router table from global routing table is not supported.
This enables the nodes in subnet 8.0.0.0/24 to access shared services via the global routing table. Also we add a non-leaked static route for 66.6.6.0/24 subnetwork scoped to the domain of virtual router Red.
(Router) (Config)#ip route vrf Red 9.0.0.2 255.255.255.255 9.0.0.2 0/26 (Router) (Config)#ip route vrf Red 56.6.6.0 255.255.255.0 9.0.0.2 0/26 (Router) (Config)#ip route vrf Red 66.6.6.0 255.255.255.0 8.0.0.2 (Router) (Config)#ip route 8.0.0.0 255.255.255.0 0/27 (Router) #show ip route vrf Red Route Codes: R - RIP Derived, O - OSPF Derived, C - Connected, S - Static B - BGP Derived, IA - OSPF Inter Area E1 - OSPF External Type 1, E2 - OSPF External Type 2 N1 - OSPF NSSA External Type 1, N2 - OSPF NSSA External Type 2 L – Leaked Route K - Kernel P - Net Prototype C 8.0.0.0/24 [0/1] directly connected, 0/27 S L 9.0.0.2/32 [1/1] directly connected, 0/26 S L 56.6.6.0/24 [1/1] via 9.0.0.2, 02d:22h:15m, 0/26 S 66.6.6.0/24 [1/1] via 8.0.0.2, 01d:22h:15m, 0/27 (Router) #show ip route Route Codes: R - RIP Derived, O - OSPF Derived, C - Connected, S - Static B - BGP Derived, IA - OSPF Inter Area E1 - OSPF External Type 1, E2 - OSPF External Type 2 N1 - OSPF NSSA External Type 1, N2 - OSPF NSSA External Type 2 L – Leaked Route C 9.0.0.0/24 [0/1] directly connected, 0/26 S L 8.0.0.0/24 [1/1] directly connected, 0/27 The following shows an example of the output that displays with a hardware failure. (Router) (Config)#interface 0/1 (Router) (Interface 0/1)#routing (Router) (Interface 0/1)#ip address 9.0.0.1 255.255.255.0 (Router) (Interface 0/1)#exit (Router) (Config)#ip route net-prototype 56.6.6.0/24 9.0.0.2 1 (Router) #show ip route Route Codes: R - RIP Derived, O - OSPF Derived, C - Connected, S - Static
B - BGP Derived, IA - OSPF Inter Area E1 - OSPF External Type 1, E2 - OSPF External Type 2 N1 - OSPF NSSA External Type 1, N2 - OSPF NSSA External Type 2
S U - Unnumbered Peer, L - Leaked Route, K – Kernel P – Net Prototype C 9.0.0.0/24 [0/0] directly connected, 0/1 P 56.6.6.0/24 [1/1] via 9.0.0.2, 01d:22h:15m, 0/1 hw-failure