I know that most of you already know this feature. I needed today but didn’t remember exactly how it was so I had to review some information. As I don’t want to forget it again nor have to surf the web to find it I create this post.

Here is the script to test reachability to some/many/various devices without the need to insert the same command once, twice and so on…

tclsh  
 foreach ip {  
 10.210.141.99  
 10.210.141.100  
 10.210.141.101  
 10.210.141.102  
 10.210.141.103  
 10.210.141.104  
 10.210.141.105  
 10.210.141.106  
 10.210.141.107  
 10.210.141.108  
 10.210.141.110  
 10.210.141.112  
 10.210.141.114  
 10.210.141.116  
 10.210.141.118  
 10.210.141.119  
 10.210.141.120  
 10.210.141.121  
 10.210.141.122  
} {ping $ip}

And as a result this is what we get:

SW(tcl)#foreach ip {  
 +>10.210.141.99  
 +>10.210.141.100  
 +>10.210.141.101  
 +>10.210.141.102  
 +>10.210.141.103  
 +>10.210.141.104  
 +>10.210.141.105  
 +>10.210.141.106  
 +>10.210.141.107  
 +>10.210.141.108  
 +>10.210.141.110  
 +>10.210.141.112  
 +>10.210.141.114  
 +>10.210.141.116  
 +>10.210.141.118  
 +>10.210.141.119  
 +>10.210.141.120  
 +>10.210.141.121  
 +>10.210.141.122  
 +>} {ping $ip}  
 Type escape sequence to abort.  
 Sending 5, 100-byte ICMP Echos to 10.210.141.99, timeout is 2 seconds:  !!!!!  
 Success rate is 100 percent (5/5), round-trip min/avg/max = 1/8/16 ms  
 Type escape sequence to abort.  
 Sending 5, 100-byte ICMP Echos to 10.210.141.100, timeout is 2 seconds:  !!!!!  
 Success rate is 100 percent (5/5), round-trip min/avg/max = 1/3/8 ms  
 Type escape sequence to abort.  
 Sending 5, 100-byte ICMP Echos to 10.210.141.101, timeout is 2 seconds:  !!!!!  
 Success rate is 100 percent (5/5), round-trip min/avg/max = 1/7/16 ms  
 Type escape sequence to abort.  
 Sending 5, 100-byte ICMP Echos to 10.210.141.102, timeout is 2 seconds:  …..  
 Success rate is 0 percent (0/5)  
 Type escape sequence to abort.  
 Sending 5, 100-byte ICMP Echos to 10.210.141.103, timeout is 2 seconds:  !!!!!  
 Success rate is 100 percent (5/5), round-trip min/avg/max = 1/8/17 ms  
 Type escape sequence to abort.  
 Sending 5, 100-byte ICMP Echos to 10.210.141.104, timeout is 2 seconds:  !!!!!  
 Success rate is 100 percent (5/5), round-trip min/avg/max = 1/10/17 ms  
 Type escape sequence to abort.  
 Sending 5, 100-byte ICMP Echos to 10.210.141.105, timeout is 2 seconds:  !!!!!  
 Success rate is 100 percent (5/5), round-trip min/avg/max = 1/5/9 ms  
 Type escape sequence to abort.  
 Sending 5, 100-byte ICMP Echos to 10.210.141.106, timeout is 2 seconds:  !!!!!  
 Success rate is 100 percent (5/5), round-trip min/avg/max = 1/5/17 ms  
 Type escape sequence to abort.  
 Sending 5, 100-byte ICMP Echos to 10.210.141.107, timeout is 2 seconds:  !!!!!  
 Success rate is 100 percent (5/5), round-trip min/avg/max = 1/4/9 ms  
 Type escape sequence to abort.  
 Sending 5, 100-byte ICMP Echos to 10.210.141.108, timeout is 2 seconds:  !!!!!  
 Success rate is 100 percent (5/5), round-trip min/avg/max = 1/5/16 ms  
 Type escape sequence to abort.  
 Sending 5, 100-byte ICMP Echos to 10.210.141.110, timeout is 2 seconds:  !!!!!  
 Success rate is 100 percent (5/5), round-trip min/avg/max = 1/5/9 ms  
 Type escape sequence to abort.  
 Sending 5, 100-byte ICMP Echos to 10.210.141.112, timeout is 2 seconds:  !!!!!  
 Success rate is 100 percent (5/5), round-trip min/avg/max = 1/15/50 ms  
 Type escape sequence to abort.  
 Sending 5, 100-byte ICMP Echos to 10.210.141.114, timeout is 2 seconds:  !!!!!  
 Success rate is 100 percent (5/5), round-trip min/avg/max = 1/4/9 ms  
 Type escape sequence to abort.  
 Sending 5, 100-byte ICMP Echos to 10.210.141.116, timeout is 2 seconds:  !!!!!  
 Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/9 ms  
 Type escape sequence to abort.  
 Sending 5, 100-byte ICMP Echos to 10.210.141.118, timeout is 2 seconds:  !!!!!  
 Success rate is 100 percent (5/5), round-trip min/avg/max = 1/4/9 ms  
 Type escape sequence to abort.  
 Sending 5, 100-byte ICMP Echos to 10.210.141.119, timeout is 2 seconds:  !!!!!  
 Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/8 ms  
 Type escape sequence to abort.  
 Sending 5, 100-byte ICMP Echos to 10.210.141.120, timeout is 2 seconds:  !!!!!  
 Success rate is 100 percent (5/5), round-trip min/avg/max = 1/7/17 ms  
 Type escape sequence to abort.  
 Sending 5, 100-byte ICMP Echos to 10.210.141.121, timeout is 2 seconds:  !!!!!  
 Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/8 ms  
 Type escape sequence to abort.  
 Sending 5, 100-byte ICMP Echos to 10.210.141.122, timeout is 2 seconds:  !!!!!  
 Success rate is 100 percent (5/5), round-trip min/avg/max = 1/5/9 ms  
 SW(tcl)#

Just remember to exit tcl prompt so you can continue working with your device.

P.D. I know, I know, the 102 is still down…