/* Void Main's Red Hat/Fedora Tips */

{ Red Hat/Fedora Tips(); } else { main(); }
DHCP and Dynamic DNS server on Red Hat
#include <stddisclaimer.h>

Pros: If you have a fairly diverse network with several computers it is nice to have proper DNS name resolution between them. Configuring computers is much easier when you are running a DHCP server and having DNS automatically updated is a huge bonus.

Not only will this work for DHCP Linux clients but it will work with Windows and clients using other operating systems. It can even assign WINS servers to your Windows clients among a multitude of other options.

Cons: None.

Ok, I'm convinced, now how do I set this up?

Let us begin:

First make sure you have the necessary RPMs installed:

# rpm  -qa  |  egrep  "^bind|^dhcp"

Which should show you have the following three RPMs installed:


If you do not have these three RPMs installed either install them from your Red Hat CD or if you have installed "apt" according to this tip for Red Hat 8.0 or this tip for Red Hat 9 you can just install them by:

# apt-get  install  bind-utils
# apt-get  install  dhcp

Now, let's install my sample configuration. If you have previous DHCP/DNS configurations you might want to back them up now. Get and install the sample by:

# cd  /tmp
# wget  http://voidmain.is-a-geek.net/files/dhcp-dyndns.tar.gz
# cd  /
# tar  -xvzf  tmp/dhcp-dyndns.tar.gz

This sample configuration is an example of my home network (well, not really but it could be) that you can easily change to match your home (or business) network preferences. I use the DNS domain "voidmain.home" so as to ensure not to conflict with any real domains on the public Internet. If I set my private domain name to say "google.com" none of my clients would be able to use google. Below are the key machines in my domain:

gateway.voidmain.home -
ns1.voidmain.home -

Now in addition to the services that should be obvious by their names these machines also perform many other duties. They have static IP addresses and I have also assigned more host names to these addresses in the static portion of my DNS configuration. For instance, is also providing my firewall capability so I assign the name "fw.voidmain.home" to it. in addition to being the DNS server that we are performing this configuration on, it also is the DHCP/WINS/PDC, Intranet web server, internal mail server etc. So we assign more names to it (dhcp.voidmain.home, pdc.voidmain.home, www.voidmain.home, mail.voidmain.home, etc). Click network map below for a graphical view:

Sample Network

Obviously these services could all be run on different names and if you have different machines doing different functions just update the addresses accordingly. DNS makes it easy to move a service from one machine to another because you only have to change one address in a single DNS configuration file when you move that service. All of your clients will see the change immediately.

Ok, now that you have installed my sample configuration you will want to go through each file and change the domain names and IP addresses to your liking. The files that you will need to look at are:


I like to use VIM as my editor for making changes to these files but you can use any text editor you want. I like VIM because of the syntax highlighting (among many many other powerful features):

named.conf in vim voidmain.home.zone in vim

If you don't use as your network you will want to change this to reflect your needs as well. Be very careful when editing the files not to remove the trailing "." on some of the names. This is critical. Once you have the configuration files modified to your needs you can set the services to start at boot time and start them immediately by:

# chkconfig  dhcpd  on
# chkconfig  named  on
# service  dhcpd  start
# service  named  start

Look very carefully at the tail end of your /var/log/messages for any errors. Fix errors as needed (if you use the stock files in my example with no changes you should get no errors).
Now, turn off any other DHCP server you might have running on the local network (Cable/DSL router's usually come with DHCP turned on and you don't want your clients using it for DHCP any longer so disable it).

On the server running these DNS and DHCP services you'll want to configure the DNS client to point to the loopback interface by modifying /etc/resolv.conf:

search voidmain.home

On your other servers that are configured with a "static" IP address you will want to configure them to point to your new DNS server:

search voidmain.home

The /etc/resolv.conf file should automatically be created on your DHCP client machines when their network interface is activated so you need not worry about them.

Now configure your clients to use DHCP. For Windows just follow the normal Windows instructions of using DHCP. For Linux clients you want to make sure that in addition to setting your network interface to use DHCP, you also want your client to send it's hostname to the server so it can update DNS automatically. Here is an example in Red Hat 8.0/9 DCHP client configuration:

Red Hat 8.0/9 dhcp client

If all goes when when you activate the interface on your client you should automatically be assigned an IP address and entered into DNS. As you can see in the example above I have configured my laptop with the name "laplinux" and it should show up to all of my other machines with the name "laplinux.voidmain.home" or just "laplinux" since we have "voidmain.home" as our search domain.

You can test them by using the host, nslookup, or ping commands:

$ host  laplinux
$ host  laplinux.voidmain.home

Which should return a TCP/IP address:

laplinux.voidmain.home has address

You can test the reverse lookup by using the host or nslookup command with the IP address:

$ host

Which should return a name: domain name pointer laplinux.voidmain.home.

You should also notice a two more files in your "/var/named" directory. One for your forward zone file and one for your reverse zone file and have an extension of *.jnl.

If you make a change to your named.conf or zone files you can signal the named server to reload the configurations by:

# service  named  reload

NOTE: This tip doesn't just apply to Red Hat, it should work for any distro of Linux running the latest DNS and DHCP servers with the possible exception of how the software is installed.

NOTE2: You will not be able to use the graphical Red Hat DNS configuration utility after following these instructions. But I find that configuration tool confusing and limiting (like most graphical tools). I am not sure if it can even be used to configure your DNS server to do dynamic DNS. If you know otherwise I would be interested in hearing your feedback.

NOTE3: DNS and DHCP are fairly complex services and although this tutorial should get you up and running, there are several concepts and terms that it would benefit you to learn.

In DNS it would be beneficial to know what the numbers mean in the SOA section of the zone files (the top) especially if you have more than one DNS server in a large network. It would be beneficial to know what TTL is and reasons for using different TTL settings. It would be beneficial to understand how the "serial number" works in a zone file, and know that it is automatically changed by DHCP in a dynamic DNS setup like this. Changing it manually can cause problems. I hope that giving you the basics for getting the servers up and running will jump start you into learning how the services actually work. I am considering all of these things to be beyond the scope of what I set out to accomplish with this simple tip.

If you believe I need to add more information to this tip, or if you have troubles or comments, you can post a note on my forums.

Internet Software Consortium - BIND
Internet Software Consortium - DHCP
BIND 9 Administrator Reference Manual
Red Hat 8.0 Customization Guide
Red Hat 9 Customization Guide
And the man pages have extensive information:
$ man dhcpd
$ man dhcpd.conf
$ man dhcpd.leases
$ man dhcp-options
$ man named
$ man named.conf
$ man rndc
$ man rndc.conf

Have fun!


Valid HTML 4.01!