geoip: ubuntu 14.04

First Reference

How to use iptables in Ubuntu to block whole countries

Second Reference


Third Reference

Significant Changes to Accessing and Using GeoLite2 Databases


Fourth Reference

Automatic Updates for GeoIP2 and GeoIP Legacy Databases



Install and edit your configuration file adding your User and Key


Then run:




Date is located on





Option to block using apache


If you want to block using Apache module then you can try this also :

MaxMindDBEnable On
MaxMindDBFile DB /path/to/GeoIP/GeoLite2-Country.mmdb
MaxMindDBEnv MM_COUNTRY_CODE DB/country/iso_code

SetEnvIf MM_COUNTRY_CODE ^(CN|RU|DE|FR) BlockCountry
Deny from env=BlockCountry

Using IP Tables

 sudo iptables -A INPUT -m geoip --src-cc RU -j DROP

--src-cc DE being the country

apt-get install mmdb-bin  mmdblookup --file /usr/share/GeoIP/GeoLite2-Country.mmdb --ip

Leave a Reply

Your email address will not be published. Required fields are marked *