geoiplookup is a command-line utility that lets you find the actual geographical location of a website’s server.
Have you ever wondered where a website is actually hosting its content from? You can geolocate domain names and IP addresses right from the Linux command line with geoiplookup. Here’s how to use it.
What Is geoiplookup?
geoiplookup is a command-line utility that uses MaxMind’s geolocation database to find the country where an IP address or domain name is hosted. It queries a local file, typically stored in the /usr/share/GeoIP directory.
Installing geoiplookup on Linux
Installing geoiplookup is easy as it’s available in the package managers of most major Linux distros.
On Debian or Ubuntu, you can install the geoip-bin package:
sudo apt install geoip-bin
And on Arch Linux:
sudo pacman -S geoip
On RHEL/CentOS/Rocky Linux and friends, there’s a small difference. You’ll need to install the Extra Packages for Enterprise Linux (EPEL) repository first, then use DNF to install geoiplookup:
sudo dnf install geoip
Using geoiplookup to Geolocate IP Addresses
To use geoiplookup, you can call it at the command line with either an IP address or a domain name.
You might try looking up the IP address that your ISP has given you. Most residential connections are dynamic, which means that your address is assigned from a pool for a session. Luckily, it’s easy to find your IP address on Linux.
To use an IP address, supply it as an argument:
geoiplookup will tell you the country where the IP address is located. This will work with both IPv4 and IPv6 addresses.
You can also supply domain names as arguments. It can get interesting with large websites. You’d expect with a domain name like “bbc.co.uk” that the BBC’s servers would be within the United Kingdom, but from the US, the geolocation information reveals that the website uses servers based in the US.
This is probably because large websites like the BBC use content delivery networks to place servers as physically close to users as possible. It’s faster to serve up content stateside for users in America than it is to use satellite links or undersea cables from the UK.
If you have an account with a VPN provider, you can change the geographical location of your connection and try using geoiplookup to see what results you get.
You Can Look Up Website Locations From the Linux Command Line
geoiplookup is a small utility that can show where a website’s server is located. Sometimes, the results can surprise you.
If you’re looking to hide your location for whatever reason, there are ways to do it right in your web browser.
Read the full article here