// you’re reading...

IOS Features & Management

Verifying Connectivity Using A tcl Script

Thanks for visiting! If you're new here, you may want to subscribe to my RSS feed. This blog posts regular tutorials, news, and study tips about networking, especially about Cisco CCIE related topics. Go ahead, subscribe to the rss feed! You can also receive updates from this blog via email. Thanks for visiting!

During the CCIE lab (or in real life!) it is useful to test connectivity between all your routers. You might have just configured redistribution or completed all your IGP configuration and BGP configuration and want to make sure that you still have full connectivity. We could go to each router and systematically ping each address that we are concerned with, but this would take up an quite a bit of your time (and for the CCIE lab you really need every minute you can get). Enter tcl. Tcl is a scripting language that modern Cisco routers can utilise.

Lets have a look at a tcl script that we can use to ping all the interfaces in a lab:

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

The code above is an example of a tcl script. On the router interface, go into privilege exec mode and enter the tclsh command. This places you in a tcl mode where we can enter tcl scripts. Then cut and paste the above from something like notepad.

Router#
Router#tclsh
Router(tcl)#foreach address {
+>1.1.1.1
+>2.2.2.2
+>3.3.3.3
+>4.4.4.4
+>5.5.5.5
+>6.6.6.6
+>} { puts [ exec "ping $address" ] }

Type 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 = 1/7/12 ms

Type 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 = 1/5/12 ms

Type 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 = 4/5/8 ms

Type 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 = 4/7/8 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 = 1/4/8 ms

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 6.6.6.6, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/9/16 ms
Router(tcl)#

Then end result: we ping each address in turn listed in the script. Something like this simple script is perfect for testing connectivity in the lab (or in real life!).

For more examples of tcl scripts check this link out.

HTH.

Related posts

Discussion

One comment for “Verifying Connectivity Using A tcl Script”

  1. Very useful! Thanks heaps!

    Posted by Scott | July 2, 2007, 10:05 am

Post a comment


Twitter Feed...

Follow me...

View Arden Packeer's profile on LinkedIn Arden Packeer ClaimID Add to Technorati Favorites TwitterCounter for @ardenpackeer