DHCP Option¶
The DhcpOption object represents a single DHCP protocol option as defined by RFC 2132 and its extensions. It is a helper structure embedded within Subnet, Lease, and Reservation objects rather than a standalone API resource with its own endpoints.
Each DhcpOption consists of a numeric Code (the DHCP option number) and a string Value. The Value field supports Go template expansion, which is evaluated in the context of the DHCP request's incoming options. This allows dynamic responses based on the requesting client's characteristics. The Value string is parsed according to the option code's type: IP addresses for options like subnet mask and routers, comma-separated IP lists for multi-address options like DNS servers, integers for time and size options, plain strings for hostnames and domain names, and raw byte sequences for unrecognized option codes. Values can also be prefixed with string: to force raw string encoding.
Common DHCP options include option 1 (subnet mask), option 3 (default gateway), option 6 (DNS servers), option 15 (domain name), and option 67 (boot filename). See the Subnet documentation for examples of template-based option values.
Fields¶
| Field | Definition |
|---|---|
Code |
A byte that holds the numeric DHCP option code. See RFC 2132 and friends for what these codes can be. |
Value |
A string that will be template-expanded to form a valid value to return as the DHCP option. Template expansion happens in the context of the source options. |