CCIE Pursuit Blog

April 21, 2007

Simple Tcl Script Ping Test

Filed under: Cisco,IOS,Tech Tips — cciepursuit @ 10:24 am

You can use a simple Tcl script to test connectivity between your devices:

foreach address {
x.x.x.x
x.x.x.x
x.x.x.x} { ping $address
}

For example:

R1#tclsh
R1(tcl)#foreach address {
+>(tcl)#172.12.23.2
+>(tcl)#172.12.23.3
+>(tcl)#172.12.23.4
+>(tcl)#172.12.23.6
+>(tcl)#172.12.23.7
+>(tcl)#} { ping $address re 10 si 1500
+>(tcl)#}

Type escape sequence to abort.
Sending 10, 1500-byte ICMP Echos to 172.12.23.2, timeout is 2 seconds:
!!!!!!!!!!
Success rate is 100 percent (10/10), round-trip min/avg/max = 4/4/4 ms
Type escape sequence to abort.
Sending 10, 1500-byte ICMP Echos to 172.12.23.3, timeout is 2 seconds:
!!!!!!!!!!
Success rate is 100 percent (10/10), round-trip min/avg/max = 4/4/4 ms
Type escape sequence to abort.
Sending 10, 1500-byte ICMP Echos to 172.12.23.4, timeout is 2 seconds:
……….
Success rate is 0 percent (0/10)
Type escape sequence to abort.
Sending 10, 1500-byte ICMP Echos to 172.12.23.6, timeout is 2 seconds:
!!!!!!!!!!
Success rate is 100 percent (10/10), round-trip min/avg/max = 1/1/4 ms
Type escape sequence to abort.
Sending 10, 1500-byte ICMP Echos to 172.12.23.7, timeout is 2 seconds:
!!!!!!!!!!
Success rate is 100 percent (10/10), round-trip min/avg/max = 1/3/4 ms
R1(tcl)#tclquit
R1#

Type “tclsh” to enter the Tcl shell.  You can see that you can add extended commands to the ping command (repeat 10 size 1500 in this case).  I included IP address 172.12.23.4 to show the output when a ping is not successful. 

Be sure to type “tclquit” after the script has run.  Usually you will see the “(tcl)” at the command prompt, but I have seen that disappear even though you are STILL in the Tcl shell.  This has happened to me when I go into config mode from Tcl shell.  After [cntrl + z] I exit out to the command prompt, but the “(tcl)” does not show:

r1#tclsh
r1(tcl)#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
r1(config)#^Z
r1# <- still in Tcl shell!!!

I generally keep a copy of the Tcl script in a text file so that I can just paste it into the router to test connectivity at any time.  The extra time it takes to create/modify the text file is much less than the time it would take to type “ping x.x.x.x” for each device.  You are also less likely to forget a device.

Command Reference

Cisco IOS Scripting with Tcl

TCL’ing Your Cisco Router

About these ads

3 Comments »

  1. I’m preparing for my second CCIE R&S Lab.
    Do these study LABs work for the Lab exam?

    If so, what is the cost for a good CCIE R&S study Lab?
    I need all the help I can get. Which CCIE WorkBooks is the best?

    Comment by Robert Seals — June 28, 2007 @ 10:25 am | Reply

  2. [...] Test on 3550/60 Switches A simple TCL script can be invaluable for testing connectivity in the CCIE lab.  It turns out that the 3550 and 3560 [...]

    Pingback by Ping Test on 3550/60 Switches « CCIE Pursuit — August 27, 2007 @ 10:42 am | Reply

  3. try internetworkexpert.com workbooks i use WBIII they are great.

    Comment by Santiago Enciso — June 26, 2009 @ 9:30 pm | Reply


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

The Rubric Theme. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

Join 114 other followers

%d bloggers like this: