Tool Command Language (TCL)

    Tcl scripting was introduced as a feature in Cisco IOS with release 12.3(2)T.  To get good use of this powerful feature, it is required that you have familiarity with Cisco IOS commands and with Tcl programming.

This tidbit is not meant to be anything more than a simple introduction to the Tcl shell in IOS.  Hopefully to whet your appetite.

To utilize the Tcl shell, enter the following IOS commands:

R1>en
R1#tcl?
tclquit  tclsh

R1#tclsh
R1(tcl)#

You can exit the shell with the shell in the typical way, and even with a special command

R1#tclsh
R1(tcl)#tclquit
R1#tclsh
R1(tcl)#exit
R1#

You can even follow up tclquit with a question mark, and it will exit the shell.

One simple useful application for the Tcl is to create a loop that iterates through commands.
A not so useful but simple example is the one right out of the CCNP labs. You could write a script to ping a list of IP addresses.

Sintax
foreach identifier {
value1
value2valuex
}{instruction} 

Example

R1#tclsh
R1(tcl)#foreach address {
10.1.1.1
10.2.2.2
}{ping $address}

If the Tool Command Language sounds intimidating start with the Tcl Tutorial everyone starts in the beginning right?  Once you feel comfortable about the idea of taking your knowledge of the IOS command line and throwing Tcl into the mix… sky is the limit.

Sayonara!

~

Gabe @ networkdojo.net

 

 

~
Resources:

Cisco IOS Scripting with Tcl
Tcl Developer Xchange

Advertisements