Ping Multiple Hosts from IOS (Tcl Script)

We all look for ways to make our job easier, it’s this reason a lot of people will use a GUI over the CLI, but for me it’s CLI all the way, that is probably why I love Linux and IOS so much. But, at times there lacks a feature or two you wish you could do a lot easier from the CLI, now in Linux you can pretty much script anything, most CLI wizards can knock out a shell script to do their bidding, with IOS it’s a little hard as the language of choice is Tcl, and I will have to admit there is a bit of learning curve, but some you get over that you can get a lot more out of IOS.

I constantly find myself wanting to test the liveliness of a set of addresses, so I came up with a simple and easy to use script to do just that task.

Here is an example of it testing the Google DNS servers and a private IP address that doesn’t exist.


Success rate is 66.66% (2/3)

Installing Script

If you wish, you can install the script using HTTP, like so:

R1#copy flash:mping.tcl
Destination filename [mping.tcl]?
[cut for brevity]
R1#config t
R1(config)#alias exec mping tclsh flash:mping.tcl

If you don’t want to install it over HTTP you can download it here, it’s also on the Downloads page along with other goodies.

I also have some other ideas for Tcl scripts, but have to find the time to sit down and code them, hope you enjoy the post. Let me know what Tcl scripts you use in your environment / study.

Jul 22nd, 2011 • Posted in IOS, Scripts, Tcl, Troubleshooting
No comments yet.

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>