How DHCP Works

Listen to this Post

Featured Image
📲 IP Connected Devices request access to the network to get an IP address.

🖥️ DHCP Server (📡 IPv4 / IPv6) handles automatic IP assignment.

🪜 DHCP Process Steps:

Step 1: DHCP Discover

  • Devices broadcast a DHCP Discover message (0.0.0.0255.255.255.255).
  • Command to capture DHCP packets (Linux):
    sudo tcpdump -i eth0 port 67 or port 68 -v
    
  • Windows equivalent:
    netsh trace start capture=yes Ethernet tracefile=C:\dhcp_trace.etl
    

Step 2: DHCP Offer

  • The DHCP server responds with an available IP (DHCP Offer).
  • Check DHCP leases (Linux):
    cat /var/lib/dhcp/dhclient.leases
    
  • Windows DHCP Server leases:
    Get-DhcpServerv4Lease -ComputerName "DHCPServer" -ScopeId 192.168.1.0
    

Step 3: DHCP Request & Acknowledgment

  • Client requests the offered IP (DHCP Request).
  • Server confirms with DHCP ACK, assigning:
  • 🔢 IP Address
  • 🌐 Default Gateway
  • 🧩 Subnet Mask
  • 🧭 DNS Server

  • Linux: Manually release/renew DHCP lease

    sudo dhclient -r eth0  Release 
    sudo dhclient eth0  Renew 
    

  • Windows:
    ipconfig /release 
    ipconfig /renew 
    

🚀 You Should Know:

  • DHCP Relay Agents forward requests across subnets.
    Configure DHCP relay (Linux) 
    sudo apt install isc-dhcp-relay 
    sudo systemctl enable isc-dhcp-relay 
    
  • Security Risks:
  • DHCP Spoofing: Attackers deploy rogue DHCP servers.
  • Mitigation: Enable DHCP Snooping on switches.
    Cisco DHCP Snooping 
    enable 
    configure terminal 
    ip dhcp snooping 
    ip dhcp snooping vlan 10 
    
  • High Availability: Use DHCP Failover (Windows Server):
    Add-DhcpServerv4Failover -Name "DHCP-Failover" -ScopeId 192.168.1.0 -PartnerServer "BackupDHCPServer" 
    

What Undercode Say:

DHCP is foundational for scalable networks, but misconfigurations lead to IP conflicts, outages, or breaches. Always:
– 🔐 Secure DHCP with MAC filtering (/etc/dhcp/dhcpd.conf).
– 📊 Monitor lease logs (/var/log/syslog).
– 🛡️ Deploy DHCP in a DMZ for public IP assignments.
– 🔄 Test redundancy with kill -9 <dhcpd_PID>.

Expected Output:

DHCPACK on 192.168.1.100 to aa:bb:cc:dd:ee:ff via eth0 
Lease time: 86400 seconds 
DNS: 8.8.8.8, Gateway: 192.168.1.1 

Prediction:

As IPv6 adoption grows, DHCPv6 will integrate with Zero Trust frameworks, requiring AI-driven IP allocation for IoT-heavy networks.

🔗 Further Reading:

IT/Security Reporter URL:

Reported By: Chiraggoswami23 Dhcp – Hackers Feeds
Extra Hub: Undercode MoN
Basic Verification: Pass ✅

Join Our Cyber World:

💬 Whatsapp | 💬 Telegram