When a server receives a DHCPDISCOVER message from a client, the server chooses a network address for the requesting client. If no address is available, the server may choose to report the problem to the system administrator. If an address is available, the new address SHOULD be chosen as follows:
As described in section 4.2, a server MAY, for administrative reasons, assign an address other than the one requested, or may refuse to allocate an address to a particular client even though free addresses are available.
Note that, in some network architectures (e.g., internets with more than one IP subnet assigned to a physical network segment), it may be the case that the DHCP client should be assigned an address from a different subnet than the address recorded in 'giaddr'. Thus, DHCP does not require that the client be assigned as address from the subnet in 'giaddr'. A server is free to choose some other subnet, and it is beyond the scope of the DHCP specification to describe ways in which the assigned IP address might be chosen.
While not required for correct operation of DHCP, the server SHOULD NOT reuse the selected network address before the client responds to the server's DHCPOFFER message. The server may choose to record the address as offered to the client.
The server must also choose an expiration time for the lease, as follows:
Field DHCPOFFER DHCPACK DHCPNAK ----- --------- ------- ------- 'op' BOOTREPLY BOOTREPLY BOOTREPLY 'htype' (From "Assigned Numbers" RFC) 'hlen' (Hardware address length in octets) 'hops' 0 0 0 'xid' 'xid' from client 'xid' from client 'xid' from client DHCPDISCOVER DHCPREQUEST DHCPREQUEST message message message 'secs' 0 0 0 'ciaddr' 0 'ciaddr' from 0 DHCPREQUEST or 0 'yiaddr' IP address offered IP address 0 to client assigned to client 'siaddr' IP address of next IP address of next 0 bootstrap server bootstrap server 'flags' 'flags' from 'flags' from 'flags' from client DHCPDISCOVER client DHCPREQUEST client DHCPREQUEST message message message 'giaddr' 'giaddr' from 'giaddr' from 'giaddr' from client DHCPDISCOVER client DHCPREQUEST client DHCPREQUEST message message message 'chaddr' 'chaddr' from 'chaddr' from 'chaddr' from client DHCPDISCOVER client DHCPREQUEST client DHCPREQUEST message message message 'sname' Server host name Server host name (unused) or options or options 'file' Client boot file Client boot file (unused) name or options name or options 'options' options options Option DHCPOFFER DHCPACK DHCPNAK ------ --------- ------- ------- Requested IP address MUST NOT MUST NOT MUST NOT IP address lease time MUST MUST (DHCPREQUEST) MUST NOT MUST NOT (DHCPINFORM) Use 'file'/'sname' fields MAY MAY MUST NOT DHCP message type DHCPOFFER DHCPACK DHCPNAK Parameter request list MUST NOT MUST NOT MUST NOT Message SHOULD SHOULD SHOULD Client identifier MUST NOT MUST NOT MAY Vendor class identifier MAY MAY MAY Server identifier MUST MUST MUST Maximum message size MUST NOT MUST NOT MUST NOT All others MAY MAY MUST NOT Table 3: Fields and options used by DHCP servers
Once the network address and lease have been determined, the server constructs a DHCPOFFER message with the offered configuration parameters. It is important for all DHCP servers to return the same parameters (with the possible exception of a newly allocated network address) to ensure predictable client behavior regardless of which server the client selects. The configuration parameters MUST be selected by applying the following rules in the order given below. The network administrator is responsible for configuring multiple DHCP servers to ensure uniform responses from those servers. The server MUST return to the client:
The server MUST supply as many of the requested parameters as possible and MUST omit any parameters it cannot provide. The server MUST include each requested parameter only once unless explicitly allowed in the DHCP Options and BOOTP Vendor Extensions document.
The server MAY choose to return the 'vendor class identifier' used to determine the parameters in the DHCPOFFER message to assist the client in selecting which DHCPOFFER to accept. The server inserts the 'xid' field from the DHCPDISCOVER message into the 'xid' field of the DHCPOFFER message and sends the DHCPOFFER message to the requesting client.