Command Name: how ip route
Function: Displays the IP routing table with extra details such as the route source, protocol, and metric.
Syntax:
how ip route [destination-address/prefix-length]
Usage:
- The
how ip route
command is used to display the IP routing table with additional details, such as the route source, protocol, and metric. - The command takes an optional argument, which is the destination address and prefix length of the route that you want to look up. If you do not specify an argument, the command will display all of the routes in the routing table.
Output:
- The output of the
how ip route
command is a table that contains the following columns:- Destination Address: The destination address of the route.
- Prefix Length: The prefix length of the route.
- Next Hop: The next hop address for the route.
- Output Interface: The output interface for the route.
- Route Source: The source of the route. This can be one of the following:
- C: Connected
- S: Static
- R: RIP
- O: OSPF
- EIGRP: EIGRP
- I: IGRP
- B: BGP
- L: L2
- D: Default
- Protocol: The routing protocol that was used to learn the route.
- Metric: The metric of the route.
- Administrative Distance: The administrative distance of the route.
- Age: The age of the route.
Examples:
- To display all of the routes in the routing table, use the following command:
how ip route
- To display the route to the 10.0.0.0/24 network, use the following command:
how ip route 10.0.0.0/24
- To display the route to the 10.0.0.0/24 network that was learned from the RIP protocol, use the following command:
how ip route 10.0.0.0/24 R
Additional Information:
- The
how ip route
command is available on all Cisco IOS routers and switches. - The
how ip route
command is a privileged EXEC command. - The output of the
how ip route
command can be used to troubleshoot routing problems. For example, you can use the command to identify the source of a route, the protocol that was used to learn the route, and the metric of the route.
how ip route Usage Examples
1. Display the IPv4 Routing Table:
show ip route
2. Display the IPv4 Routing Table with Specific Information:
show ip route [route-type] [keyword]
For example, to display only directly connected routes:
show ip route direct
3. Display the IPv6 Routing Table:
show ipv6 route
4. Display the IPv6 Routing Table with Specific Information:
show ipv6 route [route-type] [keyword]
For example, to display only static IPv6 routes:
show ipv6 route static
5. Display the Routing Table for a Specific Routing Protocol:
show ip route [protocol]
For example, to display only EIGRP routes:
show ip route eigrp
6. Display the Routing Table for a Specific Destination:
show ip route destination [address/prefix]
For example, to display routes to the 192.168.1.0/24 network:
show ip route destination 192.168.1.0/24
7. Display the Routing Table for a Specific Interface:
show ip route interface [interface-name]
For example, to display routes associated with the GigabitEthernet0/1 interface:
show ip route interface GigabitEthernet0/1
8. Display the Routing Table for a Specific VRF:
show ip route vrf [vrf-name]
For example, to display routes in the “blue” VRF:
show ip route vrf blue
9. Display the Routing Table in a JSON Format:
show ip route json
10. Troubleshoot Routing Issues:
show ip route [route-type] [keyword] all-paths
This command displays all available paths to a destination, including both active and inactive paths. This information can be helpful in troubleshooting routing loops or other routing problems.