21. DHCP Options
Options are used to carry additional information and parameters in DHCP messages. Every option shares a common base format, as described in Section 21.1. All values in options are represented in network byte order. This document describes the DHCP options defined as part of the base DHCP specification. Other options may be defined in the future in separate documents. See [RFC7227] for guidelines regarding the definition of new options. See Section 24 for additional information about the DHCPv6 "Option Codes" registry maintained by IANA. Unless otherwise noted, each option may appear only in the options area of a DHCP message and may appear only once. If an option does appear multiple times, each instance is considered separate and the data areas of the options MUST NOT be concatenated or otherwise combined.
Options that are allowed to appear only once are called "singleton options". The only non-singleton options defined in this document are the IA_NA (see Section 21.4), IA_TA (see Section 21.5), Vendor Class (see Section 21.16), Vendor-specific Information (see Section 21.17), and IA_PD (see Section 21.21) options. Also, IA Address (see Section 21.6) and IA Prefix (see Section 21.22) may appear in their respective IA options more than once.21.1. Format of DHCP Options
The format of DHCP options is: 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | option-code | option-len | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | option-data | | (option-len octets) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Figure 12: Option Format option-code An unsigned integer identifying the specific option type carried in this option. A 2-octet field. option-len An unsigned integer giving the length of the option-data field in this option in octets. A 2-octet field. option-data The data for the option; the format of this data depends on the definition of the option. A variable-length field (the length, in octets, is specified by option-len). DHCP options are scoped by using encapsulation. Some options apply generally to the client, some are specific to an IA, and some are specific to the addresses within an IA. These latter two cases are discussed in Sections 21.4, 21.5, and 21.6.
21.2. Client Identifier Option
The Client Identifier option is used to carry a DUID (see Section 11) that identifies the client. The format of the Client Identifier option is: 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | OPTION_CLIENTID | option-len | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ . . . DUID . . (variable length) . . . +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Figure 13: Client Identifier Option Format option-code OPTION_CLIENTID (1). option-len Length of DUID in octets. DUID The DUID for the client.21.3. Server Identifier Option
The Server Identifier option is used to carry a DUID (see Section 11) that identifies the server. The format of the Server Identifier option is: 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | OPTION_SERVERID | option-len | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ . . . DUID . . (variable length) . . . +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Figure 14: Server Identifier Option Format
option-code OPTION_SERVERID (2). option-len Length of DUID in octets. DUID The DUID for the server.21.4. Identity Association for Non-temporary Addresses Option
The Identity Association for Non-temporary Addresses (IA_NA) option is used to carry an IA_NA, the parameters associated with the IA_NA, and the non-temporary addresses associated with the IA_NA. Addresses appearing in an IA_NA option are not temporary addresses (see Section 21.5). The format of the IA_NA option is: 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | OPTION_IA_NA | option-len | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | IAID (4 octets) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | T1 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | T2 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | . IA_NA-options . . . +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Figure 15: Identity Association for Non-temporary Addresses Option Format option-code OPTION_IA_NA (3). option-len 12 + length of IA_NA-options field. IAID The unique identifier for this IA_NA; the IAID must be unique among the identifiers for all of this client's IA_NAs. The number space for IA_NA IAIDs is separate from the number space for other IA option types (i.e., IA_TA and IA_PD). A 4-octet field containing an unsigned integer.
T1 The time interval after which the client should contact the server from which the addresses in the IA_NA were obtained to extend the lifetimes of the addresses assigned to the IA_NA; T1 is a time duration relative to the current time expressed in units of seconds. A 4-octet field containing an unsigned integer. T2 The time interval after which the client should contact any available server to extend the lifetimes of the addresses assigned to the IA_NA; T2 is a time duration relative to the current time expressed in units of seconds. A 4-octet field containing an unsigned integer. IA_NA-options Options associated with this IA_NA. A variable-length field (12 octets less than the value in the option-len field). The IA_NA-options field encapsulates those options that are specific to this IA_NA. For example, all of the IA Address options (see Section 21.6) carrying the addresses associated with this IA_NA are in the IA_NA-options field. Each IA_NA carries one "set" of non-temporary addresses; it is up to the server policy to determine how many addresses are assigned, but typically at most one address is assigned from each prefix assigned to the link to which the client is attached. An IA_NA option may only appear in the options area of a DHCP message. A DHCP message may contain multiple IA_NA options (though each must have a unique IAID). The status of any operations involving this IA_NA is indicated in a Status Code option (see Section 21.13) in the IA_NA-options field. Note that an IA_NA has no explicit "lifetime" or "lease length" of its own. When the valid lifetimes of all of the addresses in an IA_NA have expired, the IA_NA can be considered as having expired. T1 and T2 are included to give servers explicit control over when a client recontacts the server about a specific IA_NA. In a message sent by a client to a server, the T1 and T2 fields SHOULD be set to 0. The server MUST ignore any values in these fields in messages received from a client.
In a message sent by a server to a client, the client MUST use the values in the T1 and T2 fields for the T1 and T2 times, unless values in those fields are 0. The values in the T1 and T2 fields are the number of seconds until T1 and T2 and are calculated since reception of the message. As per Section 7.7, the value 0xffffffff is taken to mean "infinity" and should be used carefully. The server selects the T1 and T2 values to allow the client to extend the lifetimes of any addresses in the IA_NA before the lifetimes expire, even if the server is unavailable for some short period of time. Recommended values for T1 and T2 are 0.5 and 0.8 times the shortest preferred lifetime of the addresses in the IA that the server is willing to extend, respectively. If the "shortest" preferred lifetime is 0xffffffff ("infinity"), the recommended T1 and T2 values are also 0xffffffff. If the time at which the addresses in an IA_NA are to be renewed is to be left to the discretion of the client, the server sets the T1 and T2 values to 0. The client MUST follow the rules defined in Section 14.2. If a client receives an IA_NA with T1 greater than T2 and both T1 and T2 are greater than 0, the client discards the IA_NA option and processes the remainder of the message as though the server had not included the invalid IA_NA option.21.5. Identity Association for Temporary Addresses Option
The Identity Association for Temporary Addresses (IA_TA) option is used to carry an IA_TA, the parameters associated with the IA_TA, and the addresses associated with the IA_TA. All of the addresses in this option are used by the client as temporary addresses, as defined in [RFC4941]. The format of the IA_TA option is: 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | OPTION_IA_TA | option-len | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | IAID (4 octets) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | . IA_TA-options . . . +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Figure 16: Identity Association for Temporary Addresses Option Format
option-code OPTION_IA_TA (4). option-len 4 + length of IA_TA-options field. IAID The unique identifier for this IA_TA; the IAID must be unique among the identifiers for all of this client's IA_TAs. The number space for IA_TA IAIDs is separate from the number space for other IA option types (i.e., IA_NA and IA_PD). A 4-octet field containing an unsigned integer. IA_TA-options Options associated with this IA_TA. A variable-length field (4 octets less than the value in the option-len field). The IA_TA-options field encapsulates those options that are specific to this IA_TA. For example, all of the IA Address options (see Section 21.6) carrying the addresses associated with this IA_TA are in the IA_TA-options field. Each IA_TA carries one "set" of temporary addresses. It is up to the server policy to determine how many addresses are assigned. An IA_TA option may only appear in the options area of a DHCP message. A DHCP message may contain multiple IA_TA options (though each must have a unique IAID). The status of any operations involving this IA_TA is indicated in a Status Code option (see Section 21.13) in the IA_TA-options field. Note that an IA has no explicit "lifetime" or "lease length" of its own. When the valid lifetimes of all of the addresses in an IA_TA have expired, the IA can be considered as having expired. An IA_TA option does not include values for T1 and T2. A client MAY request that the valid lifetime on temporary addresses be extended by including the addresses in an IA_TA option sent in a Renew or Rebind message to a server. For example, a client would request an extension on the valid lifetime of a temporary address to allow an application to continue to use an established TCP connection. Extending only the valid, but not the preferred, lifetime means the address will end up in a deprecated state eventually. Existing connections could continue, but no new ones would be created using that address.
The client obtains new temporary addresses by sending an IA_TA option with a new IAID to a server. Requesting new temporary addresses from the server is the equivalent of generating new temporary addresses as described in [RFC4941]. The server will generate new temporary addresses and return them to the client. The client should request new temporary addresses before the lifetimes on the previously assigned addresses expire. A server MUST return the same set of temporary addresses for the same IA_TA (as identified by the IAID) as long as those addresses are still valid. After the lifetimes of the addresses in an IA_TA have expired, the IAID may be reused to identify a new IA_TA with new temporary addresses.21.6. IA Address Option
The IA Address option is used to specify an address associated with an IA_NA or an IA_TA. The IA Address option must be encapsulated in the IA_NA-options field of an IA_NA option (see Section 21.4) or the IA_TA-options field of an IA_TA option (see Section 21.5). The IAaddr-options field encapsulates those options that are specific to this address. The format of the IA Address option is: 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | OPTION_IAADDR | option-len | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | | IPv6-address | | | | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | preferred-lifetime | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | valid-lifetime | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ . . . IAaddr-options . . . +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Figure 17: IA Address Option Format
option-code OPTION_IAADDR (5). option-len 24 + length of IAaddr-options field. IPv6-address An IPv6 address. A client MUST NOT form an implicit prefix with a length other than 128 for this address. A 16-octet field. preferred-lifetime The preferred lifetime for the address in the option, expressed in units of seconds. A 4-octet field containing an unsigned integer. valid-lifetime The valid lifetime for the address in the option, expressed in units of seconds. A 4-octet field containing an unsigned integer. IAaddr-options Options associated with this address. A variable-length field (24 octets less than the value in the option-len field). In a message sent by a client to a server, the preferred-lifetime and valid-lifetime fields SHOULD be set to 0. The server MUST ignore any received values. The client SHOULD NOT send the IA Address option with an unspecified address (::). In a message sent by a server to a client, the client MUST use the values in the preferred-lifetime and valid-lifetime fields for the preferred and valid lifetimes. The values in these fields are the number of seconds remaining in each lifetime. The client MUST discard any addresses for which the preferred lifetime is greater than the valid lifetime. As per Section 7.7, if the valid lifetime of an address is 0xffffffff, it is taken to mean "infinity" and should be used carefully. More than one IA Address option can appear in an IA_NA option or an IA_TA option. The status of any operations involving this IA Address is indicated in a Status Code option in the IAaddr-options field, as specified in Section 21.13.
21.7. Option Request Option
The Option Request option is used to identify a list of options in a message between a client and a server. The format of the Option Request option is: 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | OPTION_ORO | option-len | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | requested-option-code-1 | requested-option-code-2 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ... | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Figure 18: Option Request Option Format option-code OPTION_ORO (6). option-len 2 * number of requested options. requested-option-code-n The option code for an option requested by the client. Each option code is a 2-octet field containing an unsigned integer. A client MUST include an Option Request option in a Solicit, Request, Renew, Rebind, or Information-request message to inform the server about options the client wants the server to send to the client. For certain message types, some option codes MUST be included in the Option Request option; see Table 4 for details. The Option Request option MUST NOT include the following options: - Client Identifier (see Section 21.2) - Server Identifier (see Section 21.3) - IA_NA (see Section 21.4) - IA_TA (see Section 21.5) - IA_PD (see Section 21.21) - IA Address (see Section 21.6) - IA Prefix (see Section 21.22)
- Option Request (this section) - Elapsed Time (see Section 21.9) - Preference (see Section 21.8) - Relay Message (see Section 21.10) - Authentication (see Section 21.11) - Server Unicast (see Section 21.12) - Status Code (see Section 21.13) - Rapid Commit (see Section 21.14) - User Class (see Section 21.15) - Vendor Class (see Section 21.16) - Interface-Id (see Section 21.18) - Reconfigure Message (see Section 21.19) - Reconfigure Accept (see Section 21.20) Other top-level options MUST appear in the Option Request option or they will not be sent by the server. Only top-level options MAY appear in the Option Request option. Options encapsulated in a container option SHOULD NOT appear in an Option Request option; see [RFC7598] for an example of container options. However, options MAY be defined that specify exceptions to this restriction on including encapsulated options in an Option Request option. For example, the Option Request option MAY be used to signal support for a feature even when that option is encapsulated, as in the case of the Prefix Exclude option [RFC6603]. See Table 4.
21.8. Preference Option
The Preference option is sent by a server to a client to control the selection of a server by the client. The format of the Preference option is: 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | OPTION_PREFERENCE | option-len | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | pref-value | +-+-+-+-+-+-+-+-+ Figure 19: Preference Option Format option-code OPTION_PREFERENCE (7). option-len 1. pref-value The preference value for the server in this message. A 1-octet unsigned integer. A server MAY include a Preference option in an Advertise message to control the selection of a server by the client. See Section 18.2.9 for information regarding the use of the Preference option by the client and the interpretation of the Preference option data value.21.9. Elapsed Time Option
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | OPTION_ELAPSED_TIME | option-len | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | elapsed-time | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Figure 20: Elapsed Time Option Format
option-code OPTION_ELAPSED_TIME (8). option-len 2. elapsed-time The amount of time since the client began its current DHCP transaction. This time is expressed in hundredths of a second (10^-2 seconds). A 2-octet field containing an unsigned integer. A client MUST include an Elapsed Time option in messages to indicate how long the client has been trying to complete a DHCP message exchange. The elapsed time is measured from the time at which the client sent the first message in the message exchange, and the elapsed-time field is set to 0 in the first message in the message exchange. Servers and relay agents use the data value in this option as input to policy that controls how a server responds to a client message. For example, the Elapsed Time option allows a secondary DHCP server to respond to a request when a primary server has not answered in a reasonable time. The elapsed-time value is a 16-bit (2-octet) unsigned integer. The client uses the value 0xffff to represent any elapsed-time values greater than the largest time value that can be represented in the Elapsed Time option.21.10. Relay Message Option
The Relay Message option carries a DHCP message in a Relay-forward or Relay-reply message. The format of the Relay Message option is: 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | OPTION_RELAY_MSG | option-len | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | . DHCP-relay-message . . . . . +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Figure 21: Relay Message Option Format
option-code OPTION_RELAY_MSG (9). option-len Length of DHCP-relay-message field. DHCP-relay-message In a Relay-forward message, the received message, relayed verbatim to the next relay agent or server; in a Relay-reply message, the message to be copied and relayed to the relay agent or client whose address is in the peer-address field of the Relay-reply message. The length, in octets, is specified by option-len.