Uncategorized

GeoIP: Ubuntu 14.04

First Reference

How to use iptables in Ubuntu to block whole countries

Second Reference

Block entire countries on Ubuntu server with Xtables and GeoIP

 

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

/etc/GeoIP.conf

Then run:

/usr/bin/geoipupdate

 

 

Date is located on

/usr/share/GeoIP/GeoLite2-Country.mmdb

 

 

 

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 8.8.8.8 http://w ww.mailserverguru.com/iptables-geoip-blocking-ubuntu-16-04-18-04/

Leave a Reply

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