From last few days I am using Ubuntu as my primery OS at home. So try to setup Dynamic DNS and DHCP server on Ubuntu 10.10.

Required Packages:

Installing required packages

apt-get install bind9 dhcp3-server

Configuring Bind
First you need to make changes in /etc/hosts and /etc/resolv.conf

vi /etc/hosts	localhost	vidyadhar
vi /etc/resolv.conf

I choose domain name as
Create forward lookup zone file name in /etc/bind.

vi /etc/bind/           IN SOA (
                                1          ; serial
                                10800      ; refresh (3 hours)
                                3600       ; retry (1 hour)
                                604800     ; expire (1 week)
                                86400      ; minimum (1 day)
                                )                           IN      NS                 IN      A         IN      A

Create reveresed lookup zone file name db.192.168.1 in /etc/bind

vi /etc/bind/db.192.168.1     IN SOA (
                                1          ; serial
                                10800      ; refresh (3 hours)
                                3600       ; retry (1 hour)
                                604800     ; expire (1 week)
                                86400      ; minimum (1 day)
                                )		IN	NS	IN	PTR

Make changes in named.conf.local

vi /etc/bind/named.conf.local
zone "" in {
        type master;
        file "/etc/bind/";
        allow-update { key "rndc-key"; };
        notify yes;

zone "" in {
        type master;
        file "/etc/bind/db.192.168.1";
        allow-update { key "rndc-key"; };
        notify yes;

include "/etc/bind/rndc.key";

Configuring dhcp server

vi /etc/dhcp3/dhcpd.conf
# Basic stuff to name the server and switch on updating
ddns-updates            on;
ddns-update-style       interim;
ddns-domainname         "";
ddns-rev-domainname     "";
# Ignore Windows FQDN updates
ignore                  client-updates;

# Include the key so that DHCP can authenticate itself to BIND9
include                 "/etc/bind/rndc.key";

# This is the communication zone
zone {
        key rndc-key;

# Normal DHCP stuff
option domain-name              "";
option domain-name-servers;
option ip-forwarding            off;

default-lease-time              600;
max-lease-time                  7200;
log-facility			local7;
allow booting;
allow bootp;

# Tell the server it is authoritative on that subnet (essential)
subnet netmask {
        range                 ;
        option broadcast-address;
        option routers        ;
        allow                           unknown-clients;
        filename "pxelinux.0";

        zone {
                key "rndc-key";

        zone localdomain. {
                key "rndc-key";

Changes in named.conf.options

vi /etc/bind/named.conf.options
options {
        directory "/var/cache/bind";

        // If there is a firewall between you and nameservers you want
        // to talk to, you may need to fix the firewall to allow multiple
        // ports to talk.  See

        // If your ISP provided one or more IP addresses for stable
        // nameservers, you probably want to use them as forwarders.
        // Uncomment the following block, and insert the addresses replacing
        // the all-0's placeholder.
        // allow localhost to perform updates

        forwarders {

        auth-nxdomain no;    # conform to RFC1035
        listen-on-v6 { any; };

        controls {
        inet allow { localhost; } keys { "rndc-key"; };

Assign permissionz

chmod g+w /etc/bind
chmod +r /etc/bind/rndc.key

Apparmour changes
Add following line in apparmour before closing “}”

vi /etc/apparmor.d/usr.sbin.dhcpd3
/etc/bind/ rw,
/etc/bind/** rw,

Now start dhcp & bind

/etc/init.d/apparmor restart
/etc/init.d/dhcp3-server start
/etc/init.d/bind9 restart

For troubleshooting you can check /var/log/daemon.log file

DDNS & DHCP server on Ubuntu
Tagged on:                                                                             

6 thoughts on “DDNS & DHCP server on Ubuntu

    • January 3, 2011 at 9:46 am

      I dont agree… Is there any specific reason to do so?

  • January 16, 2011 at 2:19 am

    Absolutely fantastic. You, sir, are a God among men. This saved me twice in the last few weeks when my old Fedora 7 gateway machine went down (twice!) and I had to rebuild using Ubuntu 10.04 LTS. My one comment is that it seems the original design of the DNS package does point to storing the zone files in /var/lib/bind.

    My evidence is found in package default /etc/apparmor.d/usr.sbin.named in which the following two lines show the intent of the designers to store zones in that directory.

    /var/lib/bind/** rw,
    /var/lib/bind/ rw,

    I fought with the apparmor settings trying to get it to read zone files out of /etc/bin for a while before giving up and moving them to /var/lib/bind.

    I am sure it’s possible to get them there as it appears you did it but I had less of a fight with apparmor by doing it the “approved” method.

  • Pingback:Mehrdust » Blog Archive » DHCP server on ubuntu

  • Pingback:DHCP & Dynamic DNS in Ubuntu 10.10 | Cumptrnrd's Blog

  • Pingback:DynDNS DHCP Bind – Ubuntu 14.04 Trusty | Cymea Blog

Leave a Reply

Your email address will not be published. Required fields are marked *