Some TCL code, some of it I hacked (thanks to Google et-al). Some from trainings or my bootcamp:

This piece of TCL will ping a destination address using all available source addresses on the router:
proc ping_all {ip} {
if {[regexp "(!!)" [exec "ping $ip"]]} {

set counter 0
exec "term len 0"
set int [exec "show ip int brief"]
set length [llength $int]

puts "Djerk's amazing connectivity script..."
puts "Pinging $ip from all available source addresses"

while {$counter<=$length} {
set tmp [lindex $int $counter]

if {[regexp "(^\[0-9]+\.\[0-9]+\.\[0-9]+\.\[0-9]+)" $tmp ]} {
puts "\n"
puts "*** Ping from [lindex $int [expr $counter - 1]] ***"
exec "ping $ip source $tmp repeat 3 timeout 1"
incr counter
} else {
puts "\n\n"
puts "IP address $ip is not reachable\n"
set route [exec "show ip route $ip"]
puts "Output from the show ip route command\n"
puts "[exec "show ip route $ip"]"
exec "term len 24"

Example of use:

This TCL script will ping all hard codes destinations:
foreach address {
} {
ping $address

Parameters can be given, example: +>} { ping $i repeat 3 timeout 1 }

%d bloggers like this: