home *** CD-ROM | disk | FTP | other *** search
/ Hackers Toolkit 2.0 / Hackers_Toolkit_v2.0.iso / HTML / archive / Texts / Rfc / RFC1541.TXT < prev    next >
Encoding:
Text File  |  1999-11-04  |  94.7 KB  |  2,223 lines

  1. Network Working Group                                           R. Droms
  2. Request for Comments: 1541                           Bucknell University
  3. Obsoletes: 1531                                             October 1993
  4. Category: Standards Track
  5.  
  6.  
  7.                   Dynamic Host Configuration Protocol
  8.  
  9. Status of this memo
  10.  
  11.    This RFC specifies an Internet standards track protocol for the
  12.    Internet community, and requests discussion and suggestions for
  13.    improvements.  Please refer to the current edition of the "Internet
  14.    Official Protocol Standards" for the standardization state and status
  15.    of this protocol.  Distribution of this memo is unlimited.
  16.  
  17. Abstract
  18.  
  19.    The Dynamic Host Configuration Protocol (DHCP) provides a framework
  20.    for passing configuration information to hosts on a TCP/IP network.
  21.    DHCP is based on the Bootstrap Protocol (BOOTP) [7], adding the
  22.    capability of automatic allocation of reusable network addresses and
  23.    additional configuration options [19].  DHCP captures the behavior of
  24.    BOOTP relay agents [7, 23], and DHCP participants can interoperate
  25.    with BOOTP participants [9].  Due to some errors introduced into RFC
  26.    1531 in the editorial process, this memo is reissued as RFC 1541.
  27.  
  28.  
  29. Table of Contents
  30.  
  31.    1.  Introduction. . . . . . . . . . . . . . . . . . . . . . . . .  2
  32.    1.1 Related Work. . . . . . . . . . . . . . . . . . . . . . . . .  4
  33.    1.2 Problem definition and issues . . . . . . . . . . . . . . . .  4
  34.    1.3 Requirements. . . . . . . . . . . . . . . . . . . . . . . . .  5
  35.    1.4 Terminology . . . . . . . . . . . . . . . . . . . . . . . . .  6
  36.    1.5 Design goals. . . . . . . . . . . . . . . . . . . . . . . . .  6
  37.    2. Protocol Summary . . . . . . . . . . . . . . . . . . . . . . .  8
  38.    2.1 Configuration parameters repository . . . . . . . . . . . . . 10
  39.    2.2 Dynamic allocation of network addresses . . . . . . . . . . . 11
  40.    3. The Client-Server Protocol . . . . . . . . . . . . . . . . . . 11
  41.    3.1 Client-server interaction - allocating a network address. . . 12
  42.    3.2 Client-server interaction - reusing a  previously allocated
  43.        network address . . . . . . . . . . . . . . . . . . . . . . . 17
  44.    3.3 Interpretation and representation of time values. . . . . . . 19
  45.    3.4 Host parameters in DHCP . . . . . . . . . . . . . . . . . . . 19
  46.    3.5 Use of DHCP in clients with multiple interfaces . . . . . . . 20
  47.    3.6 When clients should use DHCP. . . . . . . . . . . . . . . . . 20
  48.    4. Specification of the DHCP client-server protocol . . . . . . . 21
  49.  
  50.  
  51.  
  52. Droms                                                           [Page 1]
  53.  
  54.  
  55. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  56.  
  57.  
  58.    4.1 Constructing and sending DHCP messages. . . . . . . . . . . . 21
  59.    4.2 DHCP server administrative controls . . . . . . . . . . . . . 23
  60.    4.3 DHCP server behavior. . . . . . . . . . . . . . . . . . . . . 24
  61.    4.3.1 DHCPDISCOVER message. . . . . . . . . . . . . . . . . . . . 24
  62.    4.3.2 DHCPREQUEST message . . . . . . . . . . . . . . . . . . . . 27
  63.    4.3.3 DHCPDECLINE message . . . . . . . . . . . . . . . . . . . . 29
  64.    4.3.4 DHCPRELEASE message . . . . . . . . . . . . . . . . . . . . 29
  65.    4.4 DHCP client behavior. . . . . . . . . . . . . . . . . . . . . 29
  66.    4.4.1 Initialization and allocation of network address. . . . . . 29
  67.    4.4.2 Initialization with known network address . . . . . . . . . 33
  68.    4.4.3 Initialization with a known DHCP server address . . . . . . 34
  69.    4.4.4 Reacquisition and expiration. . . . . . . . . . . . . . . . 34
  70.    4.4.5 DHCPRELEASE . . . . . . . . . . . . . . . . . . . . . . . . 35
  71.    5. Acknowledgments. . . . . . . . . . . . . . . . . . . . . . . . 35
  72.    6. References . . . . . . . . . . . . . . . . . . . . . . . . . . 36
  73.    7. Security Considerations. . . . . . . . . . . . . . . . . . . . 37
  74.    8. Author's Address . . . . . . . . . . . . . . . . . . . . . . . 38
  75.    A. Host Configuration Parameters  . . . . . . . . . . . . . . . . 39
  76.  
  77. List of Figures
  78.  
  79.    1. Format of a DHCP message . . . . . . . . . . . . . . . . . . .  9
  80.    2. Format of the 'flags' field. . . . . . . . . . . . . . . . . . 10
  81.    3. Timeline diagram of messages exchanged between DHCP client and
  82.       servers when allocating a new network address. . . . . . . . . 15
  83.    4. Timeline diagram of messages exchanged between DHCP client and
  84.       servers when reusing a previously allocated network address. . 18
  85.    5. State-transition diagram for DHCP clients. . . . . . . . . . . 31
  86.  
  87. List of Tables
  88.  
  89.    1. Description of fields in a DHCP message. . . . . . . . . . . . 14
  90.    2. DHCP messages. . . . . . . . . . . . . . . . . . . . . . . . . 16
  91.    3. Fields and options used by DHCP servers. . . . . . . . . . . . 25
  92.    4. Fields and options used by DHCP clients. . . . . . . . . . . . 32
  93.  
  94. 1. Introduction
  95.  
  96.    The Dynamic Host Configuration Protocol (DHCP) provides configuration
  97.    parameters to Internet hosts.  DHCP consists of two components: a
  98.    protocol for delivering host-specific configuration parameters from a
  99.    DHCP server to a host and a mechanism for allocation of network
  100.    addresses to hosts.
  101.  
  102.    DHCP is built on a client-server model, where designated DHCP server
  103.    hosts allocate network addresses and deliver configuration parameters
  104.    to dynamically configured hosts.  Throughout the remainder of this
  105.    document, the term "server" refers to a host providing initialization
  106.  
  107.  
  108.  
  109. Droms                                                           [Page 2]
  110.  
  111.  
  112. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  113.  
  114.  
  115.    parameters through DHCP, and the term "client" refers to a host
  116.    requesting initialization parameters from a DHCP server.
  117.  
  118.    A host should not act as a DHCP server unless explicitly configured
  119.    to do so by a system administrator.  The diversity of hardware and
  120.    protocol implementations in the Internet would preclude reliable
  121.    operation if random hosts were allowed to respond to DHCP requests.
  122.    For example, IP requires the setting of many parameters within the
  123.    protocol implementation software.  Because IP can be used on many
  124.    dissimilar kinds of network hardware, values for those parameters
  125.    cannot be guessed or assumed to have correct defaults.  Also,
  126.    distributed address allocation schemes depend on a polling/defense
  127.    mechanism for discovery of addresses that are already in use.  IP
  128.    hosts may not always be able to defend their network addresses, so
  129.    that such a distributed address allocation scheme cannot be
  130.    guaranteed to avoid allocation of duplicate network addresses.
  131.  
  132.    DHCP supports three mechanisms for IP address allocation.  In
  133.    "automatic allocation", DHCP assigns a permanent IP address to a
  134.    host.  In "dynamic allocation", DHCP assigns an IP address to a host
  135.    for a limited period of time (or until the host explicitly
  136.    relinquishes the address).  In "manual allocation", a host's IP
  137.    address is assigned by the network administrator, and DHCP is used
  138.    simply to convey the assigned address to the host.  A particular
  139.    network will use one or more of these mechanisms, depending on the
  140.    policies of the network administrator.
  141.  
  142.    Dynamic allocation is the only one of the three mechanisms that
  143.    allows automatic reuse of an address that is no longer needed by the
  144.    host to which it was assigned.  Thus, dynamic allocation is
  145.    particularly useful for assigning an address to a host that will be
  146.    connected to the network only temporarily or for sharing a limited
  147.    pool of IP addresses among a group of hosts that do not need
  148.    permanent IP addresses.  Dynamic allocation may also be a good choice
  149.    for assigning an IP address to a new host being permanently connected
  150.    to a network where IP addresses are sufficiently scarce that it is
  151.    important to reclaim them when old hosts are retired.  Manual
  152.    allocation allows DHCP to be used to eliminate the error-prone
  153.    process of manually configuring hosts with IP addresses in
  154.    environments where (for whatever reasons) it is desirable to manage
  155.    IP address assignment outside of the DHCP mechanisms.
  156.  
  157.    The format of DHCP messages is based on the format of BOOTP messages,
  158.    to capture the BOOTP relay agent behavior described as part of the
  159.    BOOTP specification [7, 23] and to allow interoperability of existing
  160.    BOOTP clients with DHCP servers.  Using BOOTP relaying agents
  161.    eliminates the necessity of having a DHCP server on each physical
  162.    network segment.
  163.  
  164.  
  165.  
  166. Droms                                                           [Page 3]
  167.  
  168.  
  169. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  170.  
  171.  
  172. 1.1 Related Work
  173.  
  174.    There are several Internet protocols and related mechanisms that
  175.    address some parts of the dynamic host configuration problem.  The
  176.    Reverse Address Resolution Protocol (RARP) [10] (through the
  177.    extensions defined in the Dynamic RARP (DRARP) [5]) explicitly
  178.    addresses the problem of network address discovery, and includes an
  179.    automatic IP address assignment mechanism.  The Trivial File Transfer
  180.    Protocol (TFTP) [20] provides for transport of a boot image from a
  181.    boot server.  The Internet Control Message Protocol (ICMP) [16]
  182.    provides for informing hosts of additional routers via "ICMP
  183.    redirect" messages.  ICMP also can provide subnet mask information
  184.    through the "ICMP mask request" message and other information through
  185.    the (obsolete) "ICMP information request" message.  Hosts can locate
  186.    routers through the ICMP router discovery mechanism [8].
  187.  
  188.    BOOTP is a transport mechanism for a collection of configuration
  189.    information.  BOOTP is also extensible, and official extensions [17]
  190.    have been defined for several configuration parameters.  Morgan has
  191.    proposed extensions to BOOTP for dynamic IP address assignment [15].
  192.    The Network Information Protocol (NIP), used by the Athena project at
  193.    MIT, is a distributed mechanism for dynamic IP address assignment
  194.    [19].  The Resource Location Protocol RLP [1] provides for location
  195.    of higher level services.  Sun Microsystems diskless workstations use
  196.    a boot procedure that employs RARP, TFTP and an RPC mechanism called
  197.    "bootparams" to deliver configuration information and operating
  198.    system code to diskless hosts.  (Sun Microsystems, Sun Workstation
  199.    and SunOS are trademarks of Sun Microsystems, Inc.)  Some Sun
  200.    networks also use DRARP and an auto-installation mechanism to
  201.    automate the configuration of new hosts in an existing network.
  202.  
  203.    In other related work, the path minimum transmission unit (MTU)
  204.    discovery algorithm can determine the MTU of an arbitrary internet
  205.    path [14].  Comer and Droms have proposed the use of the Address
  206.    Resolution Protocol (ARP) as a transport protocol for resource
  207.    location and selection [6].  Finally, the Host Requirements RFCs [3,
  208.    4] mention specific requirements for host reconfiguration and suggest
  209.    a scenario for initial configuration of diskless hosts.
  210.  
  211. 1.2 Problem definition and issues
  212.  
  213.    DHCP is designed to supply hosts with the configuration parameters
  214.    defined in the Host Requirements RFCs.  After obtaining parameters
  215.    via DHCP, a host should be able to exchange packets with any other
  216.    host in the Internet.  The parameters supplied by DHCP are listed in
  217.    Appendix A.
  218.  
  219.  
  220.  
  221.  
  222.  
  223. Droms                                                           [Page 4]
  224.  
  225.  
  226. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  227.  
  228.  
  229.    Not all of these parameters are required for a newly initialized
  230.    host.  A client and server may negotiate for the transmission of only
  231.    those parameters required by the client or specific to a particular
  232.    subnet.
  233.  
  234.    DHCP allows but does not require the configuration of host parameters
  235.    not directly related to the IP protocol.  DHCP also does not address
  236.    registration of newly configured hosts with the Domain Name System
  237.    (DNS) [12, 13].
  238.  
  239.    DHCP is not intended for use in configuring routers.
  240.  
  241. 1.3 Requirements
  242.  
  243.    Throughout this document, the words that are used to define the
  244.    significance of particular requirements are capitalized.  These words
  245.    are:
  246.  
  247.       o "MUST"
  248.  
  249.         This word or the adjective "REQUIRED" means that the
  250.         item is an absolute requirement of this specification.
  251.  
  252.       o "MUST NOT"
  253.  
  254.         This phrase means that the item is an absolute prohibition
  255.         of this specification.
  256.  
  257.       o "SHOULD"
  258.  
  259.         This word or the adjective "RECOMMENDED" means that there
  260.         may exist valid reasons in particular circumstances to ignore
  261.         this item, but the full implications should be understood and
  262.         the case carefully weighed before choosing a different course.
  263.  
  264.       o "SHOULD NOT"
  265.  
  266.         This phrase means that there may exist valid reasons in
  267.         particular circumstances when the listed behavior is acceptable
  268.         or even useful, but the full implications should be understood
  269.         and the case carefully weighed before implementing any behavior
  270.         described with this label.
  271.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280. Droms                                                           [Page 5]
  281.  
  282.  
  283. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  284.  
  285.  
  286.       o "MAY"
  287.  
  288.         This word or the adjective "OPTIONAL" means that this item is
  289.         truly optional.  One vendor may choose to include the item
  290.         because a particular marketplace requires it or because it
  291.         enhances the product, for example; another vendor may omit the
  292.         same item.
  293.  
  294. 1.4 Terminology
  295.  
  296.    This document uses the following terms:
  297.  
  298.       o "DHCP client"
  299.  
  300.         A DHCP client is an Internet host using DHCP to obtain
  301.         configuration parameters such as a network address.
  302.  
  303.       o "DHCP server"
  304.  
  305.         A DHCP server is an Internet host that returns configuration
  306.         parameters to DHCP clients.
  307.  
  308.       o "BOOTP relay agent"
  309.  
  310.         A BOOTP relay agent is an Internet host or router that passes
  311.         DHCP messages between DHCP clients and DHCP servers.  DHCP is
  312.         designed to use the same relay agent behavior as specified in
  313.         the BOOTP protocol specification.
  314.  
  315.       o "binding"
  316.  
  317.         A binding is a collection of configuration parameters, including
  318.         at least an IP address, associated with or "bound to" a DHCP
  319.         client.  Bindings are managed by DHCP servers.
  320.  
  321. 1.5 Design goals
  322.  
  323.    The following list gives general design goals for DHCP.
  324.  
  325.       o DHCP should be a mechanism rather than a policy.  DHCP must
  326.         allow local system administrators control over configuration
  327.         parameters where desired; e.g., local system administrators
  328.         should be able to enforce local policies concerning allocation
  329.         and access to local resources where desired.
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337. Droms                                                           [Page 6]
  338.  
  339.  
  340. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  341.  
  342.  
  343.       o Hosts should require no manual configuration.  Each host should
  344.         be able to discover appropriate local configuration parameters
  345.         without user intervention and incorporate those parameters into
  346.         its own configuration.
  347.  
  348.       o Networks should require no hand configuration for individual
  349.         hosts.  Under normal circumstances, the network manager should
  350.         not have to enter any per-host configuration parameters.
  351.  
  352.       o DHCP should not require a server on each subnet.  To allow for
  353.         scale and economy, DHCP must work across routers or through the
  354.         intervention of BOOTP/DHCP relay agents.
  355.  
  356.       o A DHCP host must be prepared to receive multiple responses to a
  357.         request for configuration parameters.  Some installations may
  358.         include multiple, overlapping DHCP servers to enhance
  359.         reliability and increase performance.
  360.  
  361.       o DHCP must coexist with statically configured, non-participating
  362.         hosts and with existing network protocol implementations.
  363.  
  364.       o DHCP must interoperate with the BOOTP relay agent behavior as
  365.         described by RFC 951 and by Wimer [21].
  366.  
  367.       o DHCP must provide service to existing BOOTP clients.
  368.  
  369.    The following list gives design goals specific to the transmission of
  370.    the network layer parameters.  DHCP must:
  371.  
  372.       o Guarantee that any specific network address will not be in
  373.         use by more than one host at a time,
  374.  
  375.       o Retain host configuration across host reboot.  A host should,
  376.         whenever possible, be assigned the same configuration parameters
  377.         (e.g., network address) in response to each request,
  378.  
  379.       o Retain host configuration across server reboots, and, whenever
  380.         possible, a host should be assigned the same configuration
  381.         parameters despite restarts of the DHCP mechanism,
  382.  
  383.       o Allow automatic assignment of configuration parameters to new
  384.         hosts to avoid hand configuration for new hosts,
  385.  
  386.       o Support fixed or permanent allocation of configuration
  387.         parameters to specific hosts.
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394. Droms                                                           [Page 7]
  395.  
  396.  
  397. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  398.  
  399.  
  400. 2. Protocol Summary
  401.  
  402.    From the client's point of view, DHCP is an extension of the BOOTP
  403.    mechanism.  This behavior allows existing BOOTP clients to
  404.    interoperate with DHCP servers without requiring any change to the
  405.    clients' initialization software.  A separate document details the
  406.    interactions between BOOTP and DHCP clients and servers [9].  There
  407.    are some new, optional transactions that optimize the interaction
  408.    between DHCP clients and servers that are described in sections 3 and
  409.    4.
  410.  
  411.    Figure 1 gives the format of a DHCP message and table 1 describes
  412.    each of the fields in the DHCP message.  The numbers in parentheses
  413.    indicate the size of each field in octets.  The names for the fields
  414.    given in the figure will be used throughout this document to refer to
  415.    the fields in DHCP messages.
  416.  
  417.    There are two primary differences between DHCP and BOOTP.  First,
  418.    DHCP defines mechanisms through which clients can be assigned a
  419.    network address for a fixed lease, allowing for serial reassignment
  420.    of network addresses to different clients.  Second, DHCP provides the
  421.    mechanism for a client to acquire all of the IP configuration
  422.    parameters that it needs in order to operate.
  423.  
  424.    DHCP introduces a small change in terminology intended to clarify the
  425.    meaning of one of the fields.  What was the "vendor extensions" field
  426.    in BOOTP has been re-named the "options" field in DHCP. Similarly,
  427.    the tagged data items that were used inside the BOOTP "vendor
  428.    extensions" field, which were formerly referred to as "vendor
  429.    extensions," are now termed simply "options."
  430.  
  431.    DHCP defines a new 'client identifier' option that is used to pass an
  432.    explicit client identifier to a DHCP server.  This change eliminates
  433.    the overloading of the 'chaddr' field in BOOTP messages, where
  434.    'chaddr' is used both as a hardware address for transmission of BOOTP
  435.    reply messages and as a client identifier.  The 'client identifier'
  436.    option may contain a hardware address, identical to the contents of
  437.    the 'chaddr' field, or it may contain another type of identifier,
  438.    such as a DNS name.  Other client identifier types may be defined as
  439.    needed for use with DHCP.  New client identifier types will be
  440.    registered with the IANA [18] and will be included in new revisions
  441.    of the Assigned Numbers document, as well as described in detail in
  442.    future revisions of the DHCP Options [2].
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451. Droms                                                           [Page 8]
  452.  
  453.  
  454. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  455.  
  456.  
  457.    0                   1                   2                   3
  458.    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
  459.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  460.    |     op (1)    |   htype (1)   |   hlen (1)    |   hops (1)    |
  461.    +---------------+---------------+---------------+---------------+
  462.    |                            xid (4)                            |
  463.    +-------------------------------+-------------------------------+
  464.    |           secs (2)            |           flags (2)           |
  465.    +-------------------------------+-------------------------------+
  466.    |                          ciaddr  (4)                          |
  467.    +---------------------------------------------------------------+
  468.    |                          yiaddr  (4)                          |
  469.    +---------------------------------------------------------------+
  470.    |                          siaddr  (4)                          |
  471.    +---------------------------------------------------------------+
  472.    |                          giaddr  (4)                          |
  473.    +---------------------------------------------------------------+
  474.    |                                                               |
  475.    |                          chaddr  (16)                         |
  476.    |                                                               |
  477.    |                                                               |
  478.    +---------------------------------------------------------------+
  479.    |                                                               |
  480.    |                          sname   (64)                         |
  481.    +---------------------------------------------------------------+
  482.    |                                                               |
  483.    |                          file    (128)                        |
  484.    +---------------------------------------------------------------+
  485.    |                                                               |
  486.    |                          options (312)                        |
  487.    +---------------------------------------------------------------+
  488.  
  489.                   Figure 1:  Format of a DHCP message
  490.  
  491.    DHCP clarifies the interpretation of the 'siaddr' field as the
  492.    address of the server to use in the next step of the client's
  493.    bootstrap process.  A DHCP server may return its own address in the
  494.    'siaddr' field, if the server is prepared to supply the next
  495.    bootstrap service (e.g., delivery of an operating system executable
  496.    image).  A DHCP server always returns its own address in the 'server
  497.    identifier' option.
  498.  
  499.    The options field is now variable length, with the minimum extended
  500.    to 312 octets.  This brings the minimum size of a DHCP message up to
  501.    576 octets, the minimum IP datagram size a host must be prepared to
  502.    accept [3].  DHCP clients may negotiate the use of larger DHCP
  503.    messages through the 'Maximum DHCP message size' option.  The options
  504.    field may be further extended into the 'file' and 'sname' fields.
  505.  
  506.  
  507.  
  508. Droms                                                           [Page 9]
  509.  
  510.  
  511. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  512.  
  513.  
  514.    A new option, called 'vendor specific information', has been added to
  515.    allow for expansion of the number of options that can be supported
  516.    [2].  Options encapsulated as 'vendor specific information' must be
  517.    carefully defined and documented so as to allow for interoperability
  518.    between clients and servers from diferent vendors.  In particular,
  519.    vendors defining 'vendor specific information' MUST document those
  520.    options in the form of the DHCP Options document, MUST choose to
  521.    represent those options either in data types already defined for DHCP
  522.    options or in other well-defined data types, and MUST choose options
  523.    that can be readily encoded in configuration files for exchange with
  524.    servers provided by other vendors.  Options included as 'vendor
  525.    specific options' MUST be readily supportable by all servers.
  526.  
  527.                                     1 1 1 1 1 1
  528.                 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
  529.                 -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  530.                 B|             MBZ             |
  531.                 -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  532.  
  533.                 B:  BROADCAST flag
  534.  
  535.                 MBZ:  MUST BE ZERO (reserved for future use)
  536.  
  537.                 Figure 2:  Format of the 'flags' field
  538.  
  539.    DHCP uses the 'flags' field [21].  The leftmost bit is defined as the
  540.    BROADCAST (B) flag.  The semantics of this flag are discussed in
  541.    section 4.1 of this document.  The remaining bits of the flags field
  542.    are reserved for future use.  They MUST be set to zero by clients and
  543.    ignored by servers and relay agents.  Figure 2 gives the format of
  544.    the 'flags' field.
  545.  
  546. 2.1 Configuration parameters repository
  547.  
  548.    The first service provided by DHCP is to provide persistent storage
  549.    of network parameters for network clients.  The model of DHCP
  550.    persistent storage is that the DHCP service stores a key-value entry
  551.    for each client, where the key is some unique identifier (for
  552.    example, an IP subnet number and a unique identifier within the
  553.    subnet) and the value contains the configuration parameters for the
  554.    client.
  555.  
  556.    For example, the key might be the pair (IP-subnet-number, hardware-
  557.    address), allowing for serial or concurrent reuse of a hardware
  558.    address on different subnets, and for hardware addresses that may not
  559.    be globally unique.  Alternately, the key might be the pair (IP-
  560.    subnet-number, hostname), allowing the server to assign parameters
  561.    intelligently to a host that has been moved to a different subnet or
  562.  
  563.  
  564.  
  565. Droms                                                          [Page 10]
  566.  
  567.  
  568. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  569.  
  570.  
  571.    has changed hardware addresses (perhaps because the network interface
  572.    failed and was replaced).
  573.  
  574.    A client can query the DHCP service to retrieve its configuration
  575.    parameters.  The client interface to the configuration parameters
  576.    repository consists of protocol messages to request configuration
  577.    parameters and responses from the server carrying the configuration
  578.    parameters.
  579.  
  580. 2.2 Dynamic allocation of network addresses
  581.  
  582.    The second service provided by DHCP is the allocation of temporary or
  583.    permanent network (IP) addresses to hosts.  The basic mechanism for
  584.    the dynamic allocation of network addresses is simple: a client
  585.    requests the use of an address for some period of time.  The
  586.    allocation mechanism (the collection of DHCP servers) guarantees not
  587.    to reallocate that address within the requested time and attempts to
  588.    return the same network address each time the client requests an
  589.    address.  In this document, the period over which a network address
  590.    is allocated to a client is referred to as a "lease" [11].  The
  591.    client may extend its lease with subsequent requests.  The client may
  592.    issue a message to release the address back to the server when the
  593.    client no longer needs the address.  The client may ask for a
  594.    permanent assignment by asking for an infinite lease.  Even when
  595.    assigning "permanent" addresses, a server may choose to give out
  596.    lengthy but non-infinite leases to allow detection of the fact that
  597.    the host has been retired.
  598.  
  599.    In some environments it will be necessary to reassign network
  600.    addresses due to exhaustion of available addresses.  In such
  601.    environments, the allocation mechanism will reuse addresses whose
  602.    lease has expired.  The server should use whatever information is
  603.    available in the configuration information repository to choose an
  604.    address to reuse.  For example, the server may choose the least
  605.    recently assigned address.  As a consistency check, the allocation
  606.    mechanism may probe the reused address, e.g., with an ICMP echo
  607.    request, before allocating the address, and the client will probe the
  608.    newly received address, e.g., with ARP.
  609.  
  610. 3. The Client-Server Protocol
  611.  
  612.    DHCP uses the BOOTP message format defined in RFC 951 and given in
  613.    table 1 and figure 1.  The 'op' field of each DHCP message sent from
  614.    a client to a server contains BOOTREQUEST. BOOTREPLY is used in the
  615.    'op' field of each DHCP message sent from a server to a client.
  616.  
  617.    The first four octets of the 'options' field of the DHCP message
  618.    contain the (decimal) values 99, 130, 83 and 99, respectively (this
  619.  
  620.  
  621.  
  622. Droms                                                          [Page 11]
  623.  
  624.  
  625. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  626.  
  627.  
  628.    is the same magic cookie as is defined in RFC 1497).  The remainder
  629.    of the 'options' field consists a list of tagged parameters that are
  630.    called "options".  All of the "vendor extensions" listed in RFC 1497
  631.    are also DHCP options.  A separate document gives the complete set of
  632.    options defined for use with DHCP [2].
  633.  
  634.    Several options have been defined so far.  One particular option -
  635.    the "DHCP message type" option - must be included in every DHCP
  636.    message.  This option defines the "type" of the DHCP message.
  637.    Additional options may be allowed, required, or not allowed,
  638.    depending on the DHCP message type.
  639.  
  640.    Throughout this document, DHCP messages that include a 'DHCP message
  641.    type' option will be referred to by the type of the message; e.g., a
  642.    DHCP message with 'DHCP message type' option type 1 will be referred
  643.    to as a "DHCPDISCOVER" message.
  644.  
  645. 3.1 Client-server interaction - allocating a network address
  646.  
  647.    The following summary of the protocol exchanges between clients and
  648.    servers refers to the DHCP messages described in table 2.  The
  649.    timeline diagram in figure 3 shows the timing relationships in a
  650.    typical client-server interaction.  If the client already knows its
  651.    address, some steps may be omitted; this abbreviated interaction is
  652.    described in section 3.2.
  653.  
  654.    1. The client broadcasts a DHCPDISCOVER message on its local physical
  655.       subnet.  The DHCPDISCOVER message may include options that suggest
  656.       values for the network address and lease duration.  BOOTP relay
  657.       agents may pass the message on to DHCP servers not on the same
  658.       physical subnet.
  659.  
  660.    2. Each server may respond with a DHCPOFFER message that includes an
  661.       available network address in the 'yiaddr' field (and other
  662.       configuration parameters in DHCP options).  Servers need not
  663.       reserve the offered network address, although the protocol will
  664.       work more efficiently if the server avoids allocating the offered
  665.       network address to another client.  The server unicasts the
  666.       DHCPOFFER message to the client (using the DHCP/BOOTP relay agent
  667.       if necessary) if possible, or may broadcast the message to a
  668.       broadcast address (preferably 255.255.255.255) on the client's
  669.       subnet.
  670.  
  671.    3. The client receives one or more DHCPOFFER messages from one or
  672.       more servers.  The client may choose to wait for multiple
  673.       responses.  The client chooses one server from which to request
  674.       configuration parameters, based on the configuration parameters
  675.       offered in the DHCPOFFER messages.  The client broadcasts a
  676.  
  677.  
  678.  
  679. Droms                                                          [Page 12]
  680.  
  681.  
  682. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  683.  
  684.  
  685.       DHCPREQUEST message that MUST include the 'server identifier'
  686.       option to indicate which server it has selected, and may include
  687.       other options specifying desired configuration values.  This
  688.       DHCPREQUEST message is broadcast and relayed through DHCP/BOOTP
  689.       relay agents.  To help ensure that any DHCP/BOOTP relay agents
  690.       forward the DHCPREQUEST message to the same set of DHCP servers
  691.       that received the original DHCPDISCOVER message, the DHCPREQUEST
  692.       message must use the same value in the DHCP message header's
  693.       'secs' field and be sent to the same IP broadcast address as the
  694.       original DHCPDISCOVER message.  The client times out and
  695.       retransmits the DHCPDISCOVER message if the client receives no
  696.       DHCPOFFER messages.
  697.  
  698.    4. The servers receive the DHCPREQUEST broadcast from the client.
  699.       Those servers not selected by the DHCPREQUEST message use the
  700.       message as notification that the client has declined that server's
  701.       offer.  The server selected in the DHCPREQUEST message commits the
  702.       binding for the client to persistent storage and responds with a
  703.       DHCPACK message containing the configuration parameters for the
  704.       requesting client.  The combination of 'chaddr' and assigned
  705.       network address constitute an unique identifier for the client's
  706.       lease and are used by both the client and server to identify a
  707.       lease referred to in any DHCP messages.  The 'yiaddr' field in the
  708.       DHCPACK messages is filled in with the selected network address.
  709.  
  710.       If the selected server is unable to satisfy the DHCPREQUEST message
  711.       (e.g., the requested network address has been allocated), the
  712.       server SHOULD respond with a DHCPNAK message.
  713.  
  714.       A server may choose to mark addresses offered to clients in
  715.       DHCPOFFER messages as unavailable.  The server should mark an
  716.       address offered to a client in a DHCPOFFER message as available if
  717.       the server receives no DHCPREQUEST message from that client.
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.  
  731.  
  732.  
  733.  
  734.  
  735.  
  736. Droms                                                          [Page 13]
  737.  
  738.  
  739. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  740.  
  741.  
  742.    FIELD      OCTETS       DESCRIPTION
  743.    -----      ------       -----------
  744.  
  745.    op            1  Message op code / message type.
  746.                     1 = BOOTREQUEST, 2 = BOOTREPLY
  747.    htype         1  Hardware address type, see ARP section in "Assigned
  748.                     Numbers" RFC; e.g., '1' = 10mb ethernet.
  749.    hlen          1  Hardware address length (e.g.  '6' for 10mb
  750.                     ethernet).
  751.    hops          1  Client sets to zero, optionally used by relay-agents
  752.                     when booting via a relay-agent.
  753.    xid           4  Transaction ID, a random number chosen by the
  754.                     client, used by the client and server to associate
  755.                     messages and responses between a client and a
  756.                     server.
  757.    secs          2  Filled in by client, seconds elapsed since client
  758.                     started trying to boot.
  759.    flags         2  Flags (see figure 2).
  760.    ciaddr        4  Client IP address; filled in by client in
  761.                     DHCPREQUEST if verifying previously allocated
  762.                     configuration parameters.
  763.    yiaddr        4  'your' (client) IP address.
  764.    siaddr        4  IP address of next server to use in bootstrap;
  765.                     returned in DHCPOFFER, DHCPACK and DHCPNAK by
  766.                     server.
  767.    giaddr        4  Relay agent IP address, used in booting via a
  768.                     relay-agent.
  769.    chaddr       16  Client hardware address.
  770.    sname        64  Optional server host name, null terminated string.
  771.    file        128  Boot file name, null terminated string; "generic"
  772.                     name or null in DHCPDISCOVER, fully qualified
  773.                     directory-path name in DHCPOFFER.
  774.    options     312  Optional parameters field.  See the options
  775.                     documents for a list of defined options.
  776.  
  777.              Table 1:  Description of fields in a DHCP message
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789.  
  790.  
  791.  
  792.  
  793. Droms                                                          [Page 14]
  794.  
  795.  
  796. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  797.  
  798.  
  799.                 Server          Client          Server
  800.             (not selected)                    (selected)
  801.  
  802.                   v               v               v
  803.                   |               |               |
  804.                   |     Begins initialization     |
  805.                   |               |               |
  806.                   | _____________/|\_____________ |
  807.                   |/ DHCPDISCOVER | DHCPDISCOVER \|
  808.                   |               |               |
  809.               Determines          |          Determines
  810.              configuration        |         configuration
  811.                   |               |               |
  812.                   |\              |  ____________/|
  813.                   | \_________    | /DHCPOFFER    |
  814.                   |  DHCPOFFER\   |/              |
  815.                   |            \  |               |
  816.                   |       Collects replies        |
  817.                   |              \|               |
  818.                   |     Selects configuration     |
  819.                   |               |               |
  820.                   | _____________/|\_____________ |
  821.                   |/ DHCPREQUEST  |  DHCPREQUEST \|
  822.                   |               |               |
  823.                   |               |     Commits configuration
  824.                   |               |               |
  825.                   |               | _____________/|
  826.                   |               |/ DHCPACK      |
  827.                   |               |               |
  828.                   |    Initialization complete    |
  829.                   |               |               |
  830.                   .               .               .
  831.                   .               .               .
  832.                   |               |               |
  833.                   |      Graceful shutdown        |
  834.                   |               |               |
  835.                   |               |\_____________ |
  836.                   |               |  DHCPRELEASE \|
  837.                   |               |               |
  838.                   |               |        Discards lease
  839.                   |               |               |
  840.                   v               v               v
  841.  
  842.      Figure 3: Timeline diagram of messages exchanged between DHCP
  843.                client and servers when allocating a new network address
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850. Droms                                                          [Page 15]
  851.  
  852.  
  853. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  854.  
  855.  
  856.    Message         Use
  857.    -------         ---
  858.  
  859.    DHCPDISCOVER -  Client broadcast to locate available servers.
  860.  
  861.    DHCPOFFER    -  Server to client in response to DHCPDISCOVER with
  862.                    offer of configuration parameters.
  863.  
  864.    DHCPREQUEST  -  Client broadcast to servers requesting offered
  865.                    parameters from one server and implicitly declining
  866.                    offers from all others.
  867.  
  868.    DHCPACK      -  Server to client with configuration parameters,
  869.                    including committed network address.
  870.  
  871.    DHCPNAK      -  Server to client refusing request for configuration
  872.                    parameters (e.g., requested network address already
  873.                    allocated).
  874.  
  875.    DHCPDECLINE  -  Client to server indicating configuration parameters
  876.                    (e.g., network address) invalid.
  877.  
  878.    DHCPRELEASE  -  Client to server relinquishing network address and
  879.                    cancelling remaining lease.
  880.  
  881.                           Table 2:  DHCP messages
  882.  
  883.    5. The client receives the DHCPACK message with configuration
  884.       parameters.  The client performs a final check on the parameters
  885.       (e.g., ARP for allocated network address), and notes the duration
  886.       of the lease and the lease identification cookie specified in the
  887.       DHCPACK message.  At this point, the client is configured.  If the
  888.       client detects a problem with the parameters in the DHCPACK
  889.       message, the client sends a DHCPDECLINE message to the server and
  890.       restarts the configuration process.  The client should wait a
  891.       minimum of ten seconds before restarting the configuration process
  892.       to avoid excessive network traffic in case of looping.
  893.  
  894.       If the client receives a DHCPNAK message, the client restarts the
  895.       configuration process.
  896.  
  897.       The client times out and retransmits the DHCPREQUEST message if the
  898.       client receives neither a DHCPACK or a DHCPNAK message.  The client
  899.       retransmits the DHCPREQUEST according to the retransmission
  900.       algorithm in section 4.1.  If the client receives neither a DHCPACK
  901.       or a DHCPNAK message after ten retransmissions of the DHCPREQUEST
  902.       message, the client reverts to INIT state and restarts the
  903.       initialization process.  The client SHOULD notify the user that the
  904.  
  905.  
  906.  
  907. Droms                                                          [Page 16]
  908.  
  909.  
  910. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  911.  
  912.  
  913.       initialization process has failed and is restarting.
  914.  
  915.    6. The client may choose to relinquish its lease on a network address
  916.       by sending a DHCPRELEASE message to the server.  The client
  917.       identifies the lease to be released by including its network
  918.       address in the 'ciaddr' field and its hardware address in the
  919.       'chaddr' field.
  920.  
  921. 3.2 Client-server interaction - reusing a previously allocated network
  922.     address
  923.  
  924.    If a client remembers and wishes to reuse a previously allocated
  925.    network address (allocated either by DHCP or some means outside the
  926.    protocol), a client may choose to omit some of the steps described in
  927.    the previous section.  The timeline diagram in figure 4 shows the
  928.    timing relationships in a typical client-server interaction for a
  929.    client reusing a previously allocated network address.
  930.  
  931.       1. The client broadcasts a DHCPREQUEST message on its local subnet.
  932.          The DHCPREQUEST message includes the client's network address in
  933.          the 'ciaddr' field.  DHCP/BOOTP relay agents pass the message on
  934.          to DHCP servers not on the same subnet.
  935.  
  936.       2. Servers with knowledge of the client's configuration parameters
  937.          respond with a DHCPACK message to the client.
  938.  
  939.          If the client's request is invalid (e.g., the client has moved
  940.          to a new subnet), servers may respond with a DHCPNAK message to
  941.          the client.
  942.  
  943.       3. The client receives the DHCPACK message with configuration
  944.          prameters.  The client performs a final check on the parameters
  945.          (as in section 3.1), and notes the duration of the lease and
  946.          the lease identification cookie specified in the DHCPACK
  947.          message.  At this point, the client is configured.
  948.  
  949.          If the client detects a problem with the parameters in the
  950.          DHCPACK message, the client sends a DHCPDECLINE message to the
  951.          server and restarts the configuration process by requesting a
  952.          new network address.  This action corresponds to the client
  953.          moving to the INIT state in the DHCP state diagram, which is
  954.          described in section 4.4.
  955.  
  956.  
  957.  
  958.  
  959.  
  960.  
  961.  
  962.  
  963.  
  964. Droms                                                          [Page 17]
  965.  
  966.  
  967. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  968.  
  969.  
  970.                 Server          Client          Server
  971.  
  972.                   v               v               v
  973.                   |               |               |
  974.                   |             Begins            |
  975.                   |         initialization        |
  976.                   |               |               |
  977.                   |              /|\              |
  978.                   |  ___________/ | \___________  |
  979.                   | /DHCPREQUEST  |  DHCPREQUEST\ |
  980.                   |/              |              \|
  981.                   |               |               |
  982.                Locates            |            Locates
  983.             configuration         |         configuration
  984.                   |               |               |
  985.                   |\              |              /|
  986.                   | \             |  ___________/ |
  987.                   |  \            | /  DHCPACK    |
  988.                   |   \_______    |/              |
  989.                   |    DHCPACK\   |               |
  990.                   |         Initialization        |
  991.                   |            complete           |
  992.                   |              \|               |
  993.                   |               |               |
  994.                   |          (Subsequent          |
  995.                   |            DHCPACKS           |
  996.                   |            ignored)           |
  997.                   |               |               |
  998.                   |               |               |
  999.                   v               v               v
  1000.  
  1001.      Figure 4: Timeline diagram of messages exchanged between DHCP
  1002.                client and servers when reusing a previously allocated
  1003.                network address
  1004.  
  1005.          If the client receives a DHCPNAK message, it cannot reuse its
  1006.          remembered network address.  It must instead request a new
  1007.          address by restarting the configuration process, this time
  1008.          using the (non-abbreviated) procedure described in section
  1009.          3.1.  This action also corresponds to the client moving to
  1010.          the INIT state in the DHCP state diagram.
  1011.  
  1012.          The client times out and retransmits the DHCPREQUEST message if
  1013.          the client receives neither a DHCPACK nor a DHCPNAK message.
  1014.          The   time between retransmission MUST be chosen according to
  1015.          the algorithm given in section 4.1.  If the client receives no
  1016.          answer after transmitting 4 DHCPREQUEST messages, the client
  1017.          MAY choose to use the previously allocated network address and
  1018.  
  1019.  
  1020.  
  1021. Droms                                                          [Page 18]
  1022.  
  1023.  
  1024. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  1025.  
  1026.  
  1027.          configuration parameters for the remainder of the unexpired
  1028.          lease.  This corresponds to moving to BOUND state in the client
  1029.          state transition diagram shown in figure 5.
  1030.  
  1031.       4. The client may choose to relinquish its lease on a network
  1032.          address by sending a DHCPRELEASE message to the server.  The
  1033.          client identifies the lease to be released with the lease
  1034.          identification cookie.
  1035.  
  1036.          Note that in this case, where the client retains its network
  1037.          address locally, the client will not normally relinquish its
  1038.          lease during a graceful shutdown.  Only in the case where the
  1039.          client explicitly needs to relinquish its lease, e.g., the client
  1040.          is about to be moved to a different subnet, will the client send
  1041.          a DHCPRELEASE message.
  1042.  
  1043. 3.3 Interpretation and representation of time values
  1044.  
  1045.    A client acquires a lease for a network address for a fixed period of
  1046.    time (which may be infinite).  Throughout the protocol, times are to
  1047.    be represented in units of seconds.  The time value of 0xffffffff is
  1048.    reserved to represent "infinity".  The minimum lease duration is one
  1049.    hour.
  1050.  
  1051.    As clients and servers may not have synchronized clocks, times are
  1052.    represented in DHCP messages as relative times, to be interpreted
  1053.    with respect to the client's local clock.  Representing relative
  1054.    times in units of seconds in an unsigned 32 bit word gives a range of
  1055.    relative times from 0 to approximately 100 years, which is sufficient
  1056.    for the relative times to be measured using DHCP.
  1057.  
  1058.    The algorithm for lease duration interpretation given in the previous
  1059.    paragraph assumes that client and server clocks are stable relative
  1060.    to each other.  If there is drift between the two clocks, the server
  1061.    may consider the lease expired before the client does.  To
  1062.    compensate, the server may return a shorter lease duration to the
  1063.    client than the server commits to its local database of client
  1064.    information.
  1065.  
  1066. 3.4 Host parameters in DHCP
  1067.  
  1068.    Not all clients require initialization of all parameters listed in
  1069.    Appendix A.  Two techniques are used to reduce the number of
  1070.    parameters transmitted from the server to the client.  First, most of
  1071.    the parameters have defaults defined in the Host Requirements RFCs;
  1072.    if the client receives no parameters from the server that override
  1073.    the defaults, a client uses those default values.  Second, in its
  1074.    initial DHCPDISCOVER or DHCPREQUEST message, a client may provide the
  1075.  
  1076.  
  1077.  
  1078. Droms                                                          [Page 19]
  1079.  
  1080.  
  1081. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  1082.  
  1083.  
  1084.    server with a list of specific parameters the client is interested
  1085.    in.
  1086.  
  1087.    The client SHOULD include the 'maximum DHCP message size' option to
  1088.    let the server know how large the server may make its DHCP messages.
  1089.    The parameters returned to a client may still exceed the space
  1090.    allocated to options in a DHCP message.  In this case, two additional
  1091.    options flags (which must appear in the 'options' field of the
  1092.    message) indicate that the 'file' and 'sname' fields are to be used
  1093.    for options.
  1094.  
  1095.    The client can inform the server which configuration parameters the
  1096.    client is interested in by including the 'parameter request list'
  1097.    option.  The data portion of this option explicitly lists the options
  1098.    requested by tag number.
  1099.  
  1100.    In addition, the client may suggest values for the network address
  1101.    and lease time in the DHCPDISCOVER message.  The client may include
  1102.    the 'requested IP address' option to suggest that a particular IP
  1103.    address be assigned, and may include the 'IP address lease time'
  1104.    option to suggest the lease time it would like.  No other options
  1105.    representing "hints" at configuration parameters are allowed in a
  1106.    DHCPDISCOVER or DHCPREQUEST message.  The 'ciaddr' field is to be
  1107.    filled in only in a DHCPREQUEST message when the client is requesting
  1108.    use of a previously allocated IP address.
  1109.  
  1110.    If a server receives a DHCPREQUEST message with an invalid 'ciaddr',
  1111.    the server SHOULD respond to the client with a DHCPNAK message and
  1112.    may choose to report the problem to the system administrator.  The
  1113.    server may include an error message in the 'message' option.
  1114.  
  1115. 3.5 Use of DHCP in clients with multiple interfaces
  1116.  
  1117.    A host with multiple network interfaces must use DHCP through each
  1118.    interface independently to obtain configuration information
  1119.    parameters for those separate interfaces.
  1120.  
  1121. 3.6 When clients should use DHCP
  1122.  
  1123.    A host should use DHCP to reacquire or verify its IP address and
  1124.    network parameters whenever the local network parameters may have
  1125.    changed; e.g., at system boot time or after a disconnection from the
  1126.    local network, as the local network configuration may change without
  1127.    the host's or user's knowledge.
  1128.  
  1129.    If a host has knowledge of a previous network address and is unable
  1130.    to contact a local DHCP server, the host may continue to use the
  1131.    previous network address until the lease for that address expires.
  1132.  
  1133.  
  1134.  
  1135. Droms                                                          [Page 20]
  1136.  
  1137.  
  1138. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  1139.  
  1140.  
  1141.    If the lease expires before the host can contact a DHCP server, the
  1142.    host must immediately discontinue use of the previous network address
  1143.    and may inform local users of the problem.
  1144.  
  1145. 4. Specification of the DHCP client-server protocol
  1146.  
  1147.    In this section, we assume that a DHCP server has a block of network
  1148.    addresses from which it can satisfy requests for new addresses.  Each
  1149.    server also maintains a database of allocated addresses and leases in
  1150.    local permanent storage.
  1151.  
  1152. 4.1 Constructing and sending DHCP messages
  1153.  
  1154.    DHCP clients and servers both construct DHCP messages by filling in
  1155.    fields in the fixed format section of the message and appending
  1156.    tagged data items in the variable length option area.  The options
  1157.    area includes first a four-octet 'magic cookie' (which was described
  1158.    in section 3), followed by the options.  The last option must always
  1159.    be the 'end' option.
  1160.  
  1161.    DHCP uses UDP as its transport protocol.  DHCP messages from a client
  1162.    to a server are sent to the 'DHCP server' port (67), and DHCP
  1163.    messages from a server to a client are sent to the 'DHCP client' port
  1164.    (68).
  1165.  
  1166.    DHCP messages broadcast by a client prior to that client obtaining
  1167.    its IP address must have the source address field in the IP header
  1168.    set to 0.
  1169.  
  1170.    If the 'giaddr' field in a DHCP message from a client is non-zero,
  1171.    the server sends any return messages to the 'DHCP server' port on the
  1172.    DHCP relaying agent whose address appears in 'giaddr'.  If the
  1173.    'giaddr' field is zero, the client is on the same subnet, and the
  1174.    server sends any return messages to either the client's network
  1175.    address, if that address was supplied in the 'ciaddr' field, or to
  1176.    the client's hardware address or to the local subnet broadcast
  1177.    address.
  1178.  
  1179.    If the options in a DHCP message extend into the 'sname' and 'file'
  1180.    fields, the 'option overload' option MUST appear in the 'options'
  1181.    field, with value 1, 2 or 3, as specified in the DHCP options
  1182.    document [2].  If the 'option overload' option is present in the
  1183.    'options' field, the options in the 'options' field MUST be
  1184.    terminated by an 'end' option, and MAY contain one or more 'pad'
  1185.    options to fill the options field.  The options in the 'sname' and
  1186.    'file' fields (if in use as indicated by the 'options overload'
  1187.    option) MUST begin with the first octet of the field, MUST be
  1188.    terminated by an 'end' option, and MUST be followed by 'pad' options
  1189.  
  1190.  
  1191.  
  1192. Droms                                                          [Page 21]
  1193.  
  1194.  
  1195. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  1196.  
  1197.  
  1198.    to fill the remainder of the field.  Any individual option in the
  1199.    'options', 'sname' and 'file' fields MUST be entirely contained in
  1200.    that field.  The options in the 'options' field MUST be interpreted
  1201.    first, so that any 'option overload' options may be interpreted.  The
  1202.    'file' field MUST be interpreted next (if the 'option overload'
  1203.    option indicates that the 'file' field contains DHCP options),
  1204.    followed by the 'sname' field.
  1205.  
  1206.    DHCP clients are responsible for all message retransmission.  The
  1207.    client MUST adopt a retransmission strategy that incorporates a
  1208.    randomized exponential backoff algorithm to determine the delay
  1209.    between retransmissions.  The delay before the first retransmission
  1210.    MUST be 4 seconds randomized by the value of a uniform random number
  1211.    chosen from the range -1 to +1.  Clients with clocks that provide
  1212.    resolution granularity of less than one second may choose a non-
  1213.    integer randomization value.  The delay before the next
  1214.    retransmission MUST be 8 seconds randomized by the value of a uniform
  1215.    number chosen from the range -1 to +1.  The retransmission delay MUST
  1216.    be doubled with subsequent retransmissions up to a maximum of 64
  1217.    seconds.  The client MAY provide an indication of retransmission
  1218.    attempts to the user as an indication of the progress of the
  1219.    configuration process.  The protocol specification in the remainder
  1220.    of this section will describe, for each DHCP message, when it is
  1221.    appropriate for the client to retransmit that message forever, and
  1222.    when it is appropriate for a client to abandon that message and
  1223.    attempt to use a different DHCP message.
  1224.  
  1225.    Normally, DHCP servers and BOOTP relay agents attempt to deliver
  1226.    DHCPOFFER, DHCPACK and DHCPNAK messages directly to the client using
  1227.    unicast delivery.  The IP destination address (in the IP header) is
  1228.    set to the DHCP 'yiaddr' address and the link-layer destination
  1229.    address is set to the DHCP 'chaddr' address.  Unfortunately, some
  1230.    client implementations are unable to receive such unicast IP
  1231.    datagrams until the implementation has been configured with a valid
  1232.    IP address (leading to a deadlock in which the client's IP address
  1233.    cannot be delivered until the client has been configured with an IP
  1234.    address).
  1235.  
  1236.    A client that cannot receive unicast IP datagrams until its protocol
  1237.    software has been configured with an IP address SHOULD set the
  1238.    BROADCAST bit in the 'flags' field to 1 in any DHCPDISCOVER or
  1239.    DHCPREQUEST messages that client sends.  The BROADCAST bit will
  1240.    provide a hint to the DHCP server and BOOTP relay agent to broadcast
  1241.    any messages to the client on the client's subnet.  A client that can
  1242.    receive unicast IP datagrams before its protocol software has been
  1243.    configured SHOULD clear the BROADCAST bit to 0.  The BOOTP
  1244.    clarifications document discusses the ramifications of the use of the
  1245.    BROADCAST bit [21].
  1246.  
  1247.  
  1248.  
  1249. Droms                                                          [Page 22]
  1250.  
  1251.  
  1252. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  1253.  
  1254.  
  1255.    A server or relay agent sending or relaying a DHCP message directly
  1256.    to a DHCP client (i.e., not to a relay agent specified in the
  1257.    'giaddr' field) SHOULD examine the BROADCAST bit in the 'flags'
  1258.    field.  If this bit is set to 1, the DHCP message SHOULD be sent as
  1259.    an IP broadcast using an IP broadcast address (preferably
  1260.    255.255.255.255) as the IP destination address and the link-layer
  1261.    broadcast address as the link-layer destination address.  If the
  1262.    BROADCAST bit is cleared to 0, the message SHOULD be sent as an IP
  1263.    unicast to the IP address specified in the 'yiaddr' field and the
  1264.    link-layer address specified in the 'chaddr' field.  If unicasting is
  1265.    not possible, the message MAY be sent as an IP broadcast using an IP
  1266.    broadcast address (preferably 255.255.255.255) as the IP destination
  1267.    address and the link-layer broadcast address as the link-layer
  1268.    destination address.
  1269.  
  1270. 4.2 DHCP server administrative controls
  1271.  
  1272.    DHCP servers are not required to respond to every DHCPDISCOVER and
  1273.    DHCPREQUEST message they receive.  For example, a network
  1274.    administrator, to retain stringent control over the hosts attached to
  1275.    the network, may choose to configure DHCP servers to respond only to
  1276.    hosts that have been previously registered through some external
  1277.    mechanism.  The DHCP specification describes only the interactions
  1278.    between clients and servers when the clients and servers choose to
  1279.    interact; it is beyond the scope of the DHCP specification to
  1280.    describe all of the administrative controls that system
  1281.    administrators might want to use.  Specific DHCP server
  1282.    implementations may incorporate any controls or policies desired by a
  1283.    network administrator.
  1284.  
  1285.    In some environments, a DHCP server will have to consider the values
  1286.    of the 'chaddr' field and/or the 'class-identifier' option included
  1287.    in the DHCPDISCOVER or DHCPREQUEST messages when determining the
  1288.    correct parameters for a particular client.  For example, an
  1289.    organization might have a separate bootstrap server for each type of
  1290.    client it uses, requiring the DHCP server to examine the 'class-
  1291.    identifier' to determine which bootstrap server address to return in
  1292.    the 'siaddr' field of a DHCPOFFER or DHCPACK message.
  1293.  
  1294.    A DHCP server must use some unique identifier to associate a client
  1295.    with its lease.  The client may choose to explicitly provide the
  1296.    identifier through the 'client identifier' option.  If the client
  1297.    does not provide a 'client identifier' option, the server MUST use
  1298.    the contents of the 'chaddr' field to identify the client.
  1299.  
  1300.    DHCP clients are free to use any strategy in selecting a DHCP server
  1301.    among those from which the client receives a DHCPOFFER message.  The
  1302.    client implementation of DHCP should provide a mechanism for the user
  1303.  
  1304.  
  1305.  
  1306. Droms                                                          [Page 23]
  1307.  
  1308.  
  1309. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  1310.  
  1311.  
  1312.    to select directly the 'class-identifier' value.
  1313.  
  1314. 4.3 DHCP server behavior
  1315.  
  1316.    A DHCP server processes incoming DHCP messages from a client based on
  1317.    the current state of the binding for that client.  A DHCP server can
  1318.    receive the following messages from a client:
  1319.  
  1320.       o DHCPDISCOVER
  1321.  
  1322.       o DHCPREQUEST
  1323.  
  1324.       o DHCPDECLINE
  1325.  
  1326.       o DHCPRELEASE
  1327.  
  1328.    Table 3 gives the use of the fields and options in a DHCP message by
  1329.    a server.  The remainder of this section describes the action of the
  1330.    DHCP server for each possible incoming message.
  1331.  
  1332. 4.3.1 DHCPDISCOVER message
  1333.  
  1334.    When a server receives a DHCPDISCOVER message from a client, the
  1335.    server chooses a network address for the requesting client.  If no
  1336.    address is available, the server may choose to report the problem to
  1337.    the system administrator and may choose to reply to the client with a
  1338.    DHCPNAK message.  If the server chooses to respond to the client, it
  1339.    may include an error message in the 'message' option.  If an address
  1340.    is available, the new address should be chosen as follows:
  1341.  
  1342.    o The client's previous address as recorded in the client's binding,
  1343.      if that address is in the server's pool of available addresses and
  1344.      not already allocated, else
  1345.  
  1346.    o The address requested in the 'Requested IP Address' option, if that
  1347.      address is valid and not already allocated, else
  1348.  
  1349.    o A new address allocated from the server's pool of available
  1350.      addresses.
  1351.  
  1352.  
  1353.  
  1354.  
  1355.  
  1356.  
  1357.  
  1358.  
  1359.  
  1360.  
  1361.  
  1362.  
  1363. Droms                                                          [Page 24]
  1364.  
  1365.  
  1366. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  1367.  
  1368.  
  1369.   Field      DHCPOFFER            DHCPACK             DHCPNAK
  1370.   -----      ---------            -------             -------
  1371.  
  1372.   'op'       BOOTREPLY            BOOTREPLY           BOOTREPLY
  1373.   'htype'    (From "Assigned Numbers" RFC)
  1374.   'hlen'     (Hardware address length in octets)
  1375.   'hops'     0                    0                   0
  1376.   'xid'      'xid' from client    'xid' from client   'xid' from client
  1377.              DHCPDISCOVER         DHCPREQUEST         DHCPREQUEST
  1378.              message              message             message
  1379.   'secs'     0                    0                   0
  1380.   'ciaddr'   0                    'ciaddr' from       'ciaddr' from
  1381.                                   DHCPREQUEST or 0    DHCPREQUEST or 0
  1382.   'yiaddr'   IP address offered   IP address          0
  1383.              to client            assigned to client
  1384.   'siaddr'   IP address of next   IP address of next  0
  1385.              bootstrap server     bootstrap server
  1386.   'flags'    if 'giaddr' is not 0 then 'flags' from client message else 0
  1387.   'giaddr'   0                    0                   0
  1388.   'chaddr'   'chaddr' from        'chaddr' from       'chaddr' from
  1389.              client               client DHCPREQUEST  client DHCPREQUEST
  1390.              DHCPDISCOVER         message             message
  1391.              message
  1392.   'sname'    Server host name     Server host name    (unused)
  1393.              or options           or options
  1394.   'file'     Client boot file     Client boot file    (unused)
  1395.              name or options      name or options
  1396.   'options'  options              options
  1397.  
  1398.   Option                   DHCPOFFER        DHCPACK          DHCPNAK
  1399.   ------                   ---------        -------          -------
  1400.  
  1401.   Requested IP address     MUST NOT         MUST NOT         MUST NOT
  1402.   IP address lease time    MUST             MUST             MUST NOT
  1403.   Use 'file'/'sname'       MAY              MAY              MUST NOT
  1404.   fields
  1405.   DHCP message type        DHCPOFFER        DHCPACK          DHCPNAK
  1406.   Parameter request list   MUST NOT         MUST NOT         MUST NOT
  1407.   Message                  SHOULD           SHOULD           SHOULD
  1408.   Client identifier        MUST NOT         MUST NOT         MUST NOT
  1409.   Class identifier         MUST NOT         MUST NOT         MUST NOT
  1410.   Server identifier        MUST             MAY              MAY
  1411.   Maximum message size     MUST NOT         MUST NOT         MUST NOT
  1412.   All others               MAY              MAY              MUST NOT
  1413.  
  1414.            Table 3:  Fields and options used by DHCP servers
  1415.  
  1416.  
  1417.  
  1418.  
  1419.  
  1420. Droms                                                          [Page 25]
  1421.  
  1422.  
  1423. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  1424.  
  1425.  
  1426.    As described in section 4.2, a server MAY, for administrative
  1427.    reasons, assign an address other than the one requested, or may
  1428.    refuse to allocate an address to a particular client even though free
  1429.    addresses are available.
  1430.  
  1431.    While not required for correct operation of DHCP, the server should
  1432.    not reuse the selected network address before the client responds to
  1433.    the server's DHCPOFFER message.  The server may choose to record the
  1434.    address as offered to the client.
  1435.  
  1436.    The server must also choose an expiration time for the lease, as
  1437.    follows:
  1438.  
  1439.    o IF the client has not requested a specific lease in the
  1440.      DHCPDISCOVER message and the client already has an assigned network
  1441.      address, the server returns the lease expiration time previously
  1442.      assigned to that address (note that the client must explicitly
  1443.      request a specific lease to extend the expiration time on a
  1444.      previously assigned address), ELSE
  1445.  
  1446.    o IF the client has not requested a specific lease in the
  1447.      DHCPDISCOVER message and the client does not have an assigned
  1448.      network address, the server assigns a locally configured default
  1449.      lease time, ELSE
  1450.  
  1451.    o IF the client has requested a specific lease in the DHCPDISCOVER
  1452.      message (regardless of whether the client has an assigned network
  1453.      address), the server may choose either to return the requested
  1454.      lease (if the lease is acceptable to local policy) or select
  1455.      another lease.
  1456.  
  1457.    Once the network address and lease have been determined, the server
  1458.    constructs a DHCPOFFER message with the offered configuration
  1459.    parameters.  It is important for all DHCP servers to return the same
  1460.    parameters (with the possible exception of a newly allocated network
  1461.    address) to ensure predictable host behavior regardless of the which
  1462.    server the client selects.  The configuration parameters MUST be
  1463.    selected by applying the following rules in the order given below.
  1464.    The network administrator is responsible for configuring multiple
  1465.    DHCP servers to ensure uniform responses from those servers.  The
  1466.    server MUST return to the client:
  1467.  
  1468.  
  1469.  
  1470.  
  1471.  
  1472.  
  1473.  
  1474.  
  1475.  
  1476.  
  1477. Droms                                                          [Page 26]
  1478.  
  1479.  
  1480. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  1481.  
  1482.  
  1483.    o The client's network address, as determined by the rules given
  1484.      earlier in this section, and the subnet mask for the network to
  1485.      which the client is connected,
  1486.  
  1487.    o The expiration time for the client's lease, as determined by the
  1488.      rules given earlier in this section,
  1489.  
  1490.    o Parameters requested by the client, according to the following
  1491.      rules:
  1492.  
  1493.         -- IF the server has been explicitly configured with a default
  1494.            value for the parameter, the server MUST include that value
  1495.            in an appropriate option in the 'option' field, ELSE
  1496.  
  1497.         -- IF the server recognizes the parameter as a parameter
  1498.            defined in the Host Requirements Document, the server MUST
  1499.            include the default value for that parameter as given in the
  1500.            Host Requirements Document in an appropriate option in the
  1501.            'option' field, ELSE
  1502.  
  1503.         -- The server MUST NOT return a value for that parameter,
  1504.  
  1505.    o Any parameters from the existing binding that differ from the Host
  1506.      Requirements documents defaults,
  1507.  
  1508.    o Any parameters specific to this client (as identified by
  1509.      the contents of 'chaddr' in the DHCPDISCOVER or DHCPREQUEST
  1510.      message), e.g., as configured by the network administrator,
  1511.  
  1512.    o Any parameters specific to this client's class (as identified
  1513.      by the contents of the 'class identifier' option in the
  1514.      DHCPDISCOVER or DHCPREQUEST message), e.g., as configured by
  1515.      the network administrator; the parameters MUST be identified
  1516.      by an exact match between the client's 'client class' and the
  1517.      client class identified in the server,
  1518.  
  1519.    o Parameters with non-default values on the client's subnet.
  1520.  
  1521.    The server inserts the 'xid' field from the DHCPDISCOVER message into
  1522.    the 'xid' field of the DHCPOFFER message and sends the DHCPOFFER
  1523.    message to the requesting client.
  1524.  
  1525. 4.3.2 DHCPREQUEST message
  1526.  
  1527.    A DHCPREQUEST message may come from a client responding to a
  1528.    DHCPOFFER message from a server, or from a client verifying a
  1529.    previously allocated IP address.  If the DHCPREQUEST message contains
  1530.    a 'server identifier' option, the message is in response to a
  1531.  
  1532.  
  1533.  
  1534. Droms                                                          [Page 27]
  1535.  
  1536.  
  1537. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  1538.  
  1539.  
  1540.    DHCPOFFER message.  Otherwise, the message is a request to renew or
  1541.    extend an existing lease.
  1542.  
  1543.    Consider first the case of a DHCPREQUEST message in response to a
  1544.    DHCPOFFER message.  If the server is identified in the 'server
  1545.    identifier' option in the DHCPREQUEST message, the server checks to
  1546.    confirm that the requested parameters are acceptable.  Usually, the
  1547.    requested parameters will match those returned to the client in the
  1548.    DHCPOFFER message; however, the client may choose to request a
  1549.    different lease duration.  Also, there is no requirement that the
  1550.    server cache the parameters from the DHCPOFFER message.  The server
  1551.    must simply check that the parameters requested in the DHCPREQUEST
  1552.    are acceptable.  If the parameters are acceptable, the server records
  1553.    the new client binding and returns a DHCPACK message to the client.
  1554.  
  1555.    If the requested parameters are unacceptable, e.g., the requested
  1556.    lease time is unacceptable to local policy, the server sends a
  1557.    DHCPNAK message to the client.  The server may choose to return an
  1558.    error message in the 'message' option.
  1559.  
  1560.    If a different server is identified in the 'server identifier' field,
  1561.    the client has selected a different server from which to obtain
  1562.    configuration parameters.  The server may discard any information it
  1563.    may have cached about the client's request, and may free the network
  1564.    address that it had offered to the client.
  1565.  
  1566.    Note that the client may choose to collect several DHCPOFFER messages
  1567.    and select the "best" offer.  The client indicates its selection by
  1568.    identifying the offering server in the DHCPREQUEST message.  If the
  1569.    client receives no acceptable offers, the client may choose to try
  1570.    another DHCPDISCOVER message.  Therefore, the servers may not receive
  1571.    a specific DHCPREQUEST from which they can decide whether or not the
  1572.    client has accepted the offer.  Because the servers have not
  1573.    committed any network address assignments on the basis of a
  1574.    DHCPOFFER, servers are free to reuse offered network addresses in
  1575.    response to subsequent requests.  As an implementation detail,
  1576.    servers should not reuse offered addresses and may use an
  1577.    implementation-specific timeout mechanism to decide when to reuse an
  1578.    offered address.
  1579.  
  1580.    In the second case, when there is no 'server identifier' option, the
  1581.    client is renewing or extending a previously allocated IP address.
  1582.    The server checks to confirm that the requested parameters are
  1583.    acceptable.  If the parameters specified in the DHCPREQUEST message
  1584.    match the previous parameters, or if the request for an extension of
  1585.    the lease (indicated by an extended 'IP address lease time' option)
  1586.    is acceptable, the server returns a DHCPACK message to the requesting
  1587.    client.  Otherwise, the server returns a DHCPNAK message to the
  1588.  
  1589.  
  1590.  
  1591. Droms                                                          [Page 28]
  1592.  
  1593.  
  1594. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  1595.  
  1596.  
  1597.    client.  In particular, if the previously allocated network address
  1598.    in the 'ciaddr' field from the client does not match the network
  1599.    address recorded by the server for that client, the server sends a
  1600.    DHCPNAK to the client.
  1601.  
  1602.    A DHCP server chooses the parameters to return in a DHCPACK message
  1603.    according to the same rules as used in constructing a DHCPOFFER
  1604.    message, as given in section 4.3.1.
  1605.  
  1606. 4.3.3 DHCPDECLINE message
  1607.  
  1608.    If the server receives a DHCPDECLINE message, the client has
  1609.    discovered through some other means that the suggested network
  1610.    address is already in use.  The server MUST mark the network address
  1611.    as not allocated and SHOULD notify the local system administrator of
  1612.    a possible configuration problem.
  1613.  
  1614. 4.3.4 DHCPRELEASE message
  1615.  
  1616.    Upon receipt of a DHCPRELEASE message, the server marks the network
  1617.    address as not allocated.  The server should retain a record of the
  1618.    client's initialization parameters for possible reuse in response to
  1619.    subsequent requests from the client.
  1620.  
  1621. 4.4 DHCP client behavior
  1622.  
  1623.    Figure 5 gives a state-transition diagram for a DHCP client.  A
  1624.    client can receive the following messages from a server:
  1625.  
  1626.       o DHCPOFFER
  1627.  
  1628.       o DHCPACK
  1629.  
  1630.       o DHCPNAK
  1631.  
  1632.    Table 4 gives the use of the fields and options in a DHCP message by
  1633.    a client.  The remainder of this section describes the action of the
  1634.    DHCP client for each possible incoming message.  The description in
  1635.    the following section corresponds to the full configuration procedure
  1636.    previously described in section 3.1, and the text in the subsequent
  1637.    section corresponds to the abbreviated configuration procedure
  1638.    described in section 3.2.
  1639.  
  1640. 4.4.1 Initialization and allocation of network address
  1641.  
  1642.    The client begins in INIT state and forms a DHCPDISCOVER message.
  1643.    The client should wait a random time between one and ten seconds to
  1644.    desynchronize the use of DHCP at startup.  The client sets 'ciaddr'
  1645.  
  1646.  
  1647.  
  1648. Droms                                                          [Page 29]
  1649.  
  1650.  
  1651. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  1652.  
  1653.  
  1654.    to 0x00000000.  The client MAY request specific parameters by
  1655.    including the 'parameter request list' option.  The client MAY
  1656.    suggest a network address and/or lease time by including the
  1657.    'requested IP address' and 'IP address lease time' options.  The
  1658.    client MUST include its hardware address in the 'chaddr' field for
  1659.    use in delivery of DHCP reply messages.  The client MAY include a
  1660.    different unique identifier in the 'client identifier' option.  If
  1661.    the client does not include the 'client identifier' option, the
  1662.    server will use the contents of the 'chaddr' field to identify the
  1663.    client's lease.
  1664.  
  1665.    The client generates and records a random transaction identifier and
  1666.    inserts that identifier into the 'xid' field.  The client records its
  1667.    own local time for later use in computing the lease expiration.  The
  1668.    client then broadcasts the DHCPDISCOVER on the local hardware
  1669.    broadcast address to 0xffffffff IP broadcast address and 'DHCP
  1670.    server' UDP port.
  1671.  
  1672.    If the 'xid' of an arriving DHCPOFFER message does not match the
  1673.    'xid' of the most recent DHCPDISCOVER message, the DHCPOFFER message
  1674.    must be silently discarded.  Any arriving DHCPACK messages must be
  1675.    silently discarded.
  1676.  
  1677.    The client collects DHCPOFFER messages over a period of time, selects
  1678.    one DHCPOFFER message from the (possibly many) incoming DHCPOFFER
  1679.    messages (e.g., the first DHCPOFFER message or the DHCPOFFER message
  1680.    from the previously used server) and extracts the server address from
  1681.    the 'server identifier' option in the DHCPOFFER message.  The time
  1682.    over which the client collects messages and the mechanism used to
  1683.    select one DHCPOFFER are implementation dependent.  The client may
  1684.    perform a check on the suggested address to ensure that the address
  1685.    is not already in use.  For example, if the client is on a network
  1686.    that supports ARP, the client may issue an ARP request for the
  1687.    suggested request.  When broadcasting an ARP request for the
  1688.    suggested address, the client must fill in its own hardware address
  1689.    as the sender's hardware address, and 0 as the sender's IP address,
  1690.    to avoid confusing ARP caches in other hosts on the same subnet.  If
  1691.    the network address appears to be in use, the client sends a
  1692.    DHCPDECLINE message to the server and waits for another DHCPOFFER. As
  1693.    the client does not have a valid network address, the client must
  1694.    broadcast the DHCPDECLINE message.
  1695.  
  1696.  
  1697.  
  1698.  
  1699.  
  1700.  
  1701.  
  1702.  
  1703.  
  1704.  
  1705. Droms                                                          [Page 30]
  1706.  
  1707.  
  1708. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  1709.  
  1710.  
  1711.  --------                               -------
  1712. |        | +-------------------------->|       |<-------------------+
  1713. | INIT/  | |     +-------------------->| INIT  |                    |
  1714. | REBOOT |DHCPNAK/         +---------->|       |<---+               |
  1715. |        |Restart|         |            -------     |               |
  1716.  --------  |  DHCPNAK/     |               |                        |
  1717.     |      Discard offer   |      -/Send DHCPDISCOVER               |
  1718. -/Send DHCPREQUEST         |               |                        |
  1719.     |      |     |      DHCPACK            v        |               |
  1720.  -----------     |   (not accept.)/   -----------   |               |
  1721. |           |    |  Send DHCPDECLINE |           |  |               |
  1722. | REBOOTING |    |         |         | SELECTING |  |               |
  1723. |           |    |        /          |           |  |               |
  1724.  -----------     |       /            -----------   |               |
  1725.     |            |      /                  |        |               |
  1726. DHCPACK/         |     /  +----------------+        |               |
  1727. Record lease,    |    |   v                         |               |
  1728. set timers      ------------                        |               |
  1729.     |   +----->|            |             DHCPNAK, Lease expired/   |
  1730.     |   |      | REQUESTING |                  Halt network         |
  1731.     DHCPOFFER/ |            |                       |               |
  1732.     Discard     ------------                        |               |
  1733.     |   |        |        |                   -----------           |
  1734.     |   +--------+     DHCPACK/              |           |          |
  1735.     |              Record lease, set    -----| REBINDING |          |
  1736.     |                timers T1, T2     /     |           |          |
  1737.     |                     |        DHCPACK/   -----------           |
  1738.     |                     v     Record lease, set   ^               |
  1739.     +----------------> -------      /Timers T1,T2   |               |
  1740.                +----->|       |<---+                |               |
  1741.                |      | BOUND |<---+                |               |
  1742.   DHCPOFFER, DHCPACK, |       |    |            T2 expires/   DHCPNAK/
  1743.    DHCPNAK/Discard     -------     |             Broadcast  Halt network
  1744.                |       | |         |            DHCPREQUEST         |
  1745.                +-------+ |        DHCPACK/          |               |
  1746.                     T1 expires/   Record lease, set |               |
  1747.                  Send DHCPREQUEST timers T1, T2     |               |
  1748.                  to leasing server |                |               |
  1749.                          |   ----------             |               |
  1750.                          |  |          |------------+               |
  1751.                          +->| RENEWING |                            |
  1752.                             |          |----------------------------+
  1753.                              ----------
  1754.  
  1755.           Figure 5:  State-transition diagram for DHCP clients
  1756.  
  1757.  
  1758.  
  1759.  
  1760.  
  1761.  
  1762. Droms                                                          [Page 31]
  1763.  
  1764.  
  1765. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  1766.  
  1767.  
  1768.   Field      DHCPDISCOVER          DHCPREQUEST           DHCPDECLINE,
  1769.                                                          DHCPRELEASE
  1770.   -----      ------------          -----------           -----------
  1771.  
  1772.   'op'       BOOTREQUEST           BOOTREQUEST           BOOTREQUEST
  1773.   'htype'    (From "Assigned Numbers" RFC)
  1774.   'hlen'     (Hardware address length in octets)
  1775.   'hops'     0                     0                     0
  1776.   'xid'      selected by client    selected by client    selected by
  1777.                                                          client
  1778.   'secs'     (opt.)                (opt.)                0
  1779.   'flags'    Set 'BROADCAST'       Set 'BROADCAST'
  1780.              flag if client        flag if client
  1781.              requires broadcast    requires broadcast
  1782.              reply                 reply
  1783.              0
  1784.   'ciaddr'   0                     previously            ciaddr
  1785.                                    allocated newtork
  1786.                                    address
  1787.   'yiaddr'   0                     0                     0
  1788.   'siaddr'   0                     0                     0
  1789.   'giaddr'   0                     0                     0
  1790.   'chaddr'   client's hardware     client's hardware     client's
  1791.                                                          hardware
  1792.              address               address               address
  1793.   'sname'    options, if           options, if           (unused)
  1794.              indicated in          indicated in
  1795.              'sname/file'          'sname/file'
  1796.              option; otherwise     option; otherwise
  1797.              unused                unused
  1798.   'file'     options, if           options, if           (unused)
  1799.              indicated in          indicated in
  1800.              'sname/file'          'sname/file'
  1801.              option; otherwise     option; otherwise
  1802.              'generic' name or     'generic' name or
  1803.              null                  null
  1804.   'options'  options               options               (unused)
  1805.  
  1806.  
  1807.  
  1808.  
  1809.  
  1810.  
  1811.  
  1812.  
  1813.  
  1814.  
  1815.  
  1816.  
  1817.  
  1818.  
  1819. Droms                                                          [Page 32]
  1820.  
  1821.  
  1822. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  1823.  
  1824.  
  1825.   Option                     DHCPDISCOVER  DHCPREQUEST      DHCPDECLINE,
  1826.                                                             DHCPRELEASE
  1827.   ------                     ------------  -----------      -----------
  1828.  
  1829.   Requested IP address       MAY           MUST NOT         MUST NOT
  1830.   IP address lease time      MAY           MAY              MUST NOT
  1831.   Use 'file'/'sname' fields  MAY           MAY              MAY
  1832.   DHCP message type          DHCPDISCOVER  DHCPREQUEST      DHCPDECLINE/
  1833.                                                             DHCPRELEASE
  1834.   Client identifier          MAY           MAY              MAY
  1835.   Class identifier           SHOULD        SHOULD           MUST NOT
  1836.   Server identifier          MUST NOT      MUST (after      MUST
  1837.                                            DHCPDISCOVER),
  1838.                                            MUST NOT (when
  1839.                                            renewing)
  1840.   Parameter request list     MAY           MAY              MUST NOT
  1841.   Maximum message size       MAY           MAY              MUST NOT
  1842.   Message                    SHOULD NOT    SHOULD NOT       SHOULD
  1843.   Site-specific              MAY           MAY              MUST NOT
  1844.   All others                 MUST NOT      MUST NOT         MUST NOT
  1845.  
  1846.            Table 4:  Fields and options used by DHCP clients
  1847.  
  1848.    If the parameters are acceptable, the client records the address of
  1849.    the server that supplied the parameters from the 'server identifier'
  1850.    field and sends that address in the 'server identifier' field of a
  1851.    DHCPREQUEST broadcast message.  Once the DHCPACK message from the
  1852.    server arrives, the client is initialized and moves to BOUND state.
  1853.    The DHCPREQUEST message contains the same 'xid' as the DHCPOFFER
  1854.    message.  The client records the lease expiration time as the sum of
  1855.    the time at which the original request was sent and the duration of
  1856.    the lease from the DHCPOFFER message.  The client SHOULD broadcast an
  1857.    ARP reply to announce the client's new IP address and clear any
  1858.    outdated ARP cache entries in hosts on the client's subnet.
  1859.  
  1860. 4.4.2 Initialization with known network address
  1861.  
  1862.    The client begins in INIT-REBOOT state and sends a DHCPREQUEST message
  1863.    with the 'ciaddr' field set to the client's network address.  The
  1864.    client may request specific configuration parameters by including
  1865.    the 'parameter request list' option.  The client generates and records a
  1866.    random transaction identifier and inserts that identifier into the 'xid'
  1867.    field.  The client records its own local time for later use in
  1868.    computing the lease expiration.  The client MUST NOT incldue a 'server
  1869.    identifier' in the DHCPREQUEST message.  The client then broadcasts
  1870.    the DHCPREQUEST on the local hardware broadcast address to the 'DHCP
  1871.    server' UDP port.
  1872.  
  1873.  
  1874.  
  1875.  
  1876. Droms                                                          [Page 33]
  1877.  
  1878.  
  1879. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  1880.  
  1881.  
  1882.    Once a DHCPACK message with an 'xid' field matching that in the
  1883.    client's DHCPREQUEST message arrives from any server, the client is
  1884.    initialized and moves to BOUND state.  The client records the lease
  1885.    expiration time as the sum of the time at which the DHCPREQUEST
  1886.    message was sent and the duration of the lease from the DHCPACK
  1887.    message.
  1888.  
  1889. 4.4.3 Initialization with a known DHCP server address
  1890.  
  1891.    When the DHCP client knows the address of a DHCP server, in either
  1892.    INIT or REBOOTING state, the client may use that address in the
  1893.    DHCPDISCOVER or DHCPREQUEST rather than the IP broadcast address.  If
  1894.    the client receives no response to DHCP messages sent to the IP
  1895.    address of a known DHCP server, the DHCP client reverts to using the
  1896.    IP broadcast address.
  1897.  
  1898. 4.4.4 Reacquisition and expiration
  1899.  
  1900.    The client maintains two times, T1 and T2, that specify the times at
  1901.    which the client tries to extend its lease on its network address.  T1
  1902.    is the time at which the client enters the RENEWING state and attempts
  1903.    to contact the server that originally issued the client's network
  1904.    address.  T2 is the time at which the client enters the REBINDING
  1905.    state and attempts to contact any server.
  1906.  
  1907.    At time T1 after the client accepts the lease on its network address,
  1908.    the client moves to RENEWING state and sends (via unicast) a
  1909.    DHCPREQUEST message to the server to extend its lease.  The client
  1910.    generates a random transaction identifier and inserts that identifier
  1911.    into the 'xid' field in the DHCPREQUEST. The client records the local
  1912.    time at which the DHCPREQUEST message is sent for computation of the
  1913.    lease expiration time.  The client MUST NOT include a 'server
  1914.    identifier' in the DHCPREQUEST message.
  1915.  
  1916.    Any DHCPACK messages that arrive with an 'xid' that does not match
  1917.    the 'xid' of the client's DHCPREQUEST message are silently discarded.
  1918.    When the client receives a DHCPACK from the server, the client
  1919.    computes the lease expiration time as the sum of the time at which the
  1920.    client sent the DHCPREQUEST message and the duration of the lease in
  1921.    the DHCPACK message.  The client has successfully reacquired its
  1922.    network address, returns to BOUND state and may continue network
  1923.    processing.
  1924.  
  1925.    If no DHCPACK arrives before time T2 (T2 > T1) before the expiration
  1926.    of the client's lease on its network address, the client moves to
  1927.    REBINDING state and sends (via broadcast) a DHCPREQUEST message to
  1928.    extend its lease.  The client sets the 'ciaddr' field in the
  1929.    DHCPREQUEST to its current network address.  The client MUST NOT
  1930.  
  1931.  
  1932.  
  1933. Droms                                                          [Page 34]
  1934.  
  1935.  
  1936. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  1937.  
  1938.  
  1939.    include a 'server identifier' in the DHCPREQUEST message.
  1940.  
  1941.    Times T1 and T2 are configurable by the server through options.  T1
  1942.    defaults to (0.5 * duration_of_lease).  T2 defaults to (0.875 *
  1943.    duration_of_lease).  Times T1 and T2 should be chosen with some random
  1944.    "fuzz" around a fixed value, to avoid synchronization of client
  1945.    reacquisition.
  1946.  
  1947.    In both RENEWING and REBINDING state, if the client receives no
  1948.    response to its DHCPREQUEST message, the client should wait one-half
  1949.    the remaining time until the expiration of T1 (in RENEWING state) and
  1950.    T2 (in REBINDING state) down to a minimum of 60 seconds, before
  1951.    retransmitting the DHCPREQUEST message.
  1952.  
  1953.    If the lease expires before the client receives a DHCPACK, the client
  1954.    moves to INIT state, MUST immediately stop any other network
  1955.    processing and requests network initialization parameters as if the
  1956.    client were uninitialized.  If the client then receives a DHCPACK
  1957.    allocating that client its previous network address, the client SHOULD
  1958.    continue network processing.  If the client is given a new network
  1959.    address, it MUST NOT continue using the previous network address and
  1960.    SHOULD notify the local users of the problem.
  1961.  
  1962. 4.4.5 DHCPRELEASE
  1963.  
  1964.    If the client no longer requires use of its assigned network address
  1965.    (e.g., the client is gracefully shut down), the client sends a
  1966.    DHCPRELEASE message to the server.  Note that the correct operation of
  1967.    DHCP does not depend on the transmission of DHCPRELEASE messages.
  1968.  
  1969. 5. Acknowledgments
  1970.  
  1971.    Greg Minshall, Leo McLaughlin and John Veizades have patiently
  1972.    contributed to the the design of DHCP through innumerable discussions,
  1973.    meetings and mail conversations.  Jeff Mogul first proposed the
  1974.    client-server based model for DHCP.  Steve Deering searched the
  1975.    various IP RFCs to put together the list of network parameters
  1976.    supplied by DHCP.  Walt Wimer contributed a wealth of practical
  1977.    experience with BOOTP and wrote a document clarifying the behavior of
  1978.    BOOTP/DHCP relay agents.  Jesse Walker analyzed DHCP in detail,
  1979.    pointing out several inconsistencies in earlier specifications of the
  1980.    protocol.  Steve Alexander reviewed Walker's analysis and the fixes to
  1981.    the protocol based on Walker's work.  And, of course, all the members
  1982.    of the Dynamic Host Configuration Working Group of the IETF have
  1983.    contributed to the design of the protocol through discussion and
  1984.    review of the protocol design.
  1985.  
  1986.  
  1987.  
  1988.  
  1989.  
  1990. Droms                                                          [Page 35]
  1991.  
  1992.  
  1993. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  1994.  
  1995.  
  1996. 6. References
  1997.  
  1998.    [1] Acetta, M., "Resource Location Protocol", RFC 887, CMU, December
  1999.        1983.
  2000.  
  2001.    [2] Alexander, S., and R. Droms, "DHCP Options and BOOTP Vendor
  2002.        Extensions", RFC 1533, Lachman Technology, Inc., Bucknell
  2003.        University, October 1993.
  2004.  
  2005.    [3] Braden, R., Editor, "Requirements for Internet Hosts --
  2006.        Communication Layers", STD 3, RFC 1122, USC/Information Sciences
  2007.        Institute, October 1989.
  2008.  
  2009.    [4] Braden, R., Editor, "Requirements for Internet Hosts --
  2010.        Application and Support, STD 3, RFC 1123, USC/Information
  2011.        Sciences Institute, October 1989.
  2012.  
  2013.    [5] Brownell, D, "Dynamic Reverse Address Resolution Protocol
  2014.        (DRARP)", Work in Progress.
  2015.  
  2016.    [6] Comer, D., and R. Droms, "Uniform Access to Internet Directory
  2017.        Services", Proc. of ACM SIGCOMM '90 (Special issue of Computer
  2018.        Communications Review), 20(4):50--59, 1990.
  2019.  
  2020.    [7] Croft, B., and J. Gilmore, "Bootstrap Protocol (BOOTP)", RFC 951,
  2021.        Stanford and SUN Microsystems, September 1985.
  2022.  
  2023.    [8] Deering, S., "ICMP Router Discovery Messages", RFC 1256, Xerox
  2024.        PARC, September 1991.
  2025.  
  2026.    [9] Droms, D., "Interoperation between DHCP an BOOTP" RFC 1534,
  2027.        Bucknell University, October 1993.
  2028.  
  2029.   [10] Finlayson, R., Mann, T., Mogul, J., and M. Theimer, "A Reverse
  2030.        Address Resolution Protocol", RFC 903, Stanford, June 1984.
  2031.  
  2032.   [11] Gray C., and D. Cheriton, "Leases: An Efficient Fault-Tolerant
  2033.        Mechanism for Distributed File Cache Consistency", In Proc. of
  2034.        the Twelfth ACM Symposium on Operating Systems Design, 1989.
  2035.  
  2036.   [12] Mockapetris, P., "Domain Names -- Concepts and Facilities", STD
  2037.        13, RFC 1034, USC/Information Sciences Institute, November 1987.
  2038.  
  2039.   [13] Mockapetris, P., "Domain Names -- Implementation and
  2040.        Specification", STD 13, RFC 1035, USC/Information Sciences
  2041.        Institute, November 1987.
  2042.  
  2043.  
  2044.  
  2045.  
  2046.  
  2047. Droms                                                          [Page 36]
  2048.  
  2049.  
  2050. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  2051.  
  2052.  
  2053.   [14] Mogul J., and S. Deering, "Path MTU Discovery", RFC 1191,
  2054.        November 1990.
  2055.  
  2056.   [15] Morgan, R., "Dynamic IP Address Assignment for Ethernet Attached
  2057.        Hosts", Work in Progress.
  2058.  
  2059.   [16] Postel, J., "Internet Control Message Protocol", STD 5, RFC 792,
  2060.        USC/Information Sciences Institute, September 1981.
  2061.  
  2062.   [17] Reynolds, J., "BOOTP Vendor Information Extensions", RFC 1497,
  2063.        USC/Information Sciences Institute, August 1993.
  2064.  
  2065.   [18] Reynolds, J., and J. Postel, "Assigned Numbers", STD 2, RFC 1340,
  2066.        USC/Information Sciences Institute, July 1992.
  2067.  
  2068.   [19] Jeffrey Schiller and Mark Rosenstein. A Protocol for the Dynamic
  2069.        Assignment of IP Addresses for use on an Ethernet. (Available
  2070.        from the Athena Project, MIT), 1989.
  2071.  
  2072.   [20] Sollins, K., "The TFTP Protocol (Revision 2)",  RFC 783, NIC,
  2073.        June 1981.
  2074.  
  2075.   [21] Wimer, W., "Clarifications and Extensions for the Bootstrap
  2076.        Protocol", RFC 1542, Carnegie Mellon University, October 1993.
  2077.  
  2078. 7. Security Considerations
  2079.  
  2080.    DHCP is built directly on UDP and IP which are as yet inherently
  2081.    insecure.  Furthermore, DHCP is generally intended to make
  2082.    maintenance of remote and/or diskless hosts easier.  While perhaps
  2083.    not impossible, configuring such hosts with passwords or keys may be
  2084.    difficult and inconvenient.  Therefore, DHCP in its current form is
  2085.    quite insecure.
  2086.  
  2087.    Unauthorized DHCP servers may be easily set up.  Such servers can
  2088.    then send false and potentially disruptive information to clients
  2089.    such as incorrect or duplicate IP addresses, incorrect routing
  2090.    information (including spoof routers, etc.), incorrect domain
  2091.    nameserver addresses (such as spoof nameservers), and so on.
  2092.    Clearly, once this seed information is in place, an attacker can
  2093.    further compromise affected systems.
  2094.  
  2095.    Malicious DHCP clients could masquerade as legitimate clients and
  2096.    retrieve information intended for those legitimate clients.  Where
  2097.    dynamic allocation of resources is used, a malicious client could
  2098.    claim all resources for itself, thereby denying resources to
  2099.    legitimate clients.
  2100.  
  2101.  
  2102.  
  2103.  
  2104. Droms                                                          [Page 37]
  2105.  
  2106.  
  2107. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  2108.  
  2109.  
  2110. 8. Author's Address
  2111.  
  2112.    Ralph Droms
  2113.    Computer Science Department
  2114.    323 Dana Engineering
  2115.    Bucknell University
  2116.    Lewisburg, PA 17837
  2117.  
  2118.    Phone: (717) 524-1145
  2119.    EMail: droms@bucknell.edu
  2120.  
  2121.  
  2122.  
  2123.  
  2124.  
  2125.  
  2126.  
  2127.  
  2128.  
  2129.  
  2130.  
  2131.  
  2132.  
  2133.  
  2134.  
  2135.  
  2136.  
  2137.  
  2138.  
  2139.  
  2140.  
  2141.  
  2142.  
  2143.  
  2144.  
  2145.  
  2146.  
  2147.  
  2148.  
  2149.  
  2150.  
  2151.  
  2152.  
  2153.  
  2154.  
  2155.  
  2156.  
  2157.  
  2158.  
  2159.  
  2160.  
  2161. Droms                                                          [Page 38]
  2162.  
  2163.  
  2164. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  2165.  
  2166.  
  2167. A. Host Configuration Parameters
  2168.  
  2169.    IP-layer_parameters,_per_host:_
  2170.  
  2171.    Be a router                     on/off                 HRC 3.1
  2172.    Non-local source routing        on/off                 HRC 3.3.5
  2173.    Policy filters for
  2174.    non-local source routing        (list)                 HRC 3.3.5
  2175.    Maximum reassembly size         integer                HRC 3.3.2
  2176.    Default TTL                     integer                HRC 3.2.1.7
  2177.    PMTU aging timeout              integer                MTU 6.6
  2178.    MTU plateau table               (list)                 MTU 7
  2179.    IP-layer_parameters,_per_interface:_
  2180.    IP address                      (address)              HRC 3.3.1.6
  2181.    Subnet mask                     (address mask)         HRC 3.3.1.6
  2182.    MTU                             integer                HRC 3.3.3
  2183.    All-subnets-MTU                 on/off                 HRC 3.3.3
  2184.    Broadcast address flavor        0x00000000/0xffffffff  HRC 3.3.6
  2185.    Perform mask discovery          on/off                 HRC 3.2.2.9
  2186.    Be a mask supplier              on/off                 HRC 3.2.2.9
  2187.    Perform router discovery        on/off                 RD 5.1
  2188.    Router solicitation address     (address)              RD 5.1
  2189.    Default routers, list of:
  2190.           router address          (address)              HRC 3.3.1.6
  2191.           preference level        integer                HRC 3.3.1.6
  2192.    Static routes, list of:
  2193.           destination             (host/subnet/net)      HRC 3.3.1.2
  2194.           destination mask        (address mask)         HRC 3.3.1.2
  2195.           type-of-service         integer                HRC 3.3.1.2
  2196.           first-hop router        (address)              HRC 3.3.1.2
  2197.           ignore redirects        on/off                 HRC 3.3.1.2
  2198.           PMTU                    integer                MTU 6.6
  2199.           perform PMTU discovery  on/off                 MTU 6.6
  2200.  
  2201.    Link-layer_parameters,_per_interface:_
  2202.    Trailers                       on/off                 HRC 2.3.1
  2203.    ARP cache timeout              integer                HRC 2.3.2.1
  2204.    Ethernet encapsulation         (RFC 894/RFC 1042)     HRC 2.3.3
  2205.  
  2206.    TCP_parameters,_per_host:_
  2207.    TTL                            integer                HRC 4.2.2.19
  2208.    Keep-alive interval            integer                HRC 4.2.3.6
  2209.    Keep-alive data size           0/1                    HRC 4.2.3.6
  2210.  
  2211. Key:
  2212.  
  2213.    MTU = Path MTU Discovery (RFC 1191, Proposed Standard)
  2214.    RD = Router Discovery (RFC 1256, Proposed Standard)
  2215.  
  2216.  
  2217.  
  2218. Droms                                                          [Page 39]
  2219.  
  2220.  
  2221.  
  2222.  
  2223.