# Setting up Dynamic DNS for a LAN



## bit (Dec 5, 2012)

Hi,
I'm attempting to set up a dhcp server able to update dns to server IP addresses on my home network but I'm having some issues get the DNS entries updated when a DHCP lease is handed out. I have verified that the DHCP server is working (it's correctly handing out leases) and that the DNS server is likewise (at least, I know its able to retrieve records via my router and hand them out to clients on the network).

I've been using this guide to help me, http://www.semicomplete.com/articles/dynamic-dns-with-dhcp/ 

At boot I'm getting the following error which I'm guessing has something to do with the issue but as far as I can tell managed-keys.bind is where it's supposed to be.


> managed-keys-zone ./IN: loading from master file managed-keys.bind failed: file not found



The name of the machine I'm setting up as dhcp/dns server is "nroute" with an IP address 192.168.1.5 while my routers local port is 192.168.1.1

named.conf is at /etc/namedb and has the following directory structure:


```
drwxr-xr-x  2 bind  wheel   512 Jan  3  2012 dynamic
-rwxrwxrwx  1 root  wheel     0 Dec  5 23:44 managed-keys.bind
drwxr-xr-x  2 root  wheel   512 Dec  5 23:52 master
-rw-r--r--  2 bind  wheel  9217 Dec  5 22:35 named.conf
-rw-r--r--  1 bind  wheel  3135 Jan  3  2012 named.root
-rw-------  1 bind  wheel    97 Dec  5 23:45 rndc.key
drwxr-xr-x  2 bind  wheel   512 Jan  3  2012 slave
drwxr-xr-x  2 bind  wheel   512 Dec  6 00:10 working

./dynamic:
total 0

./master:
total 24
-rw-r--r--  1 bind  wheel  239 Jan  3  2012 empty.db
-rw-r--r--  1 bind  wheel  692 Dec  5 23:03 local.home
-rw-r--r--  1 bind  wheel  539 Nov  8 01:09 local.home.rev
-rw-r--r--  1 bind  wheel  261 Jan  3  2012 localhost-forward.db
-rw-r--r--  1 bind  wheel  250 Nov  8 01:13 localhost-reverse.db
-rw-r--r--  1 bind  wheel  329 Jan  3  2012 localhost-reverse.db.backup
-rwxr-xr-x  1 root  wheel    0 Dec  5 23:52 managed-keys.bind

./slave:
total 0

./working:
total 0
```

Would someone mind having a look at my configuration and seeing if there's anything obviously bad? I know the secret but as it may be part of the problem and I can regenerate it, I don't see much point obfuscating it.

dhcpd.conf

```
option domain-name "local.home";
option domain-name-servers 192.168.1.5, 192.168.1.1, 203.0.178.191, 203.215.29.191;

default-lease-time 600;
max-lease-time 7200;


ddns-update-style interim;
update-static-leases on;
authoritative;
log-facility local7;


key dhcpupdate {
  algorithm hmac-md5;
  secret kTWR87YP1QIS7kf8Y3tPmg==;
}



zone 1.168.192.in-addr.arpa {
         primary nroute.local.home;
        key dhcpupdate;
}


zone local.home {
        primary nroute.local.home;
        key dhcpupdate;
}


subnet 192.168.1.0 netmask 255.255.255.0 {
  range 192.168.1.150 192.168.1.200;
  option routers 192.168.1.1;
}
```

named.conf

```
options {
        directory       "/etc/namedb/working";
        pid-file        "/var/run/named/pid";
        dump-file       "/var/dump/named_dump.db";
        statistics-file "/var/stats/named.stats";

        listen-on       { 192.168.1.5; 127.0.0.1; };

//      listen-on-v6    { ::1; };

        disable-empty-zone "255.255.255.255.IN-ADDR.ARPA";
        disable-empty-zone "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.IP6.ARPA";
        disable-empty-zone "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.IP6.ARPA";

//      forward only;

        forwarders {
                203.0.178.191;
                203.215.29.191;
                8.8.8.8;
        };
};

// OMITTED BOILER PLATE DETAILS WHICH ARE AS PER [url]http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/network-dns.html[/url]

zone "local.home" {
        type master;
        file "../master/local.home";

        allow-update { key dhcpupdate; };
};

zone "1.168.192.in-addr.arpa" {
        type master;
        file "../master/local.home.rev";

        allow-update { key dhcpupdate; };
};

key dhcpupdate {
  algorithm hmac-md5;
  secret "kTWR87YP1QIS7kf8Y3tPmg==";
};
```

Thanks


----------



## kpa (Dec 5, 2012)

Move your zone files to the dynamic subdirectory, the named(8) process running as the bind user has no rights to write to the master subdirectory.

See my howto here:
Thread 33849


----------

