digital adj. Having digits.     peer n. A comrade; a companion; a fellow; an associate. inmotion    
   
Recent Articles
Stop DNSMasq From Forwarding Local Hostnames
Saturday, September 25, 2010
Securing your Wireless LAN
Wednesday, August 18, 2010
Some tips and things you might not know about your wireless network.
Using Different Subversion Client Versions
Wednesday, August 18, 2010
Handling a Subversion Repository URL Change
Sunday, May 3, 2009
If your repository URL changes, you can use the following command to fix existing snapshots.
vfat Mounts Default to Lowercase Shortnames
Tuesday, April 21, 2009
I want a "this is brain-damage" quote from Linus for this mess.
VirtualBox or VMWare Virtual Machine at Login
Sunday, April 12, 2009
How to start a virtual machine in X when a user logs in.
Dialog Progress Bar Through Pipe
Sunday, April 12, 2009
How to use dialog to display a script progress bar and communicate progress to it through a named pipe.
Mount JFFS2 Image
Saturday, October 25, 2008
Example of how to mount a JFFS2 image using mtdblock.

Programmer n. - An ingenious device that turns caffeine into code.

Sys Admin-Linux...-Setting up...

Setting up Linux DHCP Server with Dynamic DNS Support

Sunday, August 8, 2004 by digitalpeer, updated Sunday, August 8, 2004

This tutorial will explain how to setup DHCP to dynamically update a local DNS server. I use Red Hat/Fedora but these are common steps you'll have to use with just about any flavor of these Linux services.

Setting up the Server


For starters, lets configure the /etc/dhcpd.conf file. It's pretty self explanitory. If you are planning on setting up a local DNS server leave in the 3 lines pertaining to Dynamic DNS, otherwise take them out.
#
# Global Settings
#

# Turn on Dynamic DNS:
ddns-domainname "domain.lan";
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;

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

        # Range of DHCP assigned addresses for this scope
        range                           10.0.0.100 10.0.0.200;
        # 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        10.0.0.255;
        option routers                  10.0.0.2;

        # Configure the client's DNS settings:
        option domain-name              "domain.lan";
        option domain-name-servers      10.0.0.1;

}

Now things get a little tricky. If you have Windows clients you are going to need to modify the /etc/rc.d/init.d/dhcpd file. In the start() directive you should see a line that looks something like
daemon /usr/sbin/dhcpd ${DHCPDARGS}

Comment that out with a # and add in the following lines. If you want, add in the DHCPDARGS also, but I don't really use it.
/sbin/route add -host 255.255.255.255 dev eth0 2> /dev/null
daemon /usr/sbin/dhcpd eth0

Make sure you set the ethx to the network interface you want to serve dhcpd requests on. This is particularly vital if you have a multihomed server.

Setting up the Client


The client needs to send a hostname for this to work correctly. The DHCP server needs to know what hostname to set in DNS. Windows does it by default, however you'll need to make sure your /etc/sysconfig/network-scripts/ifcfg-ethx file looks something like this (with the DHCP_HOSTNAME directive set properly.
# make sure this line is has no settings on it!
DEVICE=eth0
BOOTPROTO=dhcp
HWADDR=01:01:01:01:01:01
ONBOOT=yes
TYPE=Ethernet
DHCP_HOSTNAME=host
USERCTL=no
PEERDNS=yes

Now, you should go have a beer and explain what you just did to your girlfriend.
Comment Friday, February 11, 2005 by  anonymous
EXECELENT
Comment Saturday, March 19, 2005 by  anonymous
nice article! what about the different startup -script for the dhcp-server when using windows and linux - clients?

greetings, dave (dave at dgx dot de
Comment Wednesday, March 23, 2005 by  anonymous
I have read lots of docs and this one provided the key to making DDNS work on my system. Thank you so much!
Comment Thursday, April 15, 2010 by  by anonymous
ddfdsfdfd

Submit Comment to This Article
Please post a comment if you have something to add, find something wrong, or would like more information on the topic at hand. Do not use the comment form to contact the author about unrelated concerns!

Name: Email (optional):
Enter verification number here: