Cisco – display ALL routes using a single command

cisco-commandscisco-ios-12

In Junos when you use a show route it displays the routing tables , starting with inet.0 ( global routing table) and then listing each VRF in alphabetic order.

I am after a similar command , for the following reason , new WAN deployment: remote engineer to verify VRF connectivity without plugging in the LAN, therefore I want to list the mandatory routes that are mandatory in each VRF ( e.g. 0/0 ).

I know I can achieve this with show ip bgp vpnv4 all but this does not display the global routing table , and that is currently used for management.

in Junos I would run show route 0/0 which would display all occurrences of the specified route in every VRF across the device including inet.0

iank@r1> show route 0/0 exact terse 

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

A Destination        P Prf   Metric 1   Metric 2  Next hop        AS path
* 0.0.0.0/0          B 170        100          0 >172.31.30.2     64512 I

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

A Destination        P Prf   Metric 1   Metric 2  Next hop        AS path
* 0.0.0.0/0          B 170        100            >172.31.7.2      64999 I

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

A Destination        P Prf   Metric 1   Metric 2  Next hop        AS path
* 0.0.0.0/0          B 170        100            >172.31.12.2     64999 I

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

A Destination        P Prf   Metric 1   Metric 2  Next hop        AS path
* 0.0.0.0/0          B 170        100            >172.31.3.2      64999 I

am I missing a really obvious way of achieving this ?

Best Answer

show ip route vrf * displays the global routing table plus all the VRF instances.

sh ip route vrf * 0.0.0.0 displays the default route for each VRF.

This shows the default route for each VRF, including the default VRF. As this IOS 12.4 doesn't show the VRF name when displaying a matching route, a route tag was added on the static routes to help identify their VRF.

r1#show ip route vrf * 0.0.0.0

Routing entry for 0.0.0.0/0, supernet
  Known via "static", distance 1, metric 0, candidate default path
  Tag 100
  Routing Descriptor Blocks:
  * 192.0.2.2
      Route metric is 0, traffic share count is 1
      Route tag 100

Routing entry for 0.0.0.0/0, supernet
  Known via "static", distance 1, metric 0, candidate default path
  Tag 200
  Routing Descriptor Blocks:
  * 192.0.2.2
      Route metric is 0, traffic share count is 1
      Route tag 200

Showing longer-prefixes on your matching route will show the VRF names. `sh ip route vrf * 192.0.2.0 longer-prefixes'.