Have you ever wondered where the content of a website actually comes from? You can locate domain names and IP addresses directly from the Linux command line using the geoiplookup function. Here's how to use it.
What is geoiplookup?
geoiplookup is a command-line utility that uses the MaxMind geolocation database to find the country that hosts an IP address or domain name. It requests a local file, usually stored in the /usr/share/GeoIP directory.
Installing geoiplookup on Linux
Installing geoiplookup is very easy as it is available in the package managers of most major Linux distributions.
On Debian or Ubuntu, you can install the geoip-bin package:
sudo apt install geoip-bin
And in Arch Linux:
sudo pacman -S geoip
There is a slight difference on RHEL/CentOS/Rocky Linux and other systems. First you need to install the repository Extra Packages for Enterprise Linux (EPEL) and then use DNF to install geoiplookup:
sudo dnf install geoip
Using geoiplookup to geolocate IP addresses
To use geoiplookup, you can call it on the command line with either an IP address or a domain name.
You can try to find the IP address your ISP gave you. Most resident connections are dynamic, which means your address is assigned from a session pool. Luckily, finding your IP address on Linux is easy.
To use an IP address, provide it as an argument:
geoiplookup [address]
geoiplookup will tell you the country where the IP address is located. This will work with both IPv4 and IPv6 addresses.
You can also provide domain names as arguments. This can get interesting with large websites. With a domain name like "bbc.co.uk" you would expect the BBC servers to be in the United Kingdom, but from the US the geolocation information shows the website is using servers located in the US.
This is likely because major websites like the BBC use content delivery networks to place servers as close to users as possible. Delivering content in the US to users in America is faster than using satellite links or submarine cables from the UK.
If you have an account with a VPN provider, you can change the geographic location of your connection and try using geoiplookup to see what results you get.
Finding the location of websites from the command line
geoiplookup is a small utility that can show you where a website's server is located. Sometimes the results may surprise you.
If you want to hide your location for any reason, there are ways to do it right in your web browser.
2525700cookie-checkHow to determine the geolocation of an IP address in Linux using geoiplookupno
similar
Publication author
offline 1 week
Comments: 6Publications: 1180Registration: 29-04-2020
Программы
#determine #geolocation #address #Linux #geoiplookup