One of the most important things to consider when deploying any servers for your business or development needs is to make sure that it’s in a location that works for you. Let’s say you’ve deployed a server and then used one of the IP geolocation websites and found that your server’s IP does not match its location, what do you do?
Unfortunately, these sites, while convenient, can be very inaccurate. This how-to guide will show you some more accurate ways of finding where your server is located.
A Linux, FreeBSD, or Windows VPS with a static IP address assigned.
How Locations Are Assigned To IP Addresses
The Internet Assigned Numbers Authority (IANA) handles splitting all the IPV4 and IPV6 addresses to 5 different Regional Internet Registries (RIR).
The 5 RIR names and geographic responsibilities are as follows:
AFRINIC - Africa
ARIN – United States, Canada, Caribbean, and Antarctica
APNIC – Asia, Australia, New Zealand
RIPE NCC – Europe, Russia, Middle East, and Central Asia
LACNIC – Latin America, some parts of the Caribbean
Organizations can purchase blocks of IPs from the RIR that oversees the area in which that organization’s equipment is going to be located. The organization is then responsible for updating the RIR’s database indicating where (country, state/territory, city) they have assigned those blocks of IPs.
IP geolocation sites use this information as their primary source of data. However, it’s not the only source they use; frequently, they use other sources like data mining and user-submitted updates.
The Flaws With Geolocation Sites
One of the biggest issues with geolocation sites is that it’s simply too hard to keep track of so many IPs. There is a combined total of 4,294,967,296 IPv4 possible addresses, a large portion of those are constantly being shifted around within an organization, being moved or sold to new organizations, etc. The databases that the geolocation sites have can get out of sync pretty quickly as a result of all of this movement. IP2Location, which is one of the bigger IP geolocation services, says the following: “In general, the accuracy will degrade by about 1%-5% for each month that an outdated database is being used.” At any given time, that is up to over 200 million IP addresses that are out of date. Other sites that are using IP2Location’s database may not have the most up-to-date database and can be over 6 months behind.
Other issues include organizations that may not be up to date on updating their RIR, causing more data to be inaccurate.
Note: Atlantic.Net updates our direct allocations per ARIN and RIPE polices by updating the SWIP data within ARIN’s or RIPE’s WHOIS Database with the proper country, city and state data corresponding to where the IP allocation has been provisioned.
It’s not that geolocation sites are bad–they do serve an important purpose for advertising and geoblocking. It should just be noted that they are not always accurate. Often this will not affect you when you are looking up your IP to see which region it’s located in. If, however, you believe your IP is incorrectly geoblocked, the best plan is to contact the geolocation site that is inaccurate.
How To Find The Real Location Of Your Server
If a geolocation site gives you conflicting information about the location of your server’s IP, you can verify your server’s location by following these steps.
Checking Your IP Using WHOIS
WHOIS is a tool that queries the database that stores the registered information for an IP address block or domain name.
FreeBSD systems should have WHOIS installed by default. If you have a Linux system, you can install WHOIS with a simple command:
For Debian and Ubuntu:
apt-get install whois
yum install jwhois
pacman -S whois
Unfortunately, Windows does not have a built-in WHOIS tool. You can find a third-party tool, or go to the RIR responsible for the region your server is located in and run their WHOIS tool. Links to each site are below. If you don’t know which RIR you need to go to, just select one and insert your IP, and it will tell you the correct RIR to use.
ARIN, RIPE NCC, APNIC, LACNIC and AFRINIC.
With WHOIS now installed on your system, you can run the following command to check the WHOIS database:
When you run the command, you will get output similar to the following:
NetRange: 188.8.131.52 - 184.108.40.206
Parent: NET209 (NET-209-0-0-0-0)
NetType: Direct Allocation
Organization: Atlantic.net, Inc. (INCC)
Comment: ADDRESSES WITHIN THIS BLOCK ARE NON-PORTABLE
OrgName: Atlantic.net, Inc.
Address: 440 West Kennedy Blvd.
Address: Suite 3
Comment: Atlantic.Net used to be known as Internet Connect Company Inc.
Comment: Please send any abuse/hacking/spam complaints to [email protected]
In this particular case, you can see this IP range has been assigned to Orlando, FL. However, this result only gives you so much information; the output could say it is in one location but could actually be in another. That’s why the next step is to run a traceroute.
Running a Traceroute To Find Your Server Location
The best way to see where your server is located is through a traceroute. A traceroute will give you the sequential list of network devices–devices potentially operated by different organizations–that traffic is routed through on its way to its destination. Here, we will be able to see the path that traffic takes from your server to the destination IP or hostname you enter. We can run a WHOIS on each IP address along the path to see the location is correct.
To run a traceroute on Linux or FreeBSD, run the following command:
To run a traceroute on Windows, open your command prompt and run the following command:
On a traceroute from an Atlantic.Net Cloud server in London to Google.com, we get the following output.
traceroute to google.com (220.127.116.11), 30 hops max, 60 byte packets
1 vl223-ar-02.lon-uk.as59764.net (18.104.22.168) 0.401 ms 0.391 ms 0.464 ms
2 22.214.171.124.not-updated.eunx.net (126.96.36.199) 1.048 ms 1.028 ms 1.001 ms
3 188.8.131.52 (184.108.40.206) 1.410 ms 1.391 ms 1.372 ms
4 220.127.116.11 (18.104.22.168) 4.172 ms 1.329 ms 1.316 ms
5 22.214.171.124 (126.96.36.199) 1.290 ms 1.340 ms 1.323 ms
6 lhr14s23-in-f14.1e100.net (188.8.131.52) 1.221 ms 1.339 ms 1.318 ms
From here, you can do a WHOIS on the IPs that you see in the traceroute. Do a WHOIS on the first few IPs since they will be closer to your server than the last few IPs. Below, we have an example WHOIS from the second hop that shows that the location of that IP is in London.
An example of a whois lookup using an IP from a the traceroute above.
See the “netname” entry indicates “UK-EUNETWORKS” and the “country” is “GB”–Great Britain. Again this relies on organizations updating their information appropriately. If any one IP lookup provides what appears to be inaccurate information, you should, with most traceroutes, have multiple hops you can check.
Thank you for following this How-to. We hope that this clears up any issues you may have with IP geolocation. Please check back here for more updates.