Launching the DHCP server on your gateway

Below is a simple dhcpd configuration file, dhcpd.conf.

This file includes a subnet range that's dynamically assigned to clients, but also contains two static entries for known servers that are expected to be present at certain IP addresses. One is a printer server, and the other is a network-enabled toaster. The DHCP server configuration isn't specific to wireless networks, and you can apply it to wired networks as well.

ddns-update-style none;

#option subnet-mask;
default-lease-time 86400;
#max-lease-time 7200;

subnet netmask {
        option broadcast-address;
        option routers;
        option domain-name-servers;
        option domain-name "";

        host printerserver {
               hardware ethernet 00:50:BA:85:EA:30;

        host networkenabledtoaster {
               hardware ethernet 00:A0:D2:11:AE:81;

The nameserver, router IP, and IP address will be supplied to your wireless network clients. The router IP address is the IP address of the gateway's wireless network interface that's connected to your wireless network. The nameserver is set to the gateway's wireless network adapter, since the gateway is also handling name serving services. The gateway nameserver will redirect requests for unknown hostnames to the ISP nameserver. The internal wireless network has been defined to be Note that we've reserved IP address range through for static IP address assignment; the dynamic range starts at

Now that we have the configuration file, we need to start dhcpd.

We need to make sure that the directory /var/run exists, as well as /var/state/dhcp. The file /var/state/dhcp/dhcpd.leases must exist. You can create an empty file for the initial start of the dhcpd binary.

When you start dhcpd, you must tell it where to find the configuration file if it isn't in the default location. You also need to pass an interface name, as you want only dhcpd to service your internal wireless network interface. If we used the fictitious ABC adapter from the wireless discussion, this would be abc0:

dhcpd -cf /etc/dhcpd.conf abc0

Your DHCP server should now be running. If there are any issues, you can start dhcpd in a debugging mode using the -d option. The dhcpd daemon also logs messages to the system log, slogger2.

The dhcrelay agent doesn't require a configuration file as the DHCP server does; you just need to launch a binary on the command line.

What you must know is the IP address of the DHCP server that's located elsewhere on the network that your gateway is connected to. Once you've launched dhcrelay, it forwards requests and responses between the client on your wireless network and the DHCP server located elsewhere on the ISP or corporate network:

dhcrelay -i abc0

In this case, it relays requests from wireless interface (abc0), and forwards these requests to the DHCP server