BIND with GeoIP

Requirements

create an account for GeoIP (https://dev.maxmind.com/geoip/geoip2/geolite2/) and retrieve it

mkdir /usr/local/share/GeoIP/
cd /usr/local/share/GeoIP/

# Database URL
https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country&license_key=YOUR_LICENSE_KEY&suffix=tar.gz

# SHA256 URL
https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country&license_key=YOUR_LICENSE_KEY&suffix=tar.gz.sha256

check your workstation’s IP

echo `curl -s ifconfig.me`
curl ifconfig.co

and make sure your geoip db works already

tar xzf geoip.tar.gz
mv -f */*.mmdb .

mmdblookup --file /usr/local/share/GeoIP/GeoLite2-Country.mmdb \
    --ip YOUR-WORKSTATION-IP

Setup

options {
    ...
    geoip-directory "/usr/local/share/GeoIP";
};

acl "acl-usa" {
     geoip country US;
};

acl "acl-france" {
     geoip country FR;
};

acl "acl-russia" {
     geoip country RU;
};

view "view-usa" {
     match-clients { acl-usa; };
     zone "cdn.nethence.com" {
      file "usa.db";
      type master;
     };
};

view "view-france" {
     match-clients { acl-france; };
     zone "cdn.nethence.com" {
      file "france.db";
      type master;
     };
};

view "view-russia" {
     match-clients { acl-russia; };
     zone "cdn.nethence.com" {
      file "russia.db";
      type master;
     };
};

view "default" {
     zone "cdn.nethence.com" {
      file "france.db";
      type master;
     };
};

Acceptance

from various locations

host cdn.nethence.com pro5s1.nethence.com
host cdn.nethence.com

Resources

GeoLite2 Free Downloadable Databases https://dev.maxmind.com/geoip/geoip2/geolite2/

Using the GeoIP Features in BIND 9.10 https://kb.isc.org/docs/aa-01149

Using the GeoIP Features in BIND 9.9 Subscription Version https://kb.isc.org/docs/aa-00971

Automatic Updates for GeoIP2 and GeoIP Legacy Databases https://dev.maxmind.com/geoip/geoipupdate/

competition

Authoritative DNS Server http://gdnsd.org/ https://github.com/gdnsd/gdnsd

GeoDNS https://en.wikipedia.org/wiki/GeoDNS

GeoDNS servers https://github.com/abh/geodns

Geo-DNS providers? [closed] https://serverfault.com/questions/30567/geo-dns-providers


HOME | GUIDES | BENCHMARKS | html