Intro

TCL is a simple programming language that you can use on Cisco IOS devices. This is just a quick post to demonstrate how to run a pingsweep on a Cisco IOS device using TCL.

To enter the TCL shell use the tclsh command.

ios
R1#tclsh
R1(tcl)#

A simple foreach can be used to ping a few addresses. This can become quite tedious if you have a large subnet block to loop through though.

tcl
foreach address {
  1.1.1.1
  4.4.4.4
  8.8.8.8
  9.9.9.9} { ping $address
}

The following snippet can be used to loop through a subnets IPs and ping each one. The subnet 10.102.254.0/24 is used for the below example.

tcl
for {set i 1} {$i <= 254} {incr i} {
  set var 10.102.254.
  append var $i
  ping $var rep 3 time 1}
}

To exit the TCL shell use the tclquit command.

ios
R1(tcl)#tclquit
R1#
# cisco