Network technologies and trends

Jul 27 2010   8:31AM GMT

Using TCL scripts to test connectivity of hosts in a Cisco device

Yasir Irfan Yasir Irfan Profile: Yasir Irfan

In my last post I talked about how to enable and disable the Tool command Language (TCL) in a Cisco router or a Cisco Catalyst Switch, suppose if you want to use a ping command for more than 50 hosts,you don’t need to ping each and every single host from the Cisco router or a Cisco Catalyst Switch, in this scenario you can make use of TCL scripts, I will provide you a sample script to ping 10 hosts at a time from a Cisco Catalyst 6506 E Switch, same script is applicable to Cisco routers as well.

Step 1

Enable TCL in your Cisco router or a Cisco Switch by using a “tclsh” command

ITKE-SW01#tclsh

Step 2

Write to script to ping hosts starting from 10.0.0.1 to 10.0.0.10 using the following script, start the script by using “foreach VAR {” followed by the IP Address of the hosts you want to ping and close the script by using following stings “} { puts [exec “ping $VAR”] }” as demonstrated below ( you can use notepad to prepare the script and then execute in your Cisco device)

foreach VAR {

10.0.0.1

10.0.0.2

10.0.0.3

10.0.0.4

10.0.0.5

10.0.0.6

10.0.0.7

10.0.0.8

10.0.0.9

10.0.0.10

 

} { puts [exec “ping $VAR”] }

 

Once you enter the script you will the following

TCL scripts are very helpful and really it automates some of our tasks.

[kml_flashembed movie="http://www.youtube.com/v/PcF8EdmfdoM" width="425" height="350" wmode="transparent" /]

 Comment on this Post

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

Share this item with your network: