A DHCP (Dynamic Host Configuration Protocol) option code is a numeric identifier used in DHCP messages to convey specific configuration parameters from a DHCP server to a client. These parameters can include things like IP addresses, subnet masks, gateway addresses, DNS server information, and more.
The following is a list of commonly used DHCP option codes along with their descriptions:
Subnet Mask (Option 1):
Description: Specifies the subnet mask for the client's network. This option is essential for defining the client's IP address within the correct subnet.
Time Offset (Option 2):
Description: Provides the time offset from UTC (Coordinated Universal Time) in seconds. It helps clients adjust their clocks for accurate timekeeping.
Router (Option 3):
Description: Lists the IP addresses of the routers or gateways on the network. Clients use this information to determine their default gateway.
DNS Servers (Option 6):
Description: Specifies the IP addresses of DNS (Domain Name System) servers that the client should use for name resolution. Helps clients resolve domain names to IP addresses.
Hostname (Option 12):
Description: Provides the client with its hostname. The client can use this information for identifying itself on the network.
Domain Name (Option 15):
Description: Specifies the domain name to be used by the client. It helps clients in constructing fully qualified domain names (FQDNs).
Broadcast Address (Option 28):
Description: Indicates the broadcast address for the client's subnet. Used for broadcasting messages within a specific subnet.
NTP Servers (Option 42):
Description: Lists the IP addresses of Network Time Protocol (NTP) servers for time synchronization. Ensures accurate timekeeping on client devices.
Vendor-Specific Information (Option 43):
Description: Carries vendor-specific configuration information, typically used by specific vendors or devices. Allows customization of DHCP options based on vendor requirements.
NetBIOS Name Servers (Option 44):
Description: Specifies the IP addresses of NetBIOS name servers. Used for NetBIOS name resolution on Windows networks.
NetBIOS Node Type (Option 46):
Description: Sets the NetBIOS node type for NetBIOS name resolution. Controls the method used for resolving NetBIOS names.
Lease Time (Option 51):
Description: The Lease Time option specifies the duration for which a DHCP client is allowed to use the assigned IP address before it must renew the lease. It is expressed in seconds. When the lease time expires, the client must contact the DHCP server to renew the lease or request a new IP address. This option helps manage IP address allocation and ensures that IP addresses are not held indefinitely by inactive clients, allowing for efficient IP address reuse within the DHCP scope.
Option Overload (Option 52):
Description: Indicates whether options are stored in the sname or file fields of the DHCP packet. Used when there are too many DHCP options to fit in the standard fields.
Client Identifier (Option 61):
Description: Identifies the client within the DHCP server's database. Useful when multiple clients have the same MAC address.
TFTP Server Name (Option 66):
Description: Specifies the name of the Trivial File Transfer Protocol (TFTP) server for booting. Commonly used in network boot configurations.
Boot file Name (Option 67):
Description: Provides the name of the boot file for booting via TFTP. Specifies the file to be downloaded by the client during network boot.
DHCP Relay Agent Information (Option 82):
Description: Used to provide additional information about the network location of a DHCP client. This option is particularly useful because DHCP relays append extra information to DHCP requests in environments where DHCP requests are relayed through multiple network devices, such as switches and routers, before reaching the DHCP server. The DHCP server can then use the information provided in option 82 of the DHCP request as a matching condition before providing an IP from a DHCP pool.
Captive-Portal Identification in DHCP and Router Advertisements (Option 114):
Description:
DHCP Option 114 is defined in RFC 8910. It allows a DHCP server to inform a client of a URL where it can find information about a network's captive portal, so devices can detect captive portals more reliably. This is to be set as HTTPS URI pointing to an API endpoint that returns the portal's state (e.g., whether the user is authenticated).
By not following the intention of this RFC, the option may also be used to provide a landing page to a user and solve captive portal issues if some, but not all clients, do fail the regular captive portal detection.
Classless Static Route (Option 121):
Description: Provides routing information for subnets within a larger network. Useful for directing traffic to specific subnets through appropriate gateways.
CAPWAP Access Controller (Option 138):
Description: Used to inform wireless access points (such as FortiAPs) of the IP address corresponding to potential wireless access controllers (such as those located on other subnets). This allows administrators to deploy wireless access points to the environment without needing to statically configure the controller address on each unit. See also: Technical Tip: How to configure the FortiGate to serve DHCP option 138 for WiFi Access Controller discovery.
Configuration and device provisioning (Option 160):
Description: Historically this option was used to trigger a captive portal detection, see RFC 7710 for the definition. It is now used to provide an address to download a configuration file, typically for IP Phones.
MSFT-IE Proxy Server (Option 252):
Description: Used by Microsoft clients to specify proxy server settings. Configures proxy server information for web access.
These DHCP option codes are essential for configuring and customizing network parameters for DHCP clients, ensuring proper network operation and connectivity.
Samples on how to set these option codes in FortiGate can be found in the following article: