DHCP options

Also known as: DHCP option 66

On this page 7

DHCP options are the type-length-value fields carried in DHCP messages that deliver every configuration parameter beyond the IP address itself, such as the subnet mask, default gateway, DNS servers, lease time and boot server. In address configuration within networking, options are what turn a bare address assignment into a complete, working network setup for a client.

The option format is inherited from BOOTP and is defined for IPv4 in RFC 2132, with many later RFCs adding new codes. A familiar example is DHCP option 66, which tells IP phones and network-booting devices the name of the TFTP server holding their configuration or boot image.

How DHCP options are encoded

Every DHCPv4 message has a fixed header followed by a variable options field. The field begins with the magic cookie 99.130.83.99, which identifies the content as DHCP options rather than legacy BOOTP vendor data. Each option then consists of a one-byte code, a one-byte length and the value itself, so a single option can carry at most 255 bytes of data.

Two codes are special: code 0 (Pad) is used for alignment and has no length byte, and code 255 (End) marks the end of the list. When a value is longer than 255 bytes, RFC 3396 allows it to be split across several instances of the same option, which the client concatenates. If the options field itself runs out of space, option 52 (Option Overload) lets the server reuse the legacy sname and file header fields for additional options.

Clients state what they want through option 55, the Parameter Request List, a list of codes the client is prepared to use. Servers generally return the requested options that are configured for the scope, plus a small set of mandatory ones, and should not send options the client did not ask for unless policy requires it.

The most important option codes

A few dozen options cover nearly all deployments. The table below lists the codes that administrators meet most often and the value format each one carries.

CodeNameValue formatTypical use
1Subnet maskIPv4 maskDefines the local network size
3RouterList of IPv4 addressesDefault gateway
6Domain name serverList of IPv4 addressesDNS resolvers
15Domain nameText stringDefault DNS suffix
42NTP serversList of IPv4 addressesTime synchronization
51IP address lease time32-bit secondsLease duration
53DHCP message typeOne byteIdentifies DISCOVER, OFFER and others
66TFTP server nameText stringPhone and boot provisioning
67Bootfile nameText stringPXE boot image path
82Relay agent informationSub-optionsSwitch port and circuit identification
121Classless static routePrefix and gateway pairsAdditional routes
Frequently used DHCPv4 option codes

Some options are protocol control fields rather than configuration. Option 53 identifies the message type, option 50 carries a requested address, option 54 identifies the server, and option 61 supplies a client identifier that may be used instead of the MAC address to match a DHCP reservation.

Option scopes, classes and precedence

DHCP servers let administrators define options at several levels, and the most specific level wins. This hierarchy keeps common settings in one place while still allowing exceptions for a single subnet or device.

LevelApplies toExample setting
Server or globalAll scopes on the serverCompany DNS servers and domain name
Scope or subnetOne DHCP scopeDefault gateway for that VLAN
Class or policyClients matching a vendor or user classBoot file for one device family
ReservationOne specific clientUnique NTP or TFTP server
Typical levels at which DHCP options are configured

Classes are matched using identifiers that clients send. Option 60, the Vendor Class Identifier, lets a server recognize device families such as PXE clients or a particular phone model. Option 43, Vendor-Specific Information, then returns data whose internal structure is defined by the vendor; wireless access points, for example, often use it to locate their controller. Option 77 carries a user class, which administrators can set on clients to group them by role.

DHCP options in IPv6 and relayed networks

DHCPv6 uses a different option space, with two-byte codes and two-byte lengths, defined in RFC 8415. Codes do not map one to one: DNS servers are option 23 and the domain search list is option 24. There is no default gateway option in DHCPv6, because IPv6 hosts learn their routers from router advertisements.

The comparison below summarizes the main differences an administrator must keep in mind when running both protocols.

AspectDHCPv4DHCPv6
Code and length size1 byte each2 bytes each
Maximum single value255 bytes without splitting65,535 bytes
Default gatewayOption 3Not provided, router advertisements used
DNS serversOption 6Option 23
Relay informationOption 82Interface-ID and Remote-ID options
DHCPv4 options compared with DHCPv6 options

In relayed networks, a DHCP relay forwards client broadcasts to a central server. The relay can insert option 82 with sub-options such as Circuit ID and Remote ID, which identify the switch port or line the request came from. Servers use this information for port-based address policies, and the relay strips option 82 before passing the reply back to the client.

Common mistakes and troubleshooting

Most DHCP option problems produce clients that receive an address but still cannot work correctly. The table maps frequent symptoms to their usual causes.

SymptomLikely causeFix
Address received but no internetOption 3 missing or wrongSet the correct gateway on the scope
Names do not resolveOption 6 points to unreachable serversCorrect the DNS server list
Phones fail to provisionOption 66 holds a wrong name or IPVerify the TFTP server value and reachability
PXE boot loads wrong imageOption 67 not matched to client architectureUse class-based policies for BIOS and UEFI
Static routes ignoredOption 121 sent alongside option 3 incorrectlyInclude the default route inside option 121
DHCP option faults and their fixes

A subtle rule in RFC 3442 states that when a client receives option 121, it must ignore option 3, so the default route has to be listed inside option 121 itself. Another frequent error is sending an option with the wrong data type, such as an IP address where a text name is expected; many phones treat option 66 as text, while some firmware accepts only an address. Packet captures of the DHCP exchange remain the fastest way to see what the server actually sent.

The idea in brief

When a device joins a network, it needs more than an address. It must know where the exit to the internet is. It must know which server translates names into addresses. Some devices also need to know where to fetch their settings.

DHCP options are the extra notes attached to the address. Think of a hotel key card that comes with a small leaflet. The leaflet lists the Wi-Fi, breakfast hours and the reception number. The key gets you in, and the options tell you how to use the place.

A practical scenario

An office of 300 people moves to a new building with a voice VLAN for 120 desk phones. The network team creates a scope of 10.20.30.0/24 with option 3 set to the VLAN gateway 10.20.30.1, option 6 pointing to two internal DNS servers and a lease time of eight hours in option 51.

On first boot, the phones obtain addresses but show a provisioning error. A packet capture reveals that option 66 is absent, because it was configured only on the data VLAN scope. The team adds option 66 with the provisioning server name to the voice scope and uses a vendor class policy based on option 60 so that only phones receive it.

After the phones are restarted, all of them download their configuration within minutes. The outcome is fully automated provisioning with no manual settings on any handset, and future phones of the same model will configure themselves the moment they are plugged in.