DHCP (Dynamic Host Configuration Protocol) is a protocol used by DHCP servers in wired/wireless IP networks to dynamically allocate a variety of network configuration data, such as a user IP address, subnet mask, default gateway IP address, DNS server IP address, lease time and so on, to client devices (DHCP clients).

UDP (67,68)

DORA(discover,offer,request,ack)

**

  1. DHCP Discover**

When a client (PC) is booted, it broadcasts a DHCP Discover message over the Ethernet network to locate all available DHCP servers on the same subnet network (by setting the destination MAC address in the Ethernet header as Broadcast MAC=FF:FF:FF:FF:FF:FF), reaching all the DHCP servers on the same subnet network.

2. DHCP Offer

When a DHCP server receives the DHCP Discover message from the client, it also broadcasts a DHCP Offer message over the Ethernet network , informing the client that it is available. This message contains the network information, such as client IP address, subnet mask, default gateway IP address, DNS IP address, IP lease time and DHCP server IP address. The DHCP Offer message broadcasted is delivered to all the clients on the same subnet network, including the one that sent the DHCP Discover message.

3. DHCP Request

The client, having received the DHCP Offer message, recognizes there is a DHCP server available on the same subnet. Then it broadcasts a DHCP Request message to the server over the Ethernet network, requesting network configuration data including an IP address for itself. If more than one DHCP server responds on the same subnet and hence the client receives multiple DHCP Offer messages, it selects one of the DHCP servers, and enters the IP address of the selected DHCP server in the DHCP Server Identifier (option 54) field of the DHCP Request message. Then it informs all the DHCP servers on the subnet network about such selection by broadcasting the DHCP Request message. Typically, all DHCP servers internally store the network configuration data (i.e. IP address for the client and other information) when they send a DHCP Offer message. So, the client broadcasts the DHCP Request message to all the DHCP servers, so that those not selected can also receive the message and delete the stored network configuration data from their memory.

4. DHCP Ack

The DHCP server which received the DHCP Request message from the client checks if the IP address shown in the DHCP Server Identifier (option 54) field matches its own. If it does, it broadcasts a DHCP Ack message ensuring the client can receive the message (Note: the client has NOT been allocated an IP address yet).

At this time, the DHCP server transfers all the network configuration data including the client IP address – the same data sent along with the DHCP Offer message - to the client. Then the client configures a network interface using the transferred data, finally connecting to the Internet. The typical network configuration data includes:

  • IP address
  • Subnet mask
  • Default gateway IP address
  • DNS server IP address
  • Lease time (during which a client can use the IP address allocated/leased by a DHCP server)

Format of DHCP Messages in IP Address Allocation/Lease ProcedureEthernet Header

  • Destination MAC Address : As the client is NOT aware of the MAC address of a DHCP server, it floods a DHCP Discover message on the Ethernet network using a broadcast MAC address (0xFFFFFFFFFFFF).
  • Source MAC Address : The source MAC address on the Ethernet is always the address of a packet sender. Thus, this field is the MAC address of the client (m1).
  • EtherType : Indicates that the header is followed by an IP packet (IP=0x0800, ARP=0x0806, etc).

IP Header

  • Protocol ID: Indicates that the header is followed by a UDP packet (UDP=17, TCP=6, etc).
  • Source IP Address: Is set to 0.0.0.0 because no IP address is allocated to the client.
  • Destination IP Address: The client is NOT aware of the IP address of a DHCP server so it floods a DHCP Discover message over the IP network using a broadcast IP address (255.255.255.255).

UDP Header

  • Source Port: Indicates that the DHCP message sender is the DHCP client (68=BOOTP Client), so the client always sends the message with “Source Port=68”.
  • Destination Port: Indicates that the DHCP message receiver is the DHCP server (67=BOOTP Server), so the server always sends the message with “Destination Port=67”.

DHCP Message Payload

  • Client MAC Address (chaddr): The MAC address of the client (m1).
  • DHCP Message Type (option 53): Indicates that the DHCP message type is “DHCP Discover” (Value=1).
  • Client Identifier (option 51): Serves as an indicator to distinguish clients, and generally contains the MAC address of the client (m1). The DHCP server distinguishes one client from another based on the values in this field.
  • Parameter Request List (option 55): Contains the network information list (DHCP option List) that the client needs to obtain from the DHCP Server. For example, it requests subnet mask, default GW IP address, DNS IP address and so on.

DHCP Offer MessageEthernet Header

  • Destination MAC Address: The DHCP server broadcasts a DHCP Offer message over the Ethernet network.
  • Source MAC Address: The source MAC address on the Ethernet is always the address of a packet sender. Thus, this field is the MAC address of the client (m2).

IP Header

  • Source IP Address: The IP address of a DHCP server (1.1.1.254)
  • Destination IP Address: As the client is NOT aware of the IP address of the DHCP server, it floods a DHCP Discover message over the IP network using a broadcast IP address (255.255.255.255).

UDP Header

  • Source Port: Indicates that the DHCP message sender is the DHCP server, so the server always sends the message with “Source Port=67”.
  • Destination Port: Indicates that the DHCP message receiver is the DHCP client, so the client always sends the message with “Destination Port=68”.

DHCP Message Payload

  • Your IP Address (yiaddr): The IP address to be used by the client (1.1.1.10).
  • Client MAC Address (chaddr): The MAC address of the client (m1).
  • DHCP Message Type (option 53): Indicates that the DHCP message type is “DHCP Offer” (Value=2).
  • Subnet Mask (option 1): The subnet mask to be used by the client (255.255.255.0 (/24)).
  • Router IP (option 3): The IP address (1.1.1.1) of the default gateway (the first router or L3 switch seen by the client to get to the Internet).
  • Domain Name Server IP (option 6): The IP address of the DNS server to be used by the client. Normally, it provides two IP addresses, primary DNS IP address (10.1.1.1) and secondary DNS IP address (10.1.1.2), together.
  • IP Address Lease Time (option 51): The lease time during which the client is allowed to use the IP address allocated by DHCP server (3,600 sec. (1 hour)). At the mid-point of the lease time (30 minutes), the client begins its IP address renewal procedure.
  • DHCP Server Identifier (option 54): The IP address of the DHCP server that sent the DHCP Offer message (1.1.1.254). In case multiple DHCP servers on the same subnet send DHCP Offer messages to the client, the client distinguishes servers based on the values in this field.

DHCP Request MessageEthernet Header

  • Destination MAC Address: As the client is NOT aware of the MAC address of a DHCP server, it floods a DHCP Request message over the Ethernet network using a broadcast MAC address (0xFFFFFFFFFFFF) in order to inform all the DHCP servers of which DHCP server is selected by the client.
  • Source MAC Address: The source MAC address on the Ethernet is always the address of a packet sender. Thus, this field is the MAC address of the client (m1).

IP Header

  • Source IP Address: Is set to 0.0.0.0 because no IP address is allocated to the client.
  • Destination IP Address: It floods a DHCP Request message over the IP network using a broadcast IP address (255.255.255.255) in order to deliver the DHCP Request message to all the DHCP servers on the same subnet.

UDP Header

  • Source Port: Indicates that the DHCP message sender is the DHCP client (68=BOOTP Client).
  • Destination Port: Indicates that the DHCP message receiver is the DHCP server (67=BOOTP Server).

DHCP Message Payload

  • Client MAC Address (chaddr): The MAC address of the client (m1).
  • DHCP Message Type (option 53): Indicates that the DHCP message type is “DHCP Request” (Value=3).
  • Client Identifier (option 51): Serves as an indicator to distinguish clients, and generally contains the MAC address of the client (m1). The DHCP server distinguishes one client from another based on the values in this field.
  • Requested IP Address (option 50): The IP address (yiaddr=1.1.1.10) received through the DHCP Offer message from the DHCP server. This is intended to re-send the IP address to the DHCP server in order to verify if the IP address is valid (In normal operation, the DHCP server allocates the IP address to the client through the DHCP Ack message).
  • Parameter Request List (option 55): Contains the network information list (DHCP option List) that the client needs to obtain from the DHCP Server. For example, it requests subnet mask, default GW IP address, DNS IP address and so on.

DHCP Ack Message
Ethernet Header

  • Destination MAC Address: The DHCP server broadcasts a DHCP Ack message over the Ethernet network to reach the client.
  • Source MAC Address: The source MAC address on the Ethernet is always the address of a packet sender. Thus, this field is the MAC address of the DHCP server (m2).

IP Header

  • Source IP Address: The IP address of DHCP server (1.1.1.254).
  • Destination IP Address: As the client is NOT aware of the IP address of the DHCP server, it floods a DHCP Discover message over the IP network using a broadcast IP address (255.255.255.255).

UDP Header

  • Source Port: Indicates that the DHCP message sender is the DHCP server, so the server always sends the message with “Source Port=67”.
  • Destination Port: Indicates that the DHCP message receiver is the DHCP client, so the client always sends the message with “Destination Port=68”.

DHCP Message Payload

  • Your IP Address (yiaddr): The IP address to be used by the client (1.1.1.10).
  • Client MAC Address (chaddr): The MAC address of the client (m1).
  • DHCP Message Type (option 53): Indicates that the DHCP message type is “DHCP Ack” (Value=5).
  • Subnet Mask (option 1): The subnet mask to be used by the client (255.255.255.0 (/24)).
  • Router IP (option 3): The IP address (1.1.1.1) of the default gateway (the first router or L3 switch seen by the client to get to the Internet).
  • Domain Name Server IP (option 6): The IP address of DNS server to be used by the client. Normally, it provides two IP addresses, primary DNS IP address (10.1.1.1) and secondary DNS IP address (10.1.1.2), together.
  • IP Address Lease Time (option 51): The lease time during which the client is allowed to use the IP address allocated by DHCP server (3,600 sec. (=1 hour)). At the mid-point of the lease time (30 minutes), the client begins its IP address renewal procedure.
  • DHCP Server Identifier (option 54): The IP address of the DHCP server that sent the DHCP Offer message (1.1.1.254). In case that multiple DHCP servers on the same subnet send DHCP Offer messages to the client, the client distinguishes servers based on the values in this field.

IP Address Renewal Procedure

A DHCP Ack message is the last message sent in the “IP address allocation/lease” procedure. It contains the IP Lease Time (option 51) parameter, and a client can use an allocated IP address (e.g. 1.1.1.10 in Figure 3) only for the time period (lease duration) specified in the option parameter. Thus, to use the IP address beyond the lease duration, the client has to request approval from the DHCP server to renew the IP address as shown in Figure 3.1. DHCP Request

In Figure 3, the lease time is given as 1 hour. When half of it has passed (i.e. 1,800 seconds/30 minutes in Figure 3), the client sends a DHCP Request message to the DHCP server to renew its lease time (Note: In case of IP renewal, no DHCP Discover/Offer process is required). Unlike in the IP address allocation/lease procedure, the client does not broadcast the DHCP Request message , but unicasts it (Destination MAC=DHCP Server MAC (m2), Destination IP=DHCP Server IP (1.1.1.254)). That is because the DHCP server and client have already known each other’s IP address. The DHCP Request message for IP address renewal should include the IP address of the client requesting the renewal in the “Client IP Address (ciaddr)” field, but should exclude Requested IP Address (option 50) and DHCP Sever Identifier (option 54) fields.

2. DHCP Ack

Upon accepting the DHCP Request message (for IP address renewal) received from the client, the DHCP server also unicasts, and does not broadcast, a DHCP Ack message (Destination MAC=PC MAC (m1), Destination IP=PC IP (1.1.1.10)), including network configuration data such as the client IP address, subnet mask, default gateway IP address, DNS IP address and lease time, to the client. Once this process is completed, the client can keep its current IP address for the extended lease time as specified in the DHCP Ack message.

IP Address Release Procedure

When a client is shut down gracefully,or ‘ipconfig/release’ command is entered in the DOS command window of Windows, the client unicasts a DHCP Request message to the DHCP server in order to return its allocated IP address, as seen in Figure 4. Then it releases the network configuration data (i.e. client IP address, subnet mask, default gateway IP address, DNS IP address, etc.), consequently having no access to the Internet any more.1. DHCP Release

If the client does not need its allocated IP address any longer, it unicasts a DHCP Release message to the DHCP server. The server then releases the client IP address (1.1.1.10) listed in the Client IP field of the received message.

  • IP address allocation/lease

    Once a DHCP client is booted up, it broadcasts a DHCP Discover message, and in respond to the message, a DHCP server broadcasts a DHCP Offer message. In case there is more than one DHCP server on the subnet, the client selects one of the servers, and broadcasts a DHCP Request message with the information of the selected server entered in the DHCP Server Identifier (option 54) field. Finally, the client receives network configuration data such as client IP address, subnet mask, default gateway IP address, DNS IP address, IP lease time from the server, and configures its network interfaces using the data.

  • IP address renewal

When half of the lease time set through “IP address allocation/lease” procedure has passed, it unicasts a DHCP Request message to the DHCP server for renewal of its IP address. The DHCP server, upon receiving the DHCP Request message, accepts the request by responding with a unicast DHCP Ack message.

  • IP address release

    Once the client is logged-off, it returns the allocated IP address to the DHCP server by unicasting a DHCP Release message to the DHCP server.

results matching ""

    No results matching ""