Bind

From YobiWiki
Jump to navigation Jump to search

Intro

Some notes how to setup a dynamic DNS...
Setup is based on Askarel's dynaname

Requirements

Server

apt-get install bind9

This will be the nameserver ns0.foo.org for our dynamic subdomain dyn.bar.org so this has to be announced in the primary DNS of your bar.org domain:

dyn    NS    ns0.foo.org.

To test it:

dig @your.primary.dns.for.bar.org dyn.bar.org
;; AUTHORITY SECTION:
dyn.bar.org.        10800    IN    NS    ns0.foo.org.

Client

apt-get install dnsutils bind9utils
git clone https://github.com/askarel/dynaname.git

Setup

To create e.g. home.dyn.bar.org:

cd dynaname
./dynaname -G -H home.dyn.bar.org -S ns0.foo.org

Then copy ns0.foo.org/etc/bind/dynaname.conf to ns0.foo.org:/etc/bind/
and add a hook into ns0.foo.org:/etc/bind/named.conf:

include "/etc/bind/dynaname.conf"

I needed to set an absolute path to the file, so in dynaname.conf change

       file "dyn/dyn.bar.org";

to

       file "/var/lib/bind/dyn/dyn.bar.org";

For info dynaname.conf should look like:

key home.dyn.bar.org {
        algorithm HMAC-MD5;
        secret "some secret...";
};

zone "dyn.bar.org" in {
        type master;
        file "/var/lib/bind/dyn/dyn.bar.org";
        update-policy {
                grant home.dyn.bar.org name home.dyn.bar.org A AAAA TXT;
        };
};