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
?
Best Answer
You can look at routes in multiple ways.
The
show ip rib route
command shows what's in the RIB likeshow ip route
, and I suppose it depends on the IOS version, but I seeshow ip rib route
output on single lines whereshow ip route
shows output on two lines.The
show ip cef
command shows what's in the FIB, in a very compressed format, justPrefix Next Hop Interface
.