DHCP Daemon

General Information

This guide will explain how to install and some basic configuration of the Internet Software Consortium (ISC) DHCP server. The DHCP protocal is an easy way to dynamically assign IPs over a network as well as set other options like dns servers and gateways network-wide. It can also be used to assign a static IP to a machine by using its MAC address.


  1. Local root access on the box or be able to su to root.
  2. Your favorite text editor (I like nano).
  3. A SSH client like puTTy or SecureCRT (only if not logging on locally).
  4. A LAN of some sort with at least one other computer to test everything after you’re done.


The ISC DHCP daemon is already on the ports tree so it’s quite simple to install.

# cd /usr/ports/net/isc-dhcp3-server
# make install clean; rehash


The first thing to do is to edit the startup script.

# cd /usr/local/etc/rc.d/
# mv isc-dhcpd.sh.sample isc-dhcpd.sh
# nano -w isc-dhcpd.sh

Look for two lines that look like “dhcpd_options” and “dhcpd_ifaces“. Under dhcpd_options, you want -q (this eliminates a terribly annoying banner every time the server’s started up. Under dhcpd_ifaces, you want to list the network device you want the DHCP daemon to listen on (ex: xl0).

Save and quit. Now it’s time for the server configuration.

# cd /usr/local/etc
# nano -w dhcpd.conf

My configuration looks something like the following:

ddns-update-style none;
subnet netmask {
        default-lease-time 144000;
        max-lease-time 192000;
        option subnet-mask;
        option broadcast-address;
        option routers;
        option domain-name-servers;
        option domain-name "internal.lan";
        option netbios-name-servers;
        use-host-decl-names on;
  host switch {
   hardware ethernet 00:00:00:00:00:00;

Most of the options should be fairly obvious what they do/set if you’ve done any sort of network configuration or management before, but just in case, I’ll go over them. The subnet and netmask declaration are the IP and subnet you’d like to use (you have to declare this again for the range or scope you’d like your DHCP server to dish out IPs for). In this example, I use 10.10.10.x with a subnet of so that’s what it’s set up as. If you’re using 192.168.1.x for your network, then use for the first line instead of my; that’s fairly straightforward.

Next is the range or scope you’d like your DHCP server to dish out IPs in. This is very straightforward and I don’t feel it needs any further explanation.

The max-lease-time is the lease time (in seconds) for an IP. The lease time is how long it’ll be before the DHCP daemon cycles through and sees if the IP’s currently in use and either renews the lease or frees the IP accordingly.

subnet-mask is straightforward. This must match the netmask declaration at the beginning.

The broadcast-address must be at the end of your range. In this example, it’d be; if you’re using 192.168.1.x then it’d be

The routers option specifies a machine/device acting as a gateway for internet access. If you don’t have any, simply delete this line and pretend it doesn’t exist (like for a LAN party DHCP server without Internet access).

domain-name-servers specifies DNS server IPs. This is always good to be set to some sort of DNS server, even if it’s not on your internal LAN.

netbios-name-servers are the WINS servers on your network if any. If you don’t have any, simply delete this line and pretend it doesn’t exist.

use-host-decl-names simply let’s me use the block below that’s an example on how to designate a static IP based on a MAC address. If you don’t need such a thing, simply delete it.

The last block is simply an example on how to designate a static IP address for something based on its MAC address. In this case, I want to have my switch use the IP so I can telnet to it and tinker with it’s configuration. This is optional and doesn’t have to be in the configuration file.

Just in case:

# chmod 755 /usr/local/etc/rc.d/isc-dhcpd.sh

Then just run the following to start that puppy up:

# /usr/local/etc/rc.d/isc-dhcpd.sh start

And there you have it. Set your test machine to use DHCP, request an IP, and it should get one. Now, that was simple, wasn’t it? The current list of IP leases is kept in the file /var/db/dhcpd.leases which you can open with your favorite text editor and take a peek at any time to see what’s using what on the network.

Speak Your Mind