Displaying the Routes in the Forwarding Table

Problem

You want to see the routes that RPD has installed in the forwarding table and that the router is actually using to forward packets.

Solution

Use the show route forwarding-table command to see the active routes in the Routing Engine's forwarding table:

aviva@RouterA> show route forwarding-table Routing table: inet Internet: Destination Type RtRef Next hop Type Index NhRef Netif default user 1 0:10:db:ff:20:80 ucst 335 3 fe-0/0/0.0 default perm 0 rjct 14 1 10.17.214.0/26 intf 0 rslv 329 1 fe-0/0/1.0 10.17.214.0/32 dest 0 10.17.214.0 recv 327 1 fe-0/0/1.0 10.17.214.27/32 intf 0 10.17.214.27 locl 328 2 10.17.214.27/32 dest 0 10.17.214.27 locl 328 2 10.17.214.63/32 dest 0 10.17.214.63 bcst 320 1 fe-0/0/1.0 172.19.121.0/24 intf 0 rslv 326 1 fe-0/0/0.0 172.19.121.0/32 dest 0 172.19.121.0 recv 324 1 fe-0/0/0.0 172.19.121.1/32 dest 0 0:10:db:ff:20:80 ucst 335 3 fe-0/0/0.0 172.19.121.113/32 intf 0 172.19.121.113 locl 325 2 172.19.121.113/32 dest 0 172.19.121.113 locl 325 2 172.19.121.142/32 dest 0 0:5:85:ca:dd:60 ucst 336 1 fe-0/0/0.0 172.19.121.255/32 dest 0 172.19.121.255 bcst 323 1 fe-0/0/0.0 192.168.10.7/32 intf 0 192.168.10.7 locl 330 1 224.0.0.0/4 perm 0 mdsc 13 1 224.0.0.1/32 perm 0 224.0.0.1 mcst 9 1 255.255.255.255/32 perm 0 bcst 10 1 Routing table: __juniper_private1__.inet Internet: Destination Type RtRef Next hop Type Index NhRef Netif default perm 0 rjct 46 1 10.0.0.1/32 intf 1 10.0.0.1 locl 321 2 10.0.0.16/32 intf 0 10.0.0.16 locl 322 1 224.0.0.0/4 perm 0 mdsc 45 1 224.0.0.1/32 perm 0 224.0.0.1 mcst 41 1 255.255.255.255/32 perm 0 bcst 42 1 Routing table: iso ISO: Destination Type RtRef Next hop Type Index NhRef Netif default perm 0 rjct 38 1 Routing table: inet6 Internet6: Destination Type RtRef Next hop Type Index NhRef Netif default perm 0 rjct 22 1 ff00::/8 perm 0 mdsc 21 1 ff02::1/128 perm 0 ff02::1 mcst 17 1 Routing table: __juniper_private1__.inet6 Internet6: Destination Type RtRef Next hop Type Index NhRef Netif default perm 0 rjct 54 1 ff00::/8 perm 0 mdsc 53 1 ff02::1/128 perm 0 ff02::1 mcst 49 1 Routing table: mpls MPLS: Destination Type RtRef Next hop Type Index NhRef Netif default perm 0 dscd 28 1

To see the forwarding entries that the PFE uses to forward packets, you must use the show pfe route command:

aviva@RouterA> show pfe route ip IPv4 Route Table 0, default.0, 0x0: Destination NH IP Addr Type NH ID Interface --------------------------------- --------------- -------- ----- --------- default 172.19.121.1 Unicast 335 fe-0/0/0.0 10.17.214.0/26 Resolve 329 fe-0/0/1.0 10.17.214.0 10.17.214.0 Receive 327 fe-0/0/1.0 10.17.214.27 10.17.214.27 Local 328 10.17.214.63 Bcast 320 fe-0/0/1.0 172.19.121/24 Resolve 326 fe-0/0/0.0 172.19.121.0 172.19.121.0 Receive 324 fe-0/0/0.0 172.19.121.1 172.19.121.1 Unicast 335 fe-0/0/0.0 172.19.121.113 172.19.121.113 Local 325 172.19.121.142 172.19.121.142 Unicast 336 fe-0/0/0.0 172.19.121.255 Bcast 323 fe-0/0/0.0 192.168.10.7 192.168.10.7 Local 330 224/4 MDiscard 13 224.0.0.1 Mcast 9 255.255.255.255 Bcast 10 IPv4 Route Table 1, __juniper_private1__.1, 0x2: Destination NH IP Addr Type NH ID Interface --------------------------------- --------------- -------- ----- --------- default Reject 46 .local..1 10.0.0.1 10.0.0.1 Local 321 .local..1 10.0.0.16 10.0.0.16 Local 322 .local..1 224/4 MDiscard 45 .local..1 224.0.0.1 Mcast 41 .local..1 255.255.255.255 Bcast 42 .local..1

 

Discussion

Both the Routing Engine and the PFE maintain forwarding tables. The one on the Routing Engine contains the active routes that have been installed by RPD, and the show route forwarding-table command displays its contents. This command is similar to the FreeBSD netstat -rn command. The Routing Engine's kernel copies this table to the PFE. The PFE's forwarding table maps each next-hop router IP address with the physical interface through which that router is reached. The show pfe route command displays the contents of this forwarding table.

The show route forwarding-table output shows routes from all routing tables, so it includes IPv4, IPv6, ISO, and MPLS routes, as well as routes from the internal JUNOS routing table. The output in this recipe shows sections for each type of routing table. You can also look at just the forwarding table for one of the routing families:

aviva@RouterA> show route forwarding-table family ? Possible completions: inet IP version 4 (IPv4) inet6 IP version 6 (IPv6) iso International Standards Organization protocol mpls Multiprotocol Label Switching tnp Trivial Network Protocol unix UNIX

The Destination column in each section lists network-layer addresses on which the router is forwarding traffic, and the last column, Netif, shows the interfaces that are being used to send traffic toward those addresses.

The Next hop column lists the next hop to the destination. If you compare the inet routing-table entries in the forwarding table to the entries in the routing table (see Recipe 8.1), which has routes to the interface addresses 10.0.16.0/24, 10.0.16.1/32, 10.0.21.0/24, and 10.0.21.1/32, and to the router (loopback) address 192.168.42.1/ 32, the forwarding table contains entries to reach all these destinations.

The first Type column immediately gives an indication of how the route was placed into the routing table. perm are permanent routes installed by the JUNOS kernel when the routing table is initialized, intf are routes learned when an interface was configured, and dest are remote addresses that are directly connected to an interface. When a routing protocol is running on the router, you also see the type ucst. Here, you see a route learned by IS-IS:

aviva@RouterA> show route 10.0.1.0/24 inet.0: 9 destinations, 9 routes (9 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 10.0.1.0/24 *[IS-IS/15] 00:11:07, metric 20 > to 10.0.16.2 via fe-0/0/0.0 aviva@RouterA> show route forwarding-table destination 10.0.1.0/24 Routing table: inet Internet: Destination Type RtRef Next hop Type Index NhRef Netif 10.0.1.0/24 user 0 10.0.16.2 ucst 337 5 fe-0/0/0.0

A route that is unreachable is marked iddn if the interface to that destination is down.

The Next hop column is the address used to reach the next hop toward the destination, and the second Type column gives more information about the next hop. The last column shows the router's interface that will be used to send traffic toward the destination.

The actual forwarding tables that the router is using to forward traffic are in the PFE, so instead of a show route command, use a show pfe command to see the contents. Unlike the show route forwarding-table command, the show pfe route command lets you see only one forwarding table at a time:

aviva@RouterA> show pfe route ? Possible completions: inet6 Show IP version 6 routing tables ip Show IP version 4 routing tables mpls Show Multiprotocol Label Switching routing table summary Show summary version of routing tables

The PFE has three tables, one each for IPv4, IPv6, and MPLS routes. All tables have a similar format and contents. The output in this recipe is for the IPv4 forwarding table. For each destination, the forwarding table shows the IP address of the next type, the type of route, and the interface out which traffic will be sent, which is pretty much the same information as in the Routing Engine's forwarding table.

You can also look at the entries for a particular destination:

aviva@RouterA> show route forwarding table destination 10.17.214.0/32 Routing table: inet Internet: Destination Type RtRef Next hop Type Index NhRef Netif 10.17.214.0/32 dest 0 10.17.214.0 recv 327 1 fe-0/0/1.0 aviva@RouterA> show pfe route ip prefix 10.17.214.0/32 IPv4 Route Table 0, default.0, 0x0: Destination NH IP Addr Type NH ID Interface --------------------------------- --------------- -------- ----- --------- 10.17.214.0 10.17.214.0 Receive 327 fe-0/0/1.0

Категории