If you’ve seen my recent blog post on making Android work in Hyper-V you will have seen my problems around DNS resolution when in the office. That turned out to be down to the DHCP options being handed back by our Server 2008 R2 box. Or rather, it was what wasn’t being handed back to the client that was the problem.
Linux (and Apple OSX, as it turns out) both want a response to option 119, which defines the domain suffix search order. Windows does not request this option and the windows DHCP server does not offer the option at all.
There are a few locations on the web that talk around this but none properly document the process of adding the custom option to your DHCP server and more importantly, exactly how to encode the response (thanks go to Matt for describing that one in enough detail!).
What option 119 looks like
Option 119 hands back a byte array that encodes the domain suffix. The trouble is, it’s not a simple matter of turning text into ascii hex values. There is a structure to it.
Our domain is blackmarble.co.uk. I found a handy web site that sped up the process of getting the hex of that.
The client expects the full domain to be split (get rid of the separating periods), with each section prefixed by it’s length (e.g. 11 blackmarble 2 co 2 uk) and then the whole string is null terminated.
Adding the option to Server 2008 R2
To add the DHCP option to Windows Server 2008 R2 you need to add a new option to the IPV4 section. Select ‘Set Predefined Options’ from the context menu on the IPV4 heading beneath the name of the server in the DHCP console.
In the dialog that appears, click the Add button.
Enter the name for new option. It needs to be of type Byte and make sure you check the array option; the Code is 119 and you can add a description if you want to.
Once you’ve defined the option you can add it either to the main Server Options section, a scope or an individual address reservation.
Each of the hex values you worked out (see my examples) needs to be added in turn to create the full byte array.
Hopefully this pulls all the necessary information into one handy reference and it saves somebody else the confusion I experienced.