cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
770
Views
13
Helpful
4
Replies

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

bruce.porter
Level 1
Level 1

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

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.

View solution in original post

4 Replies 4

umedryk
Level 5
Level 5

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 }

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

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.

Worked as advertised. thx

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: