wiki:DNS Configuration

BIND

forwarder setup

If you already run a local DNS server, you can tell it to query the dn42 anycast servers for the relevant domains by adding the following to /etc/bind/named.conf.local

zone "dn42" {
        type forward;
        forwarders { 172.22.0.53; };
};
zone "22.172.in-addr.arpa" {
        type forward;
        forwarders { 172.22.0.53; };
};
zone "23.172.in-addr.arpa" {
        type forward;
        forwarders { 172.22.0.53; };
};

slave zone

(works for Crest)

zone "dn42" {
	type slave;
	file "slave/dn42";
	masters {
		172.22.192.53;
		172.22.138.1;
		172.22.138.2;
	};
	notify no;
};

# remember to unmask rfc1918 networks
zone "22.172.in-addr.arpa" {
	type slave;
	file "slave/22.172.in-addr.arpa";
	masters {
		172.22.192.53;
		172.22.138.1;
		172.22.138.2;
	};
	notify no;
};

zone "23.172.in-addr.arpa" {
	type slave;
	file "slave/23.172.in-addr.arpa";
	masters {
		172.22.138.1;
		172.22.138.2;
	};
	notify no;
};

stub zone

(like slave, but stores only NS records)

zone "dn42" {type stub; masters { 172.22.138.1; 172.22.192.53; 172.22.138.2; }; file "/etc/bind/s/dn42.zone";};
zone "22.172.in-addr.arpa" {type stub; masters { 172.22.138.1; 172.22.192.53; 172.22.138.2; }; file "/etc/bind/s/172.22.zone";};
zone "23.172.in-addr.arpa" {type stub; masters { 172.22.138.1; 172.22.192.53; 172.22.138.2; }; file "/etc/bind/s/172.23.zone";};

dnsmasq

If you are running dnsmasq under openwrt, you just have to add

config dnsmasq
    option local            '/dn42/22.172.in-addr.arpa/172.22.0.53'

to /etc/config/dhcp and run /etc/init.d/dnsmasq restart. After that you are able to resolve .dn42 with the anycast DNS-Server, while your normal requests go to your standard DNS-resolver.

for normal dnsmasq use

server=/dn42/172.22.0.53
server=/22.172.in-addr.arpa/172.22.0.53

in dnsmasq.conf

unbound

As recursing cache, not forwarder, you need to specify the authoritative servers. Also, the RFC1918 reverse lookup zones must be unmasked.

server:
        local-zone: "22.172.in-addr.arpa" transparent
        local-zone: "23.172.in-addr.arpa" transparent
stub-zone:
        name: "dn42"
        stub-addr: 172.22.138.1
        stub-addr: 172.22.192.53
        stub-addr: 172.22.138.2
        stub-prime: yes
stub-zone:
        name: "22.172.in-addr.arpa"
        stub-addr: 172.22.138.1
        stub-addr: 172.22.192.53
        stub-addr: 172.22.138.2
        stub-prime: yes
stub-zone:
        name: "23.172.in-addr.arpa"
        stub-addr: 172.22.138.1
        stub-addr: 172.22.192.53
        stub-addr: 172.22.138.2
        stub-prime: yes