Advanced DHCP functionalities

Home » Current Events »

Advanced DHCP functionalities

DHCP is a powerful tool to manage and configure our workstations. In this article, we will see some functionalities that go beyond the usual uses.

All know the DHCP (Dynamic Host Configuration Protocol) service as the protocol that allows us to automatically configure the IP configuration of our equipment, forgetting about having to do it manually.

All know the DHCP (Dynamic Host Configuration Protocol) service as the protocol that allows us to automatically configure the IP configuration of our equipment, forgetting about having to do it manually. This is especially useful nowadays, when we connect our laptops and smartphones everywhere. Can you imagine having to hand over the IP address of your iPhone?

The basic functionality of DHCP is to dynamically assign an IP, a mask and a gateway to our equipment. What not everyone knows is that DHCP has a whole series of extensions that allow us to assign a multitude of interesting parameters at boot time.

If, moreover, we have an advanced server, we can make our DHCP a powerful tool to manage our networks.

At inLab FIB, we have been using the ISC (Internet Systems Consortium) DHCP server for a long time. This server is competent and stable, and has, moreover, a mini-programming language.

We can use options for special parameters, such as:

  • A boot fitxer (option filename “BStrap/X86pc/BStrap.0”;)
  • The remote printer server (option lpr-servers ip-address)
  • The time-server (option ntp-servers ip-address)
  • The TFTP server (option next-server ip-address)

You can consult the complete list of predefined options in RFC 2132.

In addition to the predefined options, we can create our own options, and even complex data structures, to store and pass on our own information.

option inLab-priv-sala  code 1 = text;
option inLab-priv-hw    code 3 = text;
option inLab-priv-es-pc code 2 = {boolean, integer 32, text };
option inLab-priv-rutas code 4 = array of {ip-address,
                                 ip-address,ip-address,integer 8};

Options 1 and 2 contain a single string. The 3 contained a tuple formed by a boolean, a single name and a string. The fourth option, defines an array of structures formed by 3 IP addresses and  a single name.

Thus, for example, we could tell a PC, from the DHCP, which room it is in or a description of its machine.

host  venus {
hardware ethernet 24:BE:05:23:5E:F2;
option netbios-name-servers;
option domain-name "";
option domain-name-servers,;
option inLab-priv-es-pc false 2011 "portatil de prestec";
option inLab-priv-sala "Campus Nord.B6.S104";
option inLab-priv-hw "ASUS Eee PC 900";
option inLab-priv-rutas 8,

Another interesting DHCP option is the “Vendor Space”. Did you know that the DHCP request includes a “Vendor Identifier” field that identifies the type of client? For example, PCs that boot from the network card have the PXE client as an identifier. The Windows client identifies itself as “MSFT”. Furthermore, Windows 98 was identified as “MSFT 98”, and Windows from W2K onwards as “MSFT 5.0”. Thus, manufacturers have been defining special fields and structures for their clients, such as, for example, the firmware version of the equipment or fields to identify the TCP/IP ports of some protocols.

Here you can see a couple of examples of predefined structures from some manufacturers.

Special fields of a Microsoft client:

option space Microsoft;
vendor-option-space Microsoft;
option Microsoft.disable-netbios-over-tcpip     code 1   = unsigned integer 32;
option Microsoft.release-dhcp-lease-on-shutdown code 2   = unsigned integer 8;
option Microsoft.default-router-metric-base     code 3   = unsigned integer 8;
option Microsoft.proxy-autodiscovery            code 252 = string

Special fields of a PXE client:

option space PXE;
option PXE.mtftp-ip             code 1   = ip-address;
option PXE.mtftp-cport          code 2   = unsigned integer 16;
option PXE.mtftp-sport          code 3   = unsigned integer 16;
option PXE.mtftp-tmout          code 4   = unsigned integer 8;
option PXE.mtftp-delay          code 5   = unsigned integer 8;
option PXE.discovery-control    code 6   = unsigned integer 8;
option       code 7   = ip-address;
option PXE.rembo-servers        code 8   = { unsigned integer 16, 
  unsigned integer 8, array of ip-address};
option PXE.boot-server-menu     code 9   = { unsigned integer 16, 
  unsigned integer 8, string};
option          code 10  = { unsigned integer 16, 
  unsigned integer 8 };
option PXE.vendor-specific-info code 43  = string;
option PXE.class-identifier     code 60  = string;
option PXE.pxe-server-name      code 66  = string;
option PXE.filename             code 67  = string;
option PXE.pxe-ip-address       code 150 = string;

Thanks to these camps, and the power of the DHCP server of the ISC, we can do things like:

class "PXE" {
 match if substring(option vendor-class-identifier,0,9) = "PXEClient";
 vendor-option-space PXE;

class "Microsoft" {
 match if substring(option vendor-class-identifier,0,4) = "MSFT";
 option vendor-class-identifier = "Microsoft";
 vendor-option-space Microsoft;

These definitions assign us a vendor-option-space, i.e., a structure and a “vendor-class-identifier” variable, a homogeneous description of our vendor. Now, we can assign special values based on these options, for example:

host astro {
 hardware ethernet 6C:62:6D:81:22:32;
 option PXE.discovery-control 11;
 option PXE.rembo-servers 43690 01;
 option Microsoft.rembo-servers 2231 01;

Imagine that you want your computers to have different DNS servers depending on the operating system that we start at every moment. How can we do it automatically? Using the information passed by the DHCP client:

host astro {

hardware ethernet 6C:62:6D:81:22:32;
if (vendor-class-identifier = "Microsoft") {
         option domain-name-servers ;
} else if (vendor-class-identifier = "PXE") {
        option domain-name-servers ;
} else {
        option domain-name-servers ;

In this example, we assign the DNS based on the client making the DHCP request. At the initial PXE startup, we will assign the server, and then, to Windows, we will assign as DNS the In other cases, for example, for a Linux client, we would assign as the server.

What the manual does not explain:

Some of the functionality described is provided by the ISC server, on the DHCP server side, but many of these improvements can only be utilized if the DHCP client is able to interpret them and pass them on to the operating system. The ISC software includes a DHCP client capable of providing all these functionalities. It is highly recommended to use this client instead of the simple client included in the most common Linux distributions. Unfortunately, the Microsoft client is only capable of interpreting a few options implemented on their DHCP server.