Skip to content

KINGSANIT CYBERPEDIA

Menu
  • Cyber Security
    • Cyber Security Fundamentals
      • Security Principles
      • Information Security
    • Hacking
      • Reconnaissance
        • Footprinting
        • Scanning
        • Enumeration
        • Vulnerability Analysis
      • Privilege Escalation
      • Ethical Hacking
    • Governance, Risk And Compliance (GRC)
      • Risk Management
    • Security Architecture And Engineering
      • Cryptography
      • Identity Access Management
    • Security Operations
      • Security Assessment
        • Vulnerability Management
          • Threat Intelligence
      • Intrusion Detection And Prevention
    • Cyber Security Attacks and Threats
      • DoS
      • Password Hacking
      • Web Attacks
      • Web Applications Attacks
      • WI-FI Wireless Attacks
      • Bluetooth Attacks
  • Computer Networks And Internet
    • LAN Switching
    • Networking Protocols
    • Internet
  • Information Technology
    • Database
    • Web
  • Computer Architecture And Organization
  • Operating Systems
    • Programming
Menu

Dynamic Host Control Protocol (DHCP)

Posted on by

Dynamic Host Control Protocol (DHCP) is a network management protocol that is used in IP network to assign IP addressed to nodes connected to the network automatically. DHCP is described in RFC 2131.

In 1980s, there was Diskless Workstations which did not have disk with basic memory that used network booting. Since it has very low memory, it had to get IP addressed dynamically. Reverse Address Resolution Protocol (RARP) a Network Protocol operating at OSI Layer 2 based on Address Resolution Protocol (ARP) was used to dynamically assign IP address to these Diskless Workstations. But RARP had major limitations that it lacked support for sending additional network configuration data apart from IP address and since it was operating at layer, it couldn’t operate across subnets.

To address the limitation of RARP, Bootstrap Protocol (BOOTP) was developed by researchers which assigned IP address and other network configurations like DNS, Default Gateway and Domain Name.

BOOTP was replaced by DHCP. Both uses the same port number (UDP 67 for request & UDP 68 for response). Following are major differences between DHCP and BOOTP

BOOTPDHCP
Supports limited number of client configurable options.Supports multiple client configurable parameters using the OPTIONS parameter.
Doesn’t support IP renew option.Supports IP address renew options.
Should be pre-configured for each client.Pre-configuration of client is not necessary.
The IP address leased to clients doesn’t expire.The IP addresses leased to client expires and are renewed.

DHCP Header

FieldLength (Bytes)Description
op1Message type set by client or DHCP Server)
1 – Boot Request (By client)
2 – Boot Reply (By Server)
htype1Hardware address type. Mostly, it’s 1 which is for Ethernet.
hlen1The length of the hardware address. It’s 6 bytes for Ethernet as MAC address is 48 bits in length.
hops1Set to zero by clients. If the DHCP packet passes through Relay Agent each time, this increased by 1. Every Relay agent between Client and DHCP server is considered a hop count.
xid4A transaction ID which is randomly selected by client and used for association between client and DHCP Server by using the same ID for all messages between them.
secs2Filled by client. It’s the seconds elapsed since the client obtained or renewed an IP Address.
flags2Only the left most bit is used and other 15 bits are set to 0. The client sets the bit
0 – DHCP Server to reply as unicast
1 – DHCP Server to reply as broadcast
ciaddr4The client IP address and is filled only, if the client is in Bound, RENEW and REBINDING state and can respond to ARP request.
yiaddr4The IP address assigned to the client by the DHCP Server
siaddr4The IP address of the server to be used returned in DHCPOFFER or DHCPACK from the server.
giaddr4The IP address of the relay device.
chaddr16The client hardware address which is the mostly MAC address.
sname64The server hostname which is optional.
file128The boot file name.
optionsVariableThese are other network configuration sent by the DHCP server like domain name, default gateway. Please refer RFC 2132 DHCP Options.

DHCP Messages

DHCPDISCOVER – The DHCP clients broadcasts a DHCPDISCOVER message to discover DHCP servers in the network.

DHCPOFFER – The DHCP server responds with DHCPOFFER message having the IP address in the “yiaddr”.

DHCPREQUEST – The client sends a DHCPREQUEST following the DHCPOFFER.

DHCPACK – The DHCP Server replies to the DHCPREQUEST sent by the client confirming the IP address request with other parameters.

DHCPNAK – The DHCP Server sends DHCPNAK when it rejects the DHCPREQUEST sent by the client.

DHCPRELEASE – The client sends a DHCPRELEASE when it wants to release the binded IP address.

DHCPINFORM – The client sends a DHCPINFORM asking for local configuration parameters when it has IP configured already externally.

DHCP Client State Diagram

Reference

RFC – 2131

RFC – 2132

Recent Posts

  • Cloud Attacks
  • Serverless Computing
  • Virtualization
  • Hypervisor
  • Containers
© 2026 KINGSANIT CYBERPEDIA | Powered by Minimalist Blog WordPress Theme