Problem
You need to check to make sure the local router has a route to another router in the network.
Solution
Use the following version of the show route command:
aviva@RouterG> show route 10.0.8.1 inet.0: 18 destinations, 18 routes (18 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 10.0.8.0/24 *[IS-IS/18] 00:11:18, metric 20 > to 10.0.0.2 via fe-1/0/1.0
Discussion
Often you may want to find out whether the local routing table has a route to a particular destination, such as when you are trying to figure out the path that traffic is taking toward a destination. If you include the destination's address in the show route command, you see only that route. This recipe shows the route to 10.0.8.1, which was learned from an IS-IS Level 2 internal route, has a metric value of 20, and goes through the next hop of 10.0.0.2 over the router's interface fe-1/0/1. The header lines for the inet.0 routing table are also displayed, so you see that this routing table has a total of 18 routes to 18 destinations.
For more information about the route, use the detail option:
aviva@RouterG> show route 10.0.8.1 detail inet.0: 18 destinations, 18 routes (18 active, 0 holddown, 0 hidden) 10.0.8.0/24 (1 entry, 1 announced) *IS-IS Preference: 18 Level: 2 Next-hop reference count: 4 Next hop: 10.0.0.2 via fe-1/0/1.0, selected State: Age: 11:41 Metric: 20 Task: IS-IS Announcement bits (1): 0-KRT AS path: I
This output shows a few more fields of interest. The Next hop field shows that this next hop has been selected for inclusion in the forwarding table. The State field shows that this route is active and is an interior route. The AS path field also shows that the route was learned internally.
The output in this recipe is straightforward because there is only one route to the destination and it is active. Some routes have multiple next hops:
aviva@RouterG> show route protocol 10.0.2.0/24 inet.0: 18 destinations, 18 routes (18 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 10.0.2.0/24 *[IS-IS/18] 00:45:17, metric 20 > to 10.0.1.1 via fe-0/0/1.0 to 10.0.0.2 via fe-1/0/1.0
The destination 10.0.2.0/24 has two next hops, one reachable through interface fe-0/0/1 and the second through a different router interface, fe-1/0/1. The asterisk indicates that this route, learned from IS-IS, is active. The metric for both next hops is 20, so there are two equal-cost paths to 10.0.2.0/24. Because both routers have been learned from the same protocol, by default the JUNOS software randomly chooses one of them. The > indicates the path being used.
Routes can also be learned from multiple routing protocols:
aviva@Router3> show route 10.1.1.0/24 inet.0: 28 destinations, 48 routes (28 active, 0 holddown, 0 hidden) Restart Complete + = Active Route, - = Last Active, * = Both 10.1.1.0/24 *[OSPF/10] 00:16:20, metric 65 via so-0/2/0.0 > via so-0/2/1.0 [IS-IS/18] 00:16:08, metric 126 to 10.1.2.1 via so-0/2/0.0 > to 10.1.6.1 via so-0/2/1.0
Here, both OSPF and IS-IS have learned routes to 10.1.1.0/24. The OSPF routes are chosen over the IS-IS ones because of the lower preference value (10 versus 18). The two routes learned by each protocol are both equal-cost paths to the destination, so the JUNOS software randomly chooses one of them, again indicating the selected path with a >.
If you expect a prefix to be in the routing table but it is not, look at the first two lines of the show route output to check for hidden routes. If the routing table contains some, check for the prefix with the show route hidden command. If the prefix is hidden, examine the router's routing policies to see if an inbound policy is rejecting the route. If necessary, set up policy tracing to log how policies are being evaluated (see Recipe 9.7). Another possibility is that there is no next hop toward the destination. Check the network topology and physical links between your network systems.
See Also
Recipe 9.7
Router Configuration and File Management
Basic Router Security and Access Control
IPSec
SNMP
Logging
NTP
Router Interfaces
IP Routing
Routing Policy and Firewall Filters
RIP
IS-IS
OSPF
BGP
MPLS
VPNs
IP Multicast