0xnhl

DHCP

/ Update
2 min read

The Dynamic Host Configuration Protocol (DHCP) is a network management protocol used on Internet Protocol (IP) networks for automatically assigning IP addresses and other communication parameters to devices connected to the network using a client–server architecture.

  •  DHCP is an application-level protocol that relies on UDP; the server listens on UDP port 67, and the client sends from UDP port 68.
  • Your smartphone and laptop are configured to use DHCP by default.

How it Works#

DHCP follows four steps: Discover, Offer, Request, and Acknowledge (DORA):

  1. DHCP Discover: The client broadcasts a DHCPDISCOVER message seeking the local DHCP server if one exists.
  2. DHCP Offer: The server responds with a DHCPOFFER message with an IP address available for the client to accept.
  3. DHCP Request: The client responds with a DHCPREQUEST message to indicate that it has accepted the offered IP.
  4. DHCP Acknowledge: The server responds with a DHCPACK message to confirm that the offered IP address is now assigned to this client.

The following packet capture shows the four steps explained above. In this example, the client gets the address 192.168.66.133.

user@Linux$ tshark -r DHCP-G5000.pcap -n
    1   0.000000      0.0.0.0 255.255.255.255 DHCP 342 DHCP Discover - Transaction ID 0xfb92d53f
    2   0.013904 192.168.66.1 192.168.66.133 DHCP 376 DHCP Offer    - Transaction ID 0xfb92d53f
    3   4.115318      0.0.0.0 255.255.255.255 DHCP 342 DHCP Request  - Transaction ID 0xfb92d53f
    4   4.228117 192.168.66.1 192.168.66.133 DHCP 376 DHCP ACK      - Transaction ID 0xfb92d53f
shell

In the DHCP packet exchange, we can notice the following:

  • The client starts without any IP network configuration. It only has a MAC address. In the first and third packets, DHCP Discover and DHCP Request, the client searching for a DHCP server still has no IP network configuration and has not yet used the DHCP server’s offered IP address. Therefore, it sends packets from the IP address 0.0.0.0 to the broadcast IP address 255.255.255.255.
  • As for the link layer, in the first and third packets, the client sends to the broadcast MAC address, ff:ff:ff:ff:ff:ff (not shown in the output above). The DHCP server offers an available IP address along with the network configuration in the DHCP offer. It uses the client’s destination MAC address. (It used the proposed IP address in this example system.)

At the end of the DHCP process, our device would have received all the configuration needed to access the network or even the Internet. In particular, we expect that the DHCP server has provided us with the following:

  • The leased IP address to access network resources
  • The gateway to route our packets outside the local network
  • A DNS server to resolve domain names.
DHCP
https://nahil.xyz/vault/networking/network-protocols/dhcp/
Author Nahil Rasheed
Published at May 23, 2026
Disclaimer This content is provided strictly for educational purposes only.