Submitted by ramez.hanna on Thu, 24/03/2005 - 12:44.

i've had this in mind for a very long time and finally i could do it yesterday
in the windows world (where i used to live before) you could easily with a couple of mouse clicks get a DNS and a DHCP servers running on your lan up and running.
why would you do that? because you would like to have workstations resolving each other's IPs without using the stupid netbios over tcpip and in linux you would need that defenitley to be able to resolve names without doing it by hand in the /etc/hosts file.
let's start . . .
first here is the setup i have
i have a server SERVER (192.168.0.2) workstations STATION1-3 (192.168.0.1-3) the DSLrouter (192.168.0.1)
i want the stations to get dynamic ips from the server through DHCPD and update their records in the DNS server
to do this you'll need to :

  • install BIND9.x (named) DHCPD3.x
  • configure DHCPD (/etc/dhcpd.conf)
  • configure NAMED (/etc/named.conf)
  • create zone files
  • start the services and monitor /var/log/messages for any errors and fix them

dhcpd.conf


# /etc/dhcpd.conf
#
# Global Settings
#

# Turn on Dynamic DNS:
ddns-update-style interim;
ddns-updates on;

# Don't allow clients to update DNS, make the server do it
# based on the hostname passed by the DHCP client:
deny client-updates;
allow unknown-clients;

#
# 192.168.0.0/255.255.255.0 Scope Settings
#
subnet 192.168.0.0 netmask 255.255.255.0 {

        # Range of DHCP assigned addresses for this scope
        range                           192.168.0.3 192.168.0.6;
        # 1 day
        default-lease-time              86400;
        # 2 days
        max-lease-time                  172800;

        # Configure the client's default Gateway:
        option subnet-mask              255.255.255.0;
        option broadcast-address        192.168.0.255;
        option routers                  192.168.0.2;

        # Configure the client's DNS settings:
        option domain-name              "lab.local";
        option domain-name-servers      192.168.0.2;

        # If you want the client to be configured to also use
        # a WINS server:
        option netbios-name-servers     192.168.0.2;
        option netbios-node-type        8;

}

named.conf


## /etc/named.conf
options {

        directory "/var/named";
};

controls {
        inet 127.0.0.1 allow { localhost; } keys { rndckey; };

};
zone "." IN {
        type hint;
        file "named.ca";
};

zone "localhost" IN {

        type master;
        file "localhost.zone";
        allow-update { none; };
};

zone "0.0.127.in-addr.arpa" IN {
        type master;
        file "named.local";
        allow-update { none; };
};

zone "lab.local" IN {
        type master;
        file "lab.local";
        allow-update { localhost; };
};

zone "0.168.192.in-addr.arpa" IN {
        type master;
        file "192.168.0.rev";
        allow-update { localhost; };
};

include "/etc/rndc.key";


i won't go into details of creating the zone files cause that's the most easy part or maybe someone would update the article and add it.
now it should be working
note : FC3 users or any other SELINUX enabled distro users must modify the selinux security policy to allow named to overwrite the zone files (in FC3 is done using the security-level tool)
hope it was helpful to any of you
references http://voidmain.kicks-ass.net/redhat/redhat_9_dhcp_dynamic_dns.html .. http://www.csd.uwo.ca/staff/magi/doc/bind9/Bv9ARM.html