TCL (Tool Control Language) & Cisco
Somewhere during testing any successful Network Reachability,
it will be necessary to test the reachability of addresses from each device in
your network. Some people use cut and paste techniques coupled with Notepad to ping
the addresses. Unfortunately, there are numerous drawbacks to this technique. While
this sounds like a great function for cut-and-paste, it doesn't work that way.
Once you initiate one ping, the input buffer is basically ignored. So no matter
how many you have listed, you can only cut and paste one at a time. This is an
inefficient way to test large enterprise network.
Enter the world of TCL scripting! Just type "tclsh"
at your router's exec prompt to enter the TCL Shell. This is
where you will enter all the commands.
JAHIL-Router#tclsh
JAHIL-Router(tcl)#
At this point, I'm at a TCL prompt, so I can enter commands as needed.
There are many, many things that we can do within this powerful tool.
Next, let's first gather my list of IP addresses from each router or nodes.
Here's my list as an example:
10.192.1.1
10.192.2.1
10.192.3.1
10.192.4.1
Now what I will do is create a command set that can repeat itself:
JAHIL-Router(tcl)# foreach IPs {
The router will leave me at a "+>" prompt now. Cut and
paste the list of IP addresses:
+>10.192.1.1
+>10.192.2.1
+>10.192.3.1
+>10.192.4.1
Then it's time to end that list and issue a command from within the TCL
command set.
+>} {ping $IPs}
The bracket simply closes the "foreach" arguments and then I
ping that variable set.
The results are instantaneous!
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.192.1.1, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.192.2.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 32/33/36 ms
And so on….
I broke things down here to explain the steps, but you can actually paste
the entire command set at once and your router will process things just fine.
JAHIL-Router# tclsh
JAHIL-Router(tcl)# foreach IPs {
+>10.192.1.1
+>10.192.2.1
+>10.192.3.1
+>10.192.4.1
+>} {ping $IPs}
Exiting the TCL shell would probably be good, too!
JAHIL-Router(tcl)#tclq
JAHIL-Router#