published: 8th of September 2020
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.
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.
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.
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.
R1(tcl)#tclquit
R1#
https://www.tcl.tk/about/language.html
https://www.theroutingtable.com/cisco-tcl-ping-script/
https://community.cisco.com/t5/routing/ping-sweep-on-router/td-p/1464525