# is ping such a great tool?



## fluca1978 (Dec 19, 2012)

I'm not a real fan of the ping(1) command, but at an exam I saw a teacher asking the student about such command, and what came out is something I'd like to discuss to see who is wrong.

_teacher:_ can ping be used to measure the network speed?
_student:_yes of course

I don't think so, or well, ping is not the best tool to measure the network speed, while it can be used to measure latency. Moreover, ping sends small packets, while other protocols can send bigger packets and therefore fragmentation can come into the scene. While ping has an option to specify the packet size, I see ping as the _poor man_ test command. Moreover, ICMP traffic can be blocked or filtered to avoid bursts, and therefore the latency reported/obtained from ping could be inaccurate.

Comments?


----------



## Uniballer (Dec 19, 2012)

Ping sends an "ICMP echo request", and hopes for a response, ideally "ICMP echo reply".  It is really there to test for basic connectivity, not network speed.  It might be OK for guesstimating network latency under a specific traffic load, but shouldn't really be counted on for that.  If there is no reply you rarely get any info about the reason why: dropped due to network congestion or filtering, high error rates on some part of the path, etc.  You probably can measure network speed on slow links if you can guarantee that there is no other traffic, and account for the link encapsulation, headers and any compression (not likely).

When ICMP was first defined there were essentially few/no security issues on the nascent Internet.  Now people filter ICMP to prevent Evil Hackers (tm) from gaining knowledge about the network they are probing by spoofing IP addresses (e.g. can I force packets across a VPN by spoofing a ping to the far end?), and from DOS attacks based on ICMP redirect or source quench messages.  And IP source routing?  Fuggedaboutit!


----------



## expl (Dec 19, 2012)

These days ICMP echo packets are used mainly in debugging network routing (hops) not measuring latency or bandwidth.


----------



## Crest (Dec 19, 2012)

You can use a -s and -f together to flood the network with many large packets.


----------



## bbzz (Dec 19, 2012)

Ping CAN be used to measure bandwidth delay. 
A basic answer to a basic question.



> Moreover, ping sends small packets, while other protocols can send bigger packets and therefore fragmentation can come into the scene.



Ping packets can be specified with a specific payload size, a DF bit, a ToS bits, a data pattern in the payload, a source IP/interface, a things like discovery of Q - Source quench, U - Destination unreachable PDU error, M - could not fragment, etc, validation of data such as ICMP-CRC check, things like loose source routing, strict source routing, record route and timestamp.

This all depends on platform, but then again I didn't see one mentioned specificaly.

Looks pretty useful to me for number of things.


----------



## throAU (Dec 20, 2012)

Define "speed"

ping measures latency, which is a particular measure of "speed".

edit:
And yes of course you can send larger packets.  But it is not optimal for bandwidth measurements.

Complaining that ping doesn't measure bandwidth, or doesn't do it very well is like complaining that your screwdriver doesn't drive nails very well.  It's not really what the tool was designed to do.


----------



## NewGuy (Dec 20, 2012)

The student is right. The ping command can be used to test speed and latency. Usually it isn't and it's not the best tool for the job, but it can.


----------



## Pushrod (Dec 20, 2012)

ping has limited use because of bogus "security" practices that mandate turning off anything that resembles a response; be it an ICMP ping response, a TCP closed port, etc.


----------

