Scott's Weblog The weblog of an IT pro focusing on cloud computing, Kubernetes, Linux, containers, and networking

Client-Specific DHCP Options with Linux DHCP Server

Last week, I had a need to present a different set of DHCP options to one specific DHCP client (my iPhone) on my home network. Being the geek that I am, I have a small server set up here at the house running Ubuntu Linux. (You can read about the latest evolution of my home network in this article.) Now, I knew that this was possible using the Windows DHCP server, but I’d never done it with the Linux DHCP server. So, in case you find yourself in a similar situation, here’s how it works.

The Linux DHCP server configuration file (typically dhcpd.conf) is broken into different blocks. For example, the “main” portion of the configuration file might look something like this:

subnet netmask {  
option routers;  
range dynamic-bootp;:  
option domain-name-servers,; }

If you want to set up a reservation—so that a particular DHCP client always gets the same IP address—you set up additional blocks, like this:

host <hostname> {  
    hardware ethernet 00:11:22:33:44:55;  
    fixed-address; }

As it turns out, if you want to specify a different set of DHCP options to a client with a reservation (for example, in my situation I wanted to specify a different set of DNS servers), you just add a declaration to the client-specific section:

host <hostname> {  
    hardware ethernet 00:11:22:33:44:55;  
    option domain-name-servers; }

Of course, now that I know this it seems incredibly obvious. At the time that I was trying to figure this out, though, I wasn’t sure exactly what the syntax would look like. So, next time you find yourself needing to change the options on a DHCP reservation on Linux, you’ll know what to do!

Metadata and Navigation

Be social and share this post!