Viewing the Routes in the Routing Table

Problem

You want to check the routing table to see that it contains the routes you expect to other routers in your domain and to routers in other ASs.

Solution

The show route command shows the contents of the routing table:

	aviva@RouterA> show route
	inet.0: 5 destinations, 5 routes (5 active, 0 holddown, 0 hidden)
	+ = Active Route, - = Last Active, * = Both
	10.0.16.0/24 *[Direct/0] 5d 17:37:05
	 > via fe-0/0/0.0
	10.0.16.1/32 *[Local/0] 1w0d 15:51:30
	 Local via fe-0/0/0.0
	10.0.21.0/24 *[Direct/0] 1w0d 17:32:48
	 > via se-0/0/3.0
	10.0.21.1/32 *[Local/0] 1w0d 17:32:53
	 Local via se-0/0/3.0
	192.168.42.1/32 *[Direct/0] 5d 18:02:37
	 > via lo0.0
	__juniper_private1__.inet.0: 2 destinations, 2 routes (2 active, 0 holddown, 0
	hidden)
	+ = Active Route, - = Last Active, * = Both
	10.0.0.1/32 *[Direct/0] 1w0d 19:02:26
	 > via lo0.16385
	10.0.0.16/32 *[Direct/0] 1w0d 19:02:26
	 > via lo0.16385

If IPv6 is running on the router, the routing table contains its routes. These are listed at the end of the show route command, or you can display them separately with the following command:

	aviva@RouterA> show route table inet6.0
	inet6.0: 6 destinations, 8 routes (6 active, 0 holddown, 0 hidden)
	+ = Active Route, - = Last Active, * = Both
	9009:1::/64 *[Direct/0] 00:01:08
	 > via se-0/0/3.0
	 [Direct/0] 00:01:08
	 > via fe-0/0/0.0
	9009:1::1/128 *[Local/0] 00:01:08
	 Local via fe-0/0/0.0
	9009:1::3/128 *[Local/0] 00:01:08
	 Local via se-0/0/3.0
	fe80::/64 *[Direct/0] 00:01:08
	 > via se-0/0/3.0
	 [Direct/0] 00:01:08
	 > via fe-0/0/0.0
	fe80::205:85ff:feca:ca70/128
	 *[Direct/0] 00:01:08
	 > via lo0.0
	feee::10:255:71:4/128
	 *[Direct/0] 00:01:08
	 > via lo0.0

When the router is running IS-IS, the show route command lists entries in the ISO routing table, iso.0, or you can view them separately with this command:

	aviva@RouterA> show route table iso.0
	iso.0: 1 destinations, 1 
routes (1 active, 0 holddown, 0 hidden)
	+ = Active Route, - = Last Active, * = Both
	49.0020.1921.6804.2001/72
	 *[Direct/0] 13:16:30
	 > via lo0.0

 

Discussion

The show route command is the basic command for listing routes in the routing table. The first command in this recipe, without any options, shows the contents of all the routing tables that RPD is currently using. This output shows the contents of two routing tables, inet.0, which is the default routing table for IPv4 unicast routes, and __juniper_private1__, which is an internal routing table used by the JUNOS software. If IPv6, IS-IS, multicast, or traffic engineering is configured on the router, the show route command lists the routes in the routing tables used by these protocols, including inet6.0, iso.0, inet.2, inet.3, and mpls.0.

The first two lines of the show route output summarize the entries in the inet.0 table:

	inet.0: 5 destinations, 5 routes (5 active, 0 holddown, 0 hidden)
	+ = Active Route, - = Last Active, * = Both

This table has five routes. Of these, five are active, none are in the hold-down state prior to being deleted from the routing table, and none are hidden as a result of a configured routing policy.

The left column of the table shows the IP addresses of the routing entries. The direct routes are those to the prefixes (subnetwork addresses) assigned to an interface on the router. In the inet.0 table, you see three direct routes: two are to physical interface subnetworks, 10.0.16.0/24 and 10.0.21.0/24, and one is to the router's loopback interface, 192.168.42.1/32. The local routes are the /32 interface addresses on the directly connected interfaces, and there are two in the routing table, 10.0.16.1/32 and 10.0.21.1/32.

The right column of the output gives some details about each route. The asterisk (*) indicates that the route is the active route, which is the route currently installed in the forwarding table.

The text within the square brackets indicates how the route was learned and the route's preference value. All routes in the inet.0 table are either local on the router or learned as a result of a direct network connection to a neighboring router. If a route is learned from a dynamic routing protocol, such as BGP or IS-IS, or is statically configured, you see this in the square brackets. Here is a static route:

	192.168.12.1/32 *[Static/5] 3d 21:43:37
	 > to 10.0.16.1 via fe-1/0/0.0

Here is a route learned from IS-IS:

	10.0.24.0/24 *[IS-IS/18] 22:53:36, metric 20
	 > to 10.0.1.1 via fe-0/0/1.0

The preference values shown in the output in this recipe are all default values.

The numbers following the brackets show how long the routing table has known about the route. The first route in the table has been known for 5 days, 17 hours, 37 minutes, and 5 seconds:

	10.0.16.0/24 *[Direct/0] 5d 17:37:05

For routes learned from dynamic routing protocols, such as the IS-IS, the route's cost, or metric, is listed after the time. This value is calculated by the routing protocol.

The second line for each route shows the IP address of the next hop toward the destination and the router interface to use to reach that destination. Because no routing protocols are currently configured on the router, the routing table contains only local and direct routes, and you see only the router interface to the destination. If a routing protocol is running, the IP address precedes the interface, as you can see in the static and IS-IS routes shown above. The IP address doesn't always precede the interface. Exceptions include routes that point to unnumbered interfaces and routes with non-IP next hops, such as MPLS routes.

The second part of the show route output shows the routes for the other routing table RPD is currently usingthe internal JUNOS routing table, __juniper_private1__. Both routes listed travel on interface lo0.16385, which is an internal loopback interface created and used only by the JUNOS software.

To display only the IPv4 unicast routes without the internal JUNOS routes, use this command:

	aviva@RouterA> show route table inet.0
	inet.0: 5 destinations, 5 routes (5 active, 0 holddown, 0 hidden)
	+ = Active Route, - = Last Active, * = Both
	10.0.16.0/24 *[Direct/0] 5d 17:37:05
	 > via fe-0/0/0.0
	10.0.16.1/32 *[Local/0] 1w0d 15:51:30
	 Local via fe-0/0/0.0
	10.0.21.0/24 *[Direct/0] 1w0d 17:32:48
	 > via se-0/0/3.0
	10.0.21.1/32 *[Local/0] 1w0d 17:32:53
	 Local via se-0/0/3.0
	192.168.42.1/32 *[Direct/0] 5d 18:02:37
	 > via lo0.0

For a quickly skimmable view of the routing-table entries, use the terse version of the show route command:

	aviva@RouterA>  
show route terse
	inet.0: 5 destinations, 5 
routes (5 active, 0 holddown, 0 hidden)
	+ = Active Route, - = Last Active, * = Both
	A Destination P Prf Metric 1 Metric 2 Next hop AS path
	* 10.0.16.0/24 D 0 >fe-0/0/0.0
	* 10.0.16.1/32 L 0 Local
	* 10.0.21.0/24 D 0 >se-0/0/3.0
	* 10.0.21.1/32 L 0 Local
	* 192.168.42.1/32 D 0 >lo0.0
	__juniper_private1__.inet.0: 2 destinations, 2 routes (2 active, 0 holddown, 0
	hidden)
	+ = Active Route, - = Last Active, * = Both
	A Destination P Prf Metric 1 Metric 2 Next hop AS path
	* 10.0.0.1/32 D 0 >lo0.16385
	* 10.0.0.16/32 D 0 >lo0.16385

You may wonder how the router has any addresses in its routing tables when no routing protocols are running and you haven't configured any static routes. When you configure interfaces, the JUNOS software automatically puts routes in the routing table. For the routing-table examples in this recipe, the following interfaces and interface addresses are configured:

	aviva@RouterA> show configuration interfaces
	fe-0/0/0 {
	 unit 0 {
	 family inet {
	 address 10.0.16.1/24;
	 }
	 family iso;
	 family inet6 {
	 address 9009:1::1/64;
	 }
	 }
	}
	se-0/0/3 {
	 unit 0 {
	 family inet {
	 address 10.0.21.1/24;
	 }
	 family iso;
	 family inet6 {
	 address 9009:1::3/64;
	 }
	 }
	}
	lo0 {
	 unit 0 {
	 family inet {
	 address 192.168.42.1/32;
	 }
	 family iso {
	 address 49.0020.1921.6804.2001.00;
	 }
	 family inet6 {
	 address feee::10:255:71:4/128;
	 }
	 }
	}

Looking at the inet.0 routing table, you see it contains entries for each of these interfaces and for the subnetworks (the /24 address) to which they are connected:

	10.0.16.0/24 *[Direct/0] 5d 17:37:05
	 > via fe-0/0/0.0
	10.0.16.1/32 *[Local/0] 1w0d 15:51:30
	 Local via fe-0/0/0.0
	10.0.21.0/24 *[Direct/0] 1w0d 17:32:48
	 > via se-0/0/3.0
	10.0.21.1/32 *[Local/0] 1w0d 17:32:53
	 Local via se-0/0/3.0
	192.168.42.1/32 *[Direct/0] 5d 18:02:37
	 > via lo0.0

This output shows entries for the three configured interfaces. For fe-0/0/0, there is an entry for the interface itself (10.0.16.1/32) and an entry for a summary of all the addresses on the subnetwork (10.0.16.0/24). There are similar entries for the serial interface. A route to the loopback address, 192.168.42.1/32, which is the address of the router itself, is also included.

The opening lines of the show route output always indicate the number of hidden routes in a routing table. Because the routes are hidden, they are not listed in this output:

	aviva@reflector> show route
	inet.0: 163481 destinations, 163481 routes (163479 active, 0 holddown, 2 hidden)
	+ = Active Route, - = Last Active, * = Both

Hidden routes are prefixes that cannot be used for routing. These routes have been rejected by an inbound routing policy (a policy applied with a set import command), they may have an unresolvable next hop, or there may be a forwarding-table export filter that keeps them from being used. Hidden routes can never become the active route even if they are the best path toward a destination, so they can never be installed in the forwarding table. Hidden routes are marked as Unusable in the routing table:

	aviva@Router3> show route hidden table inet.0
	inet.0: 168242 destinations, 168253 routes (168240 active, 0 holddown, 2 hidden)
	+ = Active Route, - = Last Active, * = Both
	3.0.0.0/8 [BGP/170] 00:05:20, MED 0, localpref 100, from 172.158.5.125
	 AS path: 65500 65510 I
	 Unusable
	172.16.10.0/24 [BGP/170] 00:05:20, MED 0, localpref 100, from 172.158.5.125
	 AS path: I
	 Unusable

To find out why the route is unusable, get more details about it:

	aviva@Router3> show route hidden 172.16.0.0/24 extensive
	inet.0: 168242 destinations, 168253 
routes (168240 active, 0 holddown, 2 hidden)
	172.16.10.0/24 (1 entry, 0 announced)
	 BGP Preference: 170/-101
	 Next hop type: Unusable
	 Next-hop reference count: 1
	 State: 
	 Local AS: 65000 Peer AS: 65000
	 Age: 6:59 Metric: 0
	 Task: BGP_65000.172.158.5.125+25464
	 AS path: I
	 Communities: 65500:340
	 Localpref: 100
	 Router ID: 172.158.5.125
	 Indirect next hops: 1
	 Protocol next hop: 192.168.251.1
	 Indirect next hop: 0 -

The Next hop type: Unusable line of the output indicates that the route has been hidden because the next hop is unreachable. To find out why it's unreachable, check the network topology and network links. Consult the routing table for a route covering the next hop. If that route is not resolved, check that route's next hop. Recurse until you get to a directly connected next hop. Then determine whether the directly connected next hop's interface and address are up and reachable. Making this determination may require diagnosing the health of Layer 2 and Layer 1 connectivity.

Prefixes that have no active routes are marked as inactive:

	aviva@Router3> show route inactive-prefix table inet.0
	inet.0: 163307 destinations, 163307 routes (163305 active, 0 holddown, 2 hidden)
	+ = Active Route, - = Last Active, * = Both
	127.0.0.1/32 [Direct/0] 5w1d 23:32:04
	 > via lo0.0
	207.16.0.0/14 [BGP/170] 4d 01:53:05, localpref 100, from 207.17.136.29
	 AS path: 14203 2914 701 I
	 Unusable

The inactive prefixes do not have an asterisk at the beginning of the second column of output. In this case, the inactive and hidden routes are the same, but this is just a coincidence. For both prefixes, the routing table has no active route that will reach either destination.

See Also

Recipes 14.2, 14.7, and 15.2


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



JUNOS Cookbook
Junos Cookbook (Cookbooks (OReilly))
ISBN: 0596100140
EAN: 2147483647
Year: 2007
Pages: 290
Authors: Aviva Garrett

Flylib.com © 2008-2020.
If you may any questions please contact us: flylib@qtcs.net