askvity

Is DHCP use TCP?

Published in DHCP Protocol 2 mins read

No, DHCP does not use TCP.

DHCP (Dynamic Host Configuration Protocol) relies on UDP (User Datagram Protocol) as its transport protocol. Let's delve into why UDP is preferred for DHCP:

Why DHCP Uses UDP Instead of TCP

  • Simplicity and Speed: UDP is connectionless and lightweight, making it faster and more efficient for initial network configuration. DHCP needs to be quick, especially when a device is first booting up and trying to obtain an IP address.

  • Broadcast Communication: DHCP clients often don't have an IP address when they initially try to contact a DHCP server. UDP allows clients to broadcast DHCP discovery messages. This is essential for the client to find a DHCP server on the network. TCP requires a pre-established connection, which is impossible without an IP address.

  • Well-Known Ports: DHCP utilizes specific UDP ports for communication:

    • DHCP Server: Listens on UDP port 67. According to the reference, "DHCP messages that a client sends to a server are sent to well-known port 67 (UDP—Bootstrap Protocol and DHCP)."
    • DHCP Client: Listens on UDP port 68.

UDP vs. TCP: Key Differences

Feature UDP TCP
Connection Connectionless Connection-oriented
Reliability Unreliable Reliable
Overhead Low High
Use Cases DHCP, DNS, streaming media Web browsing, email, file transfer

DHCP Message Exchange

  1. DHCP Discover: The client broadcasts a DHCPDISCOVER message to find available DHCP servers.
  2. DHCP Offer: DHCP servers respond with a DHCPOFFER message, containing a proposed IP address, subnet mask, and other network configuration parameters.
  3. DHCP Request: The client selects one of the offers and sends a DHCPREQUEST message, accepting the proposed configuration.
  4. DHCP Acknowledgment: The DHCP server confirms the allocation with a DHCPACK message. If there's an issue, it might send a DHCPNAK (Negative Acknowledgment) message.

Related Articles