Calculating distance between two computers in a local network using ping

Viewed 393

Just wondering, would it be possible to use the ping "time" to calculate the distance between two local computers / machines ?

2 Answers

Absolutely not!

Even if you're pinging two machines on the local network, the latency is highly dependent on your Internet connection and other factors other than distance from the two machines.

You could potentially see your ping deteriorate in case of work on the line, problems in the installations (which may require deviations from traffic) or if the machine you are pinging is overloaded and takes longer to reply.

Yes and no.

Network delays tend to be quite unpredictable, and clocks on general purpose computers too inaccurate to make accurate distance measurements. However, you can make some rough ones.

The speed of light in an optical fiber is around 2/3 of the speed of light (300 KM/millisecond), so around 200 KM/millisecond. Over large distances, you can use this fact to calculate a lower bound on the distance between two computers.

For example, if a ping from A to B returns in 1ms, you know for a fact that distance between the machines has to be at most 100KM. It would be physically impossible for more distant machines to ping each other in 1ms if they're connected using a fiber.

Related