3

I'm running into what should be a very easy problem to solve- I need to see all routes coming from one specific next-hop on a few cisco ASR 1002-X's that I have in my network. Normally this should be as easy as a | inc x.x.x.x filter on show ip route, but all of the output is coming up on two lines due to the length of the interface names, making the filter useless. Here is some example output:

<Router>#sh ip route 

<legend omitted>    

D*EX  0.0.0.0/0 [170/51968] via 10.x.x.58, 7w0d, GigabitEthernet0/2/0.140
      10.0.0.0/8 is variably subnetted, 294 subnets, 13 masks 
D EX     10.x.x.23/32 
           [170/5120] via 10.x.x.78, 5w1d, GigabitEthernet0/2/0.142 
D        10.x.x.0/24 
           [90/3584] via 10.x.x.58, 2w3d, GigabitEthernet0/2/0.140 
D        10.x.x.0/13 
           [90/4864] via 10.x.x.68, 7w0d, GigabitEthernet0/2/0.141 
D        10.x.x.0/30 
           [90/4608] via 10.x.x.68, 7w0d, GigabitEthernet0/2/0.141 
D        10.x.x.4/30 
           [90/5376] via 10.x.x.58, 7w0d, GigabitEthernet0/2/0.140 
D        10.x.x.253/32 
           [90/133120] via 10.x.x.58, 7w0d, GigabitEthernet0/2/0.140 
D        10.x.x.254/32 
           [90/132352] via 10.x.x.68, 7w0d, GigabitEthernet0/2/0.141 
D        10.x.x.0/14 
           [90/3328] via 10.x.x.58, 7w0d, GigabitEthernet0/2/0.140
...<etc>

No matter what I do (including increasing the terminal width to 256 chars), the output is always on two lines, removing the ability to use the pipe/inc filter. I'm aware I can redirect to file, copy to my desktop, and then start doing some manual searching via a text editor, but that is all very time-consuming when I'm in the middle of troubleshooting an issue.

Is there a way to filter a list of all routes on a router by next-hop IP, even when the next-hop IP is displayed on the second line of output of show ip route?

  • Instead of show ip route, does show ip rib route give you what you are looking for? – Ron Maupin Mar 2 '16 at 3:31
  • Unfortunately, output from 'show ip rib route` is also split onto two lines. – halfmetaljacket Mar 2 '16 at 23:25
  • When I run that command, it fits everything on a single line, even with very long GigabitEthernetx/x/x.xxx interface names. The show ip rib route shows what in the RIB, and show ip cef shows what's in the FIB, in a very compressed format, just Prefix Next Hop Interface. – Ron Maupin Mar 2 '16 at 23:30
  • Filtering on show ip cef works! That produces a much more compact list that all fits onto single lines. Post an answer and I'll accept it, thanks! – halfmetaljacket Mar 2 '16 at 23:34
  • I posted an answer. – Ron Maupin Mar 2 '16 at 23:50
1

You can look at routes in multiple ways.

The show ip rib route command shows what's in the RIB like show ip route, and I suppose it depends on the IOS version, but I see show ip rib route output on single lines where show ip route shows output on two lines.

The show ip cef command shows what's in the FIB, in a very compressed format, just Prefix Next Hop Interface.

0

Have you tried using the show ip route | sec X.X.X.X? The section option should provide more output than the single line inc option.

  • That produces the same output as using | inc x.x.x.x- it doesn't include the preceding line with the route. – halfmetaljacket Mar 2 '16 at 23:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.