logo

How to start using GeoLite2(GeoIP) Database

About Geo2Lite

Since version 4.5.8 Roxy-WI allows to download and update GeoLite2 via the web panel.

GeoIP is the MaxMind’s IP intelligence product. It provides IP geolocation and proxy detection for a wide range of applications including content customization, advertising, digital rights management, compliance, fraud detection and security.

Databases

GeoLite2 databases are free IP geolocation databases comparable to, but less accurate than, MaxMind’s GeoIP2 databases. The GeoLite2 Country, City, and ASN databases are updated weekly, every Tuesday.

IP Geolocation Usage

IP geolocation is inherently imprecise. Locations are often near centers of the population. Any location provided by a GeoIP database should not be used to identify a particular address or household.
Use the Accuracy Radius as an indication of geolocation accuracy for the latitude and longitude coordinates Maxmind returns for an IP address. The actual location of the IP address is likely within the area defined by this radius and the latitude and longitude coordinates.

Go to TOP

Getting Licence Key

MaxMind provides access to GeoLite2 databases only for registered users. So, you need to get a license key. All the details are described in the instruction below.

First of all create an account here:

MaxMind sign up

when you have created your account, you will receive an email with further instructions:

MaxMind sign up

Follow the link to create a password:

MaxMind sign up

After finishing the registration you will be granted acess to your private cabinet:

MaxMind sign up

To download the database you need to get a license key. Go to "My Licence Key" section: Follow the link to create a password:

MaxMind sign up

Next:

MaxMind sign up

Next:

MaxMind sign up

The license key will be displayed on the screen. Copy and save it as it will not be shown anymore:

MaxMind sign up

Specify your key as the value of the maxmind_key parameter in your group settings:

MaxMind sign up

Go to TOP

Start to use GeoLite2 with Roxy-WI

Roxy-WI allows to use GeoLite2 via the web interface. Create a license key to start using it.

After you have created the Licence key and added it into the group settings you can start using GeoLite2 Database:

Select a server for uploading, Roxy-WI will define if GeoLite2 is already installed on it(in the black box), and press the "Install" button(in the green box).

Roxy-WI will download and format it from GeoIP to acceptable format for HAProxy service. Also Roxy-WI will separate divide a big file with IPs into many smaller files (each file for one country) e.g.: file AD.subnets consists of all IPs which used in Andorra.

Go to TOP

Updating GeoLite2 with Roxy-WI

Updating

MaxMind updates GeoLite2 databases every Tuesday, so it should be updated every week. Roxy-WI can do it! Just check "Updating" checkbox.

Go to TOP

Using GeoLite2 with HAProxy

How files with IPs for each continent can be used for creating ACLs:

    acl acl_AF src -f /etc/haproxy/geoip/AF.txt
    acl acl_AN src -f /etc/haproxy/geoip/AN.txt
    acl acl_AS src -f /etc/haproxy/geoip/AS.txt
    acl acl_EU src -f /etc/haproxy/geoip/EU.txt
    acl acl_NA src -f /etc/haproxy/geoip/NA.txt
    acl acl_OC src -f /etc/haproxy/geoip/OC.txt
    acl acl_SA src -f /etc/haproxy/geoip/SA.txt
                

You may reject all connections from a certain continent (for Africa, for instance):

    http-request deny if !acl_AF
                

or address them to different backend servers:

    use_backend bk_af if acl_AN
                
Go to TOP

Using GeoLite2 with NGINX

Since Roxy-WI version 6.2.1 you can install GeoLite2 for the NGINX service on your servers. Go to the Servers-GeoLite2 section, choose NGINX as a service and click the Install button.

Roxy-WI transforms data files from the GeoLite2-friendly format to the NGINX-friedly format and move the GeoIP.dat file to the $nginx_dir/geoip folder. That's it, data is awaiting for NGINX to pick it up!

Was this article helpful?

Yes, thanks!
Go back