TCL PING SCRIPT

Network Administrator need to perform a lot of repetitive activities in network like ping multiple IPs to check their availability. These activities are time consuming and tiring too. Good news – This all can be done at one go. As from Cisco IOS 12.2(25) , TCL scripting has been made part of cisco IOS . All one needs is the basics – To access the tcl command line in Cisco router issue the “tclsh” command. For the ping script just modify the ip addresses what is shown below and it should be good.

Note – in below case , we are trying to ping 5 IP addresses.


foreach address {
1.1.1.1
2.2.2.2
3.3.3.3
4.4.4.4
5.5.5.5
} { puts [ exec "ping $address” ] }

The word “address” here is just a variable, you can substitute this with anything you want. Now lets try applying this to the Cisco router.

R1(tcl)#foreach address {
+>(tcl)#1.1.1.1
+>(tcl)#2.2.2.2
+>(tcl)#3.3.3.3
+>(tcl)#4.4.4.4
+>(tcl)#5.5.5.5
+>(tcl)#} { puts [ [ exec "ping $address” ]ype escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 60/66/76 msType escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 64/64/68 msType escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 32/62/92 msType escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 4.4.4.4, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 40/55/64 ms

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 5.5.5.5, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 32/62/92 ms

That’s it!!! Isn’t this simple and helpful ? Infact many CCIE candidates also use this script to save on time . One can try this on GNS3 or dynamips lab and test the output. All the best !!!

Please follow and like us:
error

Tags:

Related Posts

Add Comment

Social Media Auto Publish Powered By : XYZScripts.com
Select your currency
USD United States (US) dollar

Checkout : E-STORE for latest release "CISCO IPS & IDS Interview Q&A " Dismiss