- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2008 08:22 AM - edited 03-05-2019 08:20 PM
Does anyone know of a simple DOS batch mode or Linux script to ping a specified set of subnets with large numbers of pings? Purpose is to look for link problems not normally detected on the network-side equipment.
Solved! Go to Solution.
- Labels:
-
Other Switching
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2008 11:03 PM
Something like this would work. This script will ping every address from .1 to .254 on each of the specified subnets. It will send one ping packet to each host:
## BEGIN script
proc pingSweep { } {
set subnet "10.0"
set octets [list 1 2 3 4 5 10 11 12 13 14 15 16 17 18 19 20]
for { set i 0 } { $i < [llength $octets] } { incr i } {
for { set j 1 } { $j < 255 } { incr j } {
set addr "${subnet}.[lindex $octets $i].${j}"
ping $addr repeat 1
}
}
}
pingSweep
## END script
Router#tclsh flash:pingSweep.tcl
This assumes you save this script into the router's flash as pingSweep.tcl. You could also type all of this in once you enter tclsh in IOS.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2008 09:48 AM
The following example will ping the ip address and will send 10 packets. Like wise specify the ip addresses that needs to be pinged
Router1#tclsh
Router1(tcl)#foreach i {
10.10.10.6
} { ping $i repeat 10 }
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2008 09:54 AM
Very interesting. I take it the clsh command puts you in the tool control language. I am not familiar with tcl. Can you elaborate on how you would select, say a range of ip subnets of 10.0.1.0, and 10.0.5.0? Also 10.0.10.0 through 10.0.20.0. thx

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2008 11:03 PM
Something like this would work. This script will ping every address from .1 to .254 on each of the specified subnets. It will send one ping packet to each host:
## BEGIN script
proc pingSweep { } {
set subnet "10.0"
set octets [list 1 2 3 4 5 10 11 12 13 14 15 16 17 18 19 20]
for { set i 0 } { $i < [llength $octets] } { incr i } {
for { set j 1 } { $j < 255 } { incr j } {
set addr "${subnet}.[lindex $octets $i].${j}"
ping $addr repeat 1
}
}
}
pingSweep
## END script
Router#tclsh flash:pingSweep.tcl
This assumes you save this script into the router's flash as pingSweep.tcl. You could also type all of this in once you enter tclsh in IOS.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2008 05:12 PM
Worked as advertised. thx
