Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Community Member

Ping Sweeps to test for packet loss on both router and host ends.

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Cisco Employee

Re: Ping Sweeps to test for packet loss on both router and host

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.

4 REPLIES
Silver

Re: Ping Sweeps to test for packet loss on both router and host

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 }

Community Member

Re: Ping Sweeps to test for packet loss on both router and host

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

Cisco Employee

Re: Ping Sweeps to test for packet loss on both router and host

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.

Community Member

Re: Ping Sweeps to test for packet loss on both router and host

Worked as advertised. thx

430
Views
13
Helpful
4
Replies
CreatePlease to create content