Set up ISC's dhcpd server

Large and small networks alike can take advantage of DHCP and often do. With the dhcpd server from Internet Systems Consortium (ISC) you can not only provide dynamic IP addresses to hosts on your network, you can also provide static IP addresses based on the host's MAC address. This is extremely useful in the case of servers that should consistently have the same IP address, but the setup of DHCP is easier than static IP addresses. One definite advantage here is in the case of network renumbering or changing; simply changing one configuration file can set up hosts with different IPs or netmasks instead of changing each host individually.

The dhcpd package is available for most Linux distributions, so it's usually a simple urpmi or apt-get away. Once it is installed, the configuration file to edit is /etc/dhcpd.conf. If you also use BIND for DNS, you can link both dhcpd and named (name service daemon) together to provide "linked" DNS and DHCP information for truly transparent network host management. However, in this example, we'll assume that dhcpd is running alone, without corresponding with named.

An example /etc/dhcpd.conf follows:

ddns-update-style none;
subnet netmask {
    option routers;
    option broadcast-address;
    option subnet-mask;

    option domain-name "mydomain.local";
    option domain-name-servers;

    range dynamic-bootp;
    default-lease-time 21600;
    max-lease-time 43200;

    host server1 {
        hardware ethernet 00:0c:ea:50:dc:fe;
    host dns {
        hardware ethernet 00:26:cb:c5:37:9f;

This is a fairly simple configuration. What we configure here is a subnet statement, where the configuration indicates we are authoritative for the subnet, with a netmask of In a nutshell, this means you can have a single dhcpd server handling address requests for different networks if the need is there.

In this network, you can see the default options that will be passed to all DHCP clients to which an address will be given: the gateway is; the broadcast address is; and the subnet mask is The domain for this network is mydomain.local and the DNS server IP address to provide to clients is (assume for a moment this is simply a caching DNS server).

Next, options for the DHCP clients are provided: addresses in the range of to are available, which means that 55 DHCP clients may be obtaining IPs at a time. The default lease time for IPs provided is 21600 seconds, or 6 hours. The maximum lease time for an IP address is 12 hours.

Finally, the host statements allow for the configuration of single hosts, which is where the use of DHCP for servers that require a static IP is exceptionally useful. With the above, the host server1 is provided the static IP address of; the determination of the host server1 is the noted MAC, or hardware ethernet, address. If this host ever changes hardware, be it the full system or a new network card, this will need to be updated to reflect the new MAC address for that system.

A second static IP declaration is made for the host dns.

Once /etc/dhcpd.conf is configured and saved, exit the text editor and start the dhcpd server (usually "service dhcpd start"). Also make sure that any other DHCP servers on the network -- such as any that may be enabled on a firewall or router -- are disabled.

Delivered each Tuesday, TechRepublic's free Linux and Open Source newsletter provides tips, articles, and other resources to help you hone your Linux skills. Automatically sign up today!