Simple Tcl Script Ping Test
You can use a simple Tcl script to test connectivity between your devices:
foreach address {For example:
x.x.x.x
x.x.x.x
x.x.x.x} { ping $address
}
R1#tclshType “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.
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#
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#tclshI 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.
r1(tcl)#conf t
Enter configuration commands, one per line. End with CNTL/Z.
r1(config)#^Z
r1# <- still in Tcl shell!!!
Command Reference
Cisco IOS Scripting with Tcl
TCL’ing Your Cisco Router
Network Bulls
Best Institute for CCNA CCNP CCSP CCIP CCIE R&S, CCIE Security Training in India
www.networkbulls.com
M-44, Old Dlf, Sector-14
Gurgaon, Haryana, india
0 comments:
Post a Comment