Dynamic Host Configuration Protocol (DHCP)

anchored to 143.00_anchor

These information were taken from the "internetpraktikum" course of uni tuebingen. I copy and modify / adapt some of their slides / notes to better my understanding further.

Motivation

Manually configuring the network parameters of many computers may be tedious up to impossible. In the case that not all computers are connected permanently to the network, thus it is not required that all IP addresses are assigned simultaneously. A network may then need a smaller number of addresses than hosts connecting to it.

Goals

  • Simplified installation and maintenance of connected computers
  • Most widely automatic integration of computers into the intranet and internet respectively
  • Automatic assignment of the following among other items:
    • IP address & subnetmask
    • (default) gateway
    • DNS server

Design | Structure of DHCP

The design of DHCP supports many of the current network technologies. It it possible to expand its range of functions with interesting configuration parameters for future purposes. The first RFC to mention DHCP was 1531 a more up to date version is described in RFC 2131.

The protocol is based on the client/server model, its flow principally works like this:

  1. If DHCP is enabled on a client, it will broadcast a request to query a DHCP server for i. e. an IP address. In special circumstances this might happen via a relay server as shown in figure 9.2.1.
  2. The server will then respond with the requested configuration.

Figure 9.2.1 DHCP relay

Static allocation

A certain fixed IP address given to the client. The client-MAC address serves as an identifier. This assignment lasts for an indefinite period of time. This allocation method has the disadvantage that IPs that are statically assigned can not be assigned to other clients.

Automatic (static) allocation

When allocating IPs automatically the server is provided an IP-range. This means it holds a pool of IPs that may be assigned to computers. Again MAC addresses are added to identify the clients that are allowed to receive an IP address from the pool. The period of time is indefinite as well and this method has the same disadvantages as described in the last paragraph.

Dynamic allocation

The dynamic allocation works like the automatic allocation instead of listing the MAC-addresses a lease time is defined. This time usually ranges from a few minutes up to weeks. The clients are allowed to keep the IP addresses for the specified time. If the client does not signify the server that it still needs the address, it is then reassigned to other clients after the lease time is up. Normally a server keeps the IP address assigned to the client even if the lease is up just until all addresses in the pool are used up, then IP addresses with expired leases are reallocated. It is typical that clients receive the same address.

Mixed mode

Mixed means in this context e. g. that servers receive their IPs using the static allocation and clients are given IPs dynamically.

Steps

The IP assignment process is divided into these 4 steps that form the so called ‘DORA’ process. The title of the step is equivalent to the type of the packet sent by the client or server:

  1. DHCPDISCOVER - is broadcasted by clients to find available servers on their subnet.
  2. DHCPOFFER - is the servers response with an offer of configuration parameters, this is called a lease offer.
  3. DHCPREQUEST - is a client message to the server that can have different functions:
    1. request for the offered parameters (Lease-Request)
    2. request to check if the IP address in use is valid
    3. request to extend the lease time for current address
  4. DHCPACK - this server message contains the IP address and the other configuration parameters
  • DHCPNAK - is sent from server to client, it informs the client that it uses a wrong IP address (e. g. client changed the subnet) or the lease time is up
  • DHCPDECLINE - the client informs the server that the offered IP address is already in use by another client
  • DHCPRELEASE - the client informs the server that it releases the IP address and that the lease can be freed
  • DHCPINFORM - the client requests the local configuration parameters from the server (this is not the request for an IP address)

SLAAC | v6 Alternative to DHCP

As the name suggests, SLAAC is a mechanism to configure IPv6 addresses on hosts automatically without the need to keep a state at a server. For this purpose, SLAAC uses a three step process.

  1. When a network interface of a host becomes enabled, the host needs to assign itself a link-local IPv6 address. It does so by combining the link-local prefix FE80::0 with a unique identifier corresponding to the network interface. Before the host assigns this address to itself, it needs to check that it is unique. Once the link-local address is assigned to the interface, the host is able to communicate with it’s direct neighbours.

  2. After the link-local address is set up, the host initiates IPv6 Neighbour Discovery and sends a router Solicitation message to a special multicast group that contains all available routers. The routers will then answer with Router Advertisement packets that contain information about the local prefixes.

  3. The host then chooses a unicast address from the local prefix. The address is usually either choosen based on the MAC address of the network interface, or it is generated randomly using the IPv6 privacy extension. Before it configures the interface with this address, it needs to perform Duplicate Address Detection (DAD) to ensure that the address is not in use by another host already.


DHCPv6

In some cases, configuring IPv6 addresses statelessly is not desirable. One example is when hosts should always be assigned the same IPv6 addresses. In this case, an adapted version of DHCP, DHCPv6, can be used. In contrast to IPv4’s DHCP, DHCPv6 is not run automatically as soon as a host is connected to a network, but only after a link-local IPv6 address has been assigned and a Router Advertisment message has been received that indicates that DHCPv6 is used in this network.