Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Shells Virtual Desktop
BMail.ag - Secure Email Service
Server.net
CPLicense.net
VPS Server
Buy VPN
Vultr
VMs for AI
HostDare
ReliableSite White-Label Dedicated Hosting for Resellers
InterServer VPS
BMail.ag - Secure Email Service
Best VPN
High-Performance Bare Metal Server Solutions
Karvl.com
Server Mania Cloud Hosting
DataWagon Hosting
AlphaVPS Hosting
Evoxt.com
Clouvider
VPS Hosting with NVMe
Residential IPs in the US & 4G Mobile Proxies in EU & US with Unlimited Bandwidth
ReliableSite White-Label Dedicated Hosting for Resellers
Rabisu - Hosting Solutions
Shells Virtual Desktop
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Geolocate an IP address to a location using latency

This tool is for all of you with a bunch of Globalping credits laying around

The recent ipinfo blog post inspired me to make a little tool that uses Globalping's probe network to run latency tests against any IP address and resolve it to a location.

It worked out pretty well so I wanted to share it with you https://github.com/jimaek/geolocation-tool

I also wrote an accompanying blog post if you have a few minutes to kill https://blog.globalping.io/we-have-ipinfo-at-home-or-how-to-geolocate-ips-in-your-cli-using-latency/

The tool itself is very simple, just install and run.

Important to note: There is no need to report accuracy issues, by default a limit of 50 probes per phase is set. This is enough for unauthenticated users to run the tool once, but not enough to provide accurate results. I recommend setting a limit of 250 probes for good accuracy.

geolocate 45.95.160.61 
Geolocating 45.95.160.61...

Note: A limit of 50 offers worse results. For better accuracy it is
recommended to set a limit of at least 100 probes. The higher the limit
the higher the accuracy. Best results start at 250.

Phase 1: Detecting continent...
  Measuring from 30 probes...

  [███████████████████████████████████████░]  96.7%   29/30 - Best: NA (45.47 ms)                   

  Africa: 254.18 ms
  Asia: 219.64 ms
  Europe: 115.57 ms
  North America: 45.47 ms
  Oceania: 214.11 ms
  South America: 118.31 ms

Best continent: North America (45.47 ms)

Phase 2: Detecting country...
  Measuring from 50 probes...

  [████████████████████████████████████████] 100.0%   50/50 - Best: US (0.48 ms)                    

  United States: 0.48ms
  Mexico: 25.09ms
  Canada: 42.88ms

Best country: United States (0.48ms)

Phase 3: Detecting US state...
  Measuring from 50 probes...

  [████████████████████████████████████████] 100.0%   50/50 - Best: FL (0.01 ms)                    

  Florida: 0.01ms
  Oklahoma: 0.33ms
  South Carolina: 12.46ms

Best state: Florida (0.01ms)

Phase 4: Detecting city...
  Measuring from 34 probes...

  [████████████████████████████████████████] 100.0%   34/34 - Best: Miami (0.00 ms)                 

Top 3 Locations:
─────────────────────────────────────────────────
  1. Miami, Florida, USA                      0.00 ms
  2. West Palm Beach, Florida, USA            4.57 ms
  3. Port Saint Lucie, Florida, USA           4.99 ms

═══════════════════════════════════════════════════
                      SUMMARY
═══════════════════════════════════════════════════
  Location: Miami, Florida, USA
  Minimum Latency: 0.00 ms
  Confidence: Very High
═══════════════════════════════════════════════════

And yes, this tool will eat through your credits like crazy :)

Pull requests are welcome https://github.com/jimaek/geolocation-tool

«13

Comments

  • That is pretty cool. I m lov.

  • sh97sh97 Member, Host Rep
  • olokeoloke Member, Host Rep

    Wow, this looks great.
    Thank you for sharing!

    image

  • NeoonNeoon Community Contributor, Veteran

    Any bulk option for a few million?

    Thanked by 1BasToTheMax
  • @Neoon said:
    Any bulk option for a few million?

    I mean its a question of having enough credits and time :) The how is pretty easy

  • edited December 2025

    I feel this problem can be solved with a fewer number of probes via determining the intersection of circles instead of in this hierarchical way, but I have not thought about this problem enough. Neat tool!

    Thanked by 1BasToTheMax
  • @CyberneticTitan said:
    I feel this problem can be solved with a fewer number of probes via determining the intersection of circles instead of in this hierarchical way.

    Oh yeah for sure. I'm just not smart enough to do the maths so I brute forced it

  • No provider is safe now, fake locations will be found and shamed

  • @jimaek said: No provider is safe now, fake locations will be found and shamed

    1. iptables -A INPUT -p icmp -j DROP
    2. Anycast ICMP (some ddos providers offer this, for example, CDN77/DataPacket)
    1. That won't work. I mention it in the article
    2. Obviously you can't resolve an anycast IP using any method :)
    Thanked by 2Rolzzandik mandala
  • @zGato said:
    finally i can use these

    Now run this to geolocate all your IPs (with 250 servers per request as CLI suggest) and please report how many left :D

    Thanked by 1zGato
  • Guys @ some hosters you might think they will run a GlobalPing container or would spend one or more vps to support Globalping

  • @zGato said:
    finally i can use these

    Unlike my bank account, at least I'm in the black here.

    Thanked by 3zGato t0m satorik
  • NeoonNeoon Community Contributor, Veteran

    @jimaek said:

    @Neoon said:
    Any bulk option for a few million?

    I mean its a question of having enough credits and time :) The how is pretty easy

    ugh expensive, I need a few million per week.
    Any volume discounts?

    Thanked by 1Xrmaddness
  • @Neoon said:

    @jimaek said:

    @Neoon said:
    Any bulk option for a few million?

    I mean its a question of having enough credits and time :) The how is pretty easy

    ugh expensive, I need a few million per week.
    Any volume discounts?

    You trying to make an ipinfo competitor?

  • yoursunnyyoursunny Member, IPv6 Advocate

    IPv9 support when?

    Customers were casting doubts on our Antarctica location.
    If geolocate adds IPv9, the results can shut them up once and forever.

    Thanked by 1Smigit
  • Now someone offer this as a service xD

    Thanked by 1yoursunny
  • @yoursunny said:
    IPv9 support when?

    Customers were casting doubts on our Antarctica location.
    If geolocate adds IPv9, the results can shut them up once and forever.

    I do accept pull requests, the ball is in your court

    Thanked by 2ralf gbzret4d
  • Nice. This is useful.

    Thanked by 1jimaek
  • NeoonNeoon Community Contributor, Veteran

    @jimaek said:

    @Neoon said:

    @jimaek said:

    @Neoon said:
    Any bulk option for a few million?

    I mean its a question of having enough credits and time :) The how is pretty easy

    ugh expensive, I need a few million per week.
    Any volume discounts?

    You trying to make an ipinfo competitor?

    No, for gaming, I call it "cloud bending".
    Using that raw latency data to optimize my routing rules.

  • yoursunnyyoursunny Member, IPv6 Advocate

    @BasToTheMax said:
    Now someone offer this as a service xD

    Turn into a webpage.
    Reader inputs their GlobalPing token and the webpage runs the geolocate procedure, with animation and stuff.

  • It's doable but it would require a lot more effort and resources and I'm not sure how much demand there is for this. Especially since most people (no account) wouldn't be able able to run it more than ~2 times.

    The CLI tool feels like a better fit

  • I made some updates:

    • Improved the logic to be more accurate by filtering out bad traceroutes. This was especially impacting in Asia where many networks apply too many restrictions which broke the original simplistic logic
    • Added debug mode
    • Added basic anycast detection (must be large enough)
    geolocate 8.8.8.8 -L 250
    Geolocating 8.8.8.8...
    
    Phase 1: Detecting continent...
      Measuring from 30 probes...
    
      [████████████████████████████████████████] 100.0%   30/30 - Best: EU (2.78 ms)                    
    
      Africa: 15.42 ms
      Asia: 6.10 ms
      Europe: 2.78 ms
      North America: 5.94 ms
      Oceania: 14.36 ms
      South America: 26.21 ms
    
    Best continent: Europe (2.78 ms)
    
    Phase 2: Detecting country...
      Measuring from 250 probes...
    
      [████████████████████████████████████████] 100.0% 250/250 - Best: BG (0.28 ms)                    
    
      Bulgaria: 0.28ms
      United Kingdom: 0.32ms
      Netherlands: 0.39ms
    
    Anycast IP detected. This IP is most likely part of a regional or global anycast network.
    
    
    Thanked by 1oloke
  • Is it necessary to run probe from >3 location at phase 1?

  • For many instances no, but some targets could be right on the border of continents, so the more probes are used the better the accuracy for those edge cases

  • @jimaek said:
    For many instances no, but some targets could be right on the border of continents, so the more probes are used the better the accuracy for those edge cases

    I understand. More probes == more accurate result. However, I think it's possible to improve the credit mileage through some calculations, if duration of the process aren't a concern.

  • @jimaek said:

    @CyberneticTitan said:
    I feel this problem can be solved with a fewer number of probes via determining the intersection of circles instead of in this hierarchical way.

    Oh yeah for sure. I'm just not smart enough to do the maths so I brute forced it

    It's possible but the few ideas I had still required a considerable amount of probes to see the benefits in terms of accuracy. Higher than the limit for unauthenticated users.

    Lowering the probes while retaining accuracy requires research and math I'm not yet ready to jump into :)

  • @jimaek said:

    @jimaek said:

    @CyberneticTitan said:
    I feel this problem can be solved with a fewer number of probes via determining the intersection of circles instead of in this hierarchical way.

    Oh yeah for sure. I'm just not smart enough to do the maths so I brute forced it

    Lowering the probes while retaining accuracy requires research and math I'm not yet ready to jump into :)

    Let say there's n probes. Calculating ping time between those probes is nC2. But, that's too much.
    Therefore, it's easier to have 190-ish or 200ish territories as the row&column.
    After the first two probe, it's possible to make rough guess. Then, the choose random probe within the possible location. At worst, it's on the other side of planet, but that's okay

  • jimaekjimaek Member
    edited December 2025

    This would require having a pre-compiled DB of latencies if I understand correctly.

    You say a matrix of 200 locations. But what if the target's location is not in the DB?
    I would then need to use the geographic coordinates of all GP probes to essentially create a large enough radius around the best candidates from the DB and run a measurement.

    But that measurement to be accurate would still require plenty of probes. And that assumes the target location is close by to the DB.

    What if its in a rare location, like Hawaii with nothing close by. It will most likely completely fail or require a huge radius with a large amount of probes.

    Am I missing something?

Sign In or Register to comment.