Cisco Tcl script to ping list of IPs

Here is a sample Tcl script to ping list of IPs

 

Cisco_script# tclsh

Cisco_script(tcl)# foreach IP {   <— "IP" can be changed to any value.

+> 1.1.1.1

+>2.2.2.2

+>3.3.3.3

+> } { ping $IP }

 

Another example

 

 Router(tcl)#foreach IP {

+>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 vrf a $IP repeat 2 ]" }


Leave a Reply