Suppose I want to determine if an IP is located in my country, without a third-party servvice. Could I estimate that to a certain degree by measuring ping times? Or is it better to look at the number of hops in the trace route? Or something else?

  • Use the max mind geolocation service if you want to know if traffic is sourced from your country. It’s not 100% accurate but it is mighty good. Jan 13, 2019 at 15:20

4 Answers 4


Not really.

Yes there is certainly a correlation between ping time and distance. However there are many factors other than distance that can lead to a high ping. Congestion, crappy routing, Satellite links etc.

So attempting to use ping time as a geoblocking measure is likely to have an unacceptably high false positive rate.


Short answer: No.

Long answer: IP addresses aren't determined by geographical reason insomuch as the geographical region simply might only have a certain block assigned to it.

Example: North Korea has a relatively small block of IP addresses, which makes it easy to tell when someone from that country has visited your website.

In the case of the USA, France, Germany, South Korea, Japan or others, the number of IP blocks assigned to their ISPs is much greater, so simply glancing at an IP to see if it starts with a certain number won't necessarily guarantee that that entire network is assigned to a single geographical region.

With regards to ping times, ping time is determined by a great number of factors, including but not limited to:

    - Number of routers between you and the target you are pinging
    - Networking problems in-between you and the target
    - Excessive traffic / congestion between you and the target

Example: I can ping Google's root DNS server from my home internet and get about 40ms, through 12 (!) hops, yet I get a under-1ms ping to from another location in the same city, from a different ISP, on a faster connection, through only four hops.

  • 1
    And speed of the links between targets. An IP address is not a location (anymore than it is a person); ip geolocation is a voodoo science -- a very poor guess on the best of days. Just because an address was assigned by RIPE to a company in Sweden, doesn't mean it cannot be announced from a router physically in Texas.
    – Ricky
    Mar 11, 2015 at 0:13
  • 1
    btw, google dns is a bad example. odds are you aren't pinging the same machine from both locations.
    – Ricky
    Mar 11, 2015 at 0:17
  • Ricky Beam's points are spot on: I should've used a different IP address as an example. Mar 11, 2015 at 16:37

Ping time is directly related to maximum cable length the signal can go until it reaches destination IP. Formula for calculating maximum cable length in km by ping time is: ((latency_in_ms÷1000÷2)×3×10^8)÷1000 [km] So if your ping command for example displays a 2.18 ms ping, then this means that signal could travel at maximum 327 km through cable until destination. But this is just an upper-limit of cable length. In reality there are a lot of different factors which affects signal round-trip time. For example signal in fiber optics experiences less signal loss than in copper wires, so in fiber wires it is needed much smaller amount of signal amplifiers,- which may induce additional latency too. Damaged cables, bandwidth load in line and etc, etc. And thus real cable length penetrated by signal in half-time of ping is much smaller, because signal "feels" resistance of many kinds.


If it goes by satellite then like 22000 miles * 2 one way is like 44000/186282.4 or like 236 milliseconds at least since macines are more like 50%c you can expect one way times to be greater. then if the pings are shorter it can not be going by satellite, something funny is going on. :-O

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.