[Pdns-users] How to use GeoIP2 database with PowerDNS

Aki Tuomi cmouse at cmouse.fi
Sun May 27 06:15:16 UTC 2018


It seems you found a bug. https://github.com/PowerDNS/pdns/issues/6676

Aki

On Sun, May 27, 2018 at 08:43:22AM +1000, Chris Jones wrote:
> Hi Aki,
> 
> Here is my geo.yml zone file:
> 
> domains:
> - domain: geo.example.org
>   ttl: 60
>   records:
>     geo.example.org:
>        - soa: ns.example.org. geoman.example.org. 1 7200 3600 86400 60
>        - ns:  ns.example.org.
>     deu.geo.example.org:
>        - a: 192.0.0.2
>        - txt: Guten Tag
>     esp.geo.example.org:
>        - a: 192.0.0.10
>        - txt: Muy buenos dias
>        - loc: 40 8 43.041 N 3 21 42.539 W 714m 10m 100m 10m
>     blah.geo.example.org:
>        - a: 1.1.1.1
>     "*.geo.example.org":
>        - a: 127.0.0.53
>        - txt: I don't know exactly where you are
>   services:
>      www.geo.example.org: '%co.geo.example.org'
> 
> Here is the output of some dig commands too (note, the DNS server is on the
> internet, so feel free to dig yourself):
> 
> *cpjones at ubuntu:~$* dig blah.geo.example.org @14.201.167.71
> 
> ; <<>> DiG 9.10.3-P4-Ubuntu <<>> blah.geo.example.org @14.201.167.71
> ;; global options: +cmd
> ;; Got answer:
> ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 31532
> ;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
> ;; WARNING: recursion requested but not available
> 
> ;; OPT PSEUDOSECTION:
> ; EDNS: version: 0, flags:; udp: 1680
> ;; QUESTION SECTION:
> ;blah.geo.example.org.          IN      A
> 
> ;; ANSWER SECTION:
> blah.geo.example.org.   60      IN      A       1.1.1.1
> 
> ;; Query time: 3 msec
> ;; SERVER: 14.201.167.71#53(14.201.167.71)
> ;; WHEN: Sun May 27 08:38:54 STD 2018
> ;; MSG SIZE  rcvd: 65
> 
> *cpjones at ubuntu:~$* dig geo.example.org @14.201.167.71
> 
> ; <<>> DiG 9.10.3-P4-Ubuntu <<>> geo.example.org @14.201.167.71
> ;; global options: +cmd
> ;; Got answer:
> ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 25678
> ;; flags: qr aa rd; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1
> ;; WARNING: recursion requested but not available
> 
> ;; OPT PSEUDOSECTION:
> ; EDNS: version: 0, flags:; udp: 1680
> ;; QUESTION SECTION:
> ;geo.example.org.               IN      A
> 
> ;; AUTHORITY SECTION:
> geo.example.org.        60      IN      SOA     ns.example.org.
> geoman.example.org. 1 7200 3600 86400 60
> 
> ;; Query time: 4 msec
> ;; SERVER: 14.201.167.71#53(14.201.167.71)
> ;; WHEN: Sun May 27 08:37:37 STD 2018
> ;; MSG SIZE  rcvd: 90
> 
> And finally, the record under services:
> 
> *cpjones at ubuntu:~$* dig www.geo.example.org @14.201.167.71
> 
> ; <<>> DiG 9.10.3-P4-Ubuntu <<>> www.geo.example.org @14.201.167.71
> ;; global options: +cmd
> ;; connection timed out; no servers could be reached
> 
> Regards,
> Chris.
> 
> On Sun, May 27, 2018 at 3:06 AM Aki Tuomi <cmouse at cmouse.fi> wrote:
> 
> > On Sat, May 26, 2018 at 08:14:15PM +1000, Chris Jones wrote:
> > > Hi there,
> > >
> > > I have successfully setup a pdns instance using the geoip backend and a
> > > copy of the legacy GeoIP database (from
> > > https://dev.maxmind.com/geoip/legacy/install/country/). Throughout the
> > > MaxMind website, I read that this database is end of life in favor for
> > > GeoIP2 (available at https://dev.maxmind.com/geoip/geoip2/geolite2/).
> > >
> > > The GeoIP legacy database is in the .DAT format, and the GeoIP2 database
> > is
> > > in a MMDB format. Reading the pdns documentation, it is confusing whether
> > > MMDB is nativity supported or if I have to do something to the database
> > > file to make it work.
> > >
> >
> > It should work.
> >
> > > My pdns.conf file contains the following parameters when using the GeoIP
> > > legacy database:
> > >
> > > launch=geoip
> > > geoip-database-files=/etc/pdns/GeoIP.dat
> > > geoip-zones-file=/etc/pdns/geo.yml
> > >
> > > That works fine. But when I change the *geoip-database-files* parameter
> > to
> > > use the MMDB file, it does not work (geo requests are timing out -
> > standard
> > > records work fine though).
> > >
> > > launch=geoip
> > > geoip-database-files=/etc/pdns/GeoLite2-City.mmdb
> > > geoip-zones-file=/etc/pdns/geo.yml
> > >
> > > Has anyone got an example or suggestions on how I can use the GeoIP2
> > > databases with the pdns-geoip backend?
> > >
> > > System: CentOS 7 + pdns 4.1.3
> > >
> > > Thanks,
> > > Chris.
> >
> > Can you provide your geo.yml?
> >
> > Aki
> >


More information about the Pdns-users mailing list