The “show ip interface” command I've always wanted to have

Recently I was investigating MTU-related problems and got mightily upset when I had to search for the interface IP MTU size in the long printout produced by the show ip interface command. Obviously I could display the IP MTU size of a single interface with the show ip interface name | include MTU filter, but I wanted to have a nice tabular printout. Obviously it was time for another Tcl script.

To use it, download it and store it into the flash memory of your router. Configure alias exec ipconfig tclsh flash:ipInterfaces.tcl and you can use ipconfig or ipconfig active to display interface IP addresses. Included below are sample printouts:
ro#ifconfig
Interface IP Address Mask MTU State
=================================================================
FastEthernet0/0 172.18.25.1 255.255.255.0 1500 up
FastEthernet0/1 no address admin down
Serial0/0/0 no address up
Serial0/0/0.101 192.168.201.2 255.255.255.252 1500 up
Serial0/1/0 no address up/down
Serial0/1/1 no address down
Tunnel0 FastEthernet0/0 1476 up

ro#ifconfig active
Interface IP Address Mask MTU State
=================================================================
FastEthernet0/0 172.18.25.1 255.255.255.0 1500 up
Serial0/0/0.101 192.168.201.2 255.255.255.252 1500 up
Tunnel0 FastEthernet0/0 1476 up

5 comments:

  1. Hm. this didn't quite work for me on IOS 12.4(11)T:

    a) the netmask is shown as "/24" in my "show ip interface" output rather than "255.255.255.0" that the script looks for (perhaps you'd changed your terminal settings with a "terminal ip netmask-format decimal"?) so I changed the regexp string to

    {internet address is ([0-9.]+)/([0-9.]+)?}

    b) on the line with an unnumbered interface, it says "Interface is unnumbered. Using address of NVI0 (0.0.0.0)" on my router(s) whereas the script is looking for something like "Using address 0.0.0.0" instead. so change the regexp string to

    {Using address of .* \((\S+)\)}

    anyway, hopefully this helps anybody else if they're having trouble.

    thanks for the tip though, and all the others - they're great reading! thanks, too, for confirming my theory that the ip dns view stuff is busted. now, if only the post-12.4(11)T release would turn up - it's been months!

    cheers,
    cos.
  2. cool stuff.

    hackathology
  3. Somehow I've missed the address/prefix format (I have to check why I'm getting the address mask printout). Thanks for the fix, when I find some time, I'll integrate it with my code to have a script that works regardless of IP address format.

    The other regexp was deliberate - if I have unnumbered interface, I wanted to see the name of the other interface (but, with your fix, you could see the IP address instead). I'll integrate your regexp into the code and make it conditional (so you could see one or the other).

    Thanks for the fixes :)
    Ivan
  4. Looks nice, the format output reminds me of the output from Alcatel switch.
Add comment
Sidebar