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

After I've published the Tcl script that displays the interface IP parameters in a formatted table, cos quickly pointed out a bug: I've expected the IP addresses in the address mask format. In the meantime, I've figured out the root cause of the problem (our remote labs are set to display IP masks in decimal format for compatibility reasons) and fixed the Tcl script. It temporarily sets the terminal ip netmask-format to bit-count before executing the show command. The new script recognizes three parameters:

  • active: display only interfaces that are up/up;

  • configured: display only interfaces with configured IP addresses (unnumbered interfaces using IP address of an interface without one count as configured since IOS reports their IP address as 0.0.0.0).

  • address: displays IP address of the unnumbered interface, not the interface that it's borrowing the address from.
You can view the Tcl source or download it from my web site.

6 comments:

  1. great! works well here.

    watch out if you're running 12.4(15)T on an 877 with the v5 IPS stuff configured - you'll get told "Not enough free memory to launch Tcl shell" (even with 256MB!), which is a shame.

    ReplyDelete
  2. cos: it's not a shame, it's a feature. Try scripting tcl low-memory low water memory mark.

    ReplyDelete
  3. aha! thank you very much for that. I haven't yet been able to find any info on it on cisco's website, though - is there a default value, for instance?

    ReplyDelete
  4. cos: it's apparently 1/4 of the free processor memory when TCL gets initialized. Open a TAC SR if this is a concern.

    ReplyDelete
  5. Ivan,

    Just tried out this script and I've noticed that it insists on writing to the first tty no matter where it's executed from.

    Example - I put the script in and setup the alias and it works fine. I had a colleague login and when he executed the command, the output displayed on my tty. Once I logged out, he had to logout and log back in for it to work on his terminal.

    Also, is there a way to paginate the output?

    Thanks for the great tip!
    Roddie

    ReplyDelete
  6. Minor correction - It seems to be writing to the first line not TTY.

    ReplyDelete

You don't have to log in to post a comment, but please do provide your real name/URL. Anonymous comments might get deleted.

Ivan Pepelnjak, CCIE#1354, is the chief technology advisor for NIL Data Communications. He has been designing and implementing large-scale data communications networks as well as teaching and writing books about advanced technologies since 1990. See his full profile, contact him or follow @ioshints on Twitter.