Troubleshooting DHCP


Not all configurations go as smoothly as you might like. When you’re troubleshooting the DHCP server, there are a few things to watch out for. For example, in the main config file, /etc/dhcp/dhcpd.conf, make sure that you end all your options with a semicolon (;). If you don’t, the service throws an error when you check the config file. Also, make sure that you also test the DHCP server after the firewall rules are in place. For client troubleshooting, the DHCP server provides a client leases file. This file contains all the lease information about each client that has obtained an IP address from the server. When you have a client that has a DHCP address, you can view the leases file by using the following:

# cat /var/lib/dhcpd/dhcpd.leases
lease 172.168.1.200 {
starts 2 2010/05/11 12:24:10;
ends 2 2010/05/11 18:24:10;
tstp 2 2010/05/11 18:24:10;
binding state free;
hardware ethernet 08:00:27:74:5b:11;
}
lease 172.168.1.199 {
starts 4 2010/05/20 11:24:03;
ends 4 2010/05/20 17:24:03;
tstp 4 2010/05/20 17:24:03;
binding state free;
hardware ethernet 08:00:27:2f:80:8c;
}

As you can see from the file output, two clients have active leases. When viewing the leases file, you should be careful that all times in the dhcpd.leases file are in UTC (GMT). The reason for this is that there is no daylight savings in that time zone, making it internationally usable. Make sure you pay attention to this issue if you’re trying to troubleshoot with this file. As a final tip, make sure you use the configtest option to test the syntax of your config files before starting or restarting the service. This prevents any errors from occurring when you try to start the service.

REAL-WORLD TIP

You may want to consider setting up a secondary DHCP server as a  
failover. It provides you with a backup should your primary server fail 
(don’t just rely on this secondary server, though; make sure you test  
it). If you create a failover server, you should follow the 80/20 rule: 
80% of your IP addresses should be used on your primary DHCP server, and
20% should be used on your secondary server.

results matching ""

    No results matching ""