PowerDNS and CNAME to external domain

Andrey Zentavr picture Andrey Zentavr · Aug 15, 2010 · Viewed 9.8k times · Source

I'm using PowerDNS (2.9.22) for my clients. Because it can store all data into MySQL database and it's easy for clients to edit their zones as they like.

Now I have a problem with CNAMEs:

Here are records into MySQL database:

+-----------------------+-------+-----------------------+
| localhost.example.com |   A   | 127.0.0.1             |
+-----------------------+-------+-----------------------+
| a.example.com         | CNAME | localhost.example.com |
+-----------------------+-------+-----------------------+
| www.example.com       | CNAME | andreyzentavr.com     |
+-----------------------+-------+-----------------------+

PowerDNS config is here:

allow-recursion=127.0.0.1, 173.193.**.162, 173.193.**.163
allow-recursion-override=on
cache-ttl=20
config-dir=/etc/powerdns
daemon=yes
default-soa-name=ns3.bserver.com
disable-axfr=yes
guardian=no
launch=gmysql
gmysql-host=127.0.0.1
gmysql-port=3306
gmysql-user=powerdns
gmysql-dbname=powerdns
gmysql-password=123123
lazy-recursion=yes
local-address=173.193.**.162, 173.193.**.163
local-port=53
log-dns-details=yes
log-failed-updates=yes
logfile=/var/log/pdns.log
loglevel=6
master=yes
max-queue-length=5000
max-tcp-connections=10
module-dir=/usr/lib/powerdns
query-logging=yes
recursor=127.0.0.1:53
setgid=pdns
setuid=pdns
skip-cname=no
slave=yes
slave-cycle-interval=600
soa-minimum-ttl=3600
soa-refresh-default=10800
soa-retry-default=3600
soa-serial-offset=0
socket-dir=/var/run
use-logfile=yes
wildcards=yes
version-string=powerdns

when I'm doing nslookup query, I got this:

server:~# nslookup
> set q=any
> server ns3.***.com
Default server: ns3.***.com
Address: 173.193.**.163#53
> a.example.com
Server:         ns3.***.com
Address:       173.193.***.163#53

a.example.com      canonical name =localhost.example.com.
Name: localhost.example.com
Address: 127.0.0.1
>
>
> www.example.com
Server:         ns3.***.com
Address:       
173.193.***.163#53

** server can't find www.example.com: NXDOMAIN

As you can see, if CNAME points to INTERNAL record - everything resolves fine. But if it points to external domain - I have an error.

andreyzentavr.com is existant domain and points to 194.126.204.41

Is it bug in PowerDNS? Or did I configure it wrongly?

Answer

user615501 picture user615501 · Sep 14, 2012

Solution is to put the recursor in front of the authoritative server and configure the recursor to forward specific domains to the authoritative server using the forward-zones-recurse directive. Requires version 3.2 of the recursor.