Internet geolocation (GeoIP) is what it sounds like: Locating the geographical location of a Internet-connected device or service. This has historically been done by looking IP addresses up in a database. The advent of smartphones and other smart devices has made it possible to lookup a devices exact location using GPS, nearby Wi-Fi hot-spots and other data if those markers are available to the operating system.
GeoIP databases are exactly what it sounds like: Databases with subnets and IP addresses matched to geographical locations. There are online services and databases capable of providing the location of an IP address down to country, province, city and, in some rare cases, street.
MaxMinds GeoIP databases
The best go-to solution for GeoIP lookups using a local database used to be MaxMinds GeoIP databases. MaxMind changed their Terms Of Service on Decmeber 30th, 2019. It has not been legal or possible to download their databases without registering them since then. It is still possible to use their older databases if you have them or you can find them. There is a fair chance that you already have a MaxMind database, elasticsearch and other software have the MaxMind
GeoLite2-City.mmdb database file in their package. These files can still be used, the only issue is that they become more and more outdated as time passed since December 2019 increases.
IP2Location IP-COUNTRY databases
The IP2Location geolocation service has been established since 2002. The IP2Location LITE database is being licensed under Creative Commons Attribution-ShareAlike 4.0 International License. It has the database in CSV (SQL database) and BIN database. You need to sign-up for an account at www.ip2location.com to download the latest updates. You can access to database with states, city, coordinates, ZIP codes and area codes.
Software77 IP to Country Database
The Software77 GeoIP database, available from software77.net/geo-ip/, is a great, completely free and regularly updated GeoIP database. The only huge problem with this database is that it is, as the name indicates, a IP to Country database. This is the database you are looking for if that is what you need. It is obviously not what you're looking for if you need more detailed information such as provinces, cities or other more accurate data.
Iriven PHP GeoIPCountry Library, available from Iriven PHP GeoIPCountry Library, is a really fast and easy way to do IP to country lookups. It uses the Software77 database described above. The library converts the Seven77 database into a ton of simple PHP files with lists of IP subnets. Those files can then be used to turn IP addresses into ISO country codes. It's a quite nice solution if you want a fast and easy way to turn IP address into country codes as part of some PHP-based project.