DHCP Protocol Interactive Learning Tool

Master Dynamic Host Configuration Protocol through hands-on exploration

What is DHCP?

Dynamic Host Configuration Protocol (DHCP) is a network management protocol used to automatically assign IP addresses and other network configuration parameters to devices on a network. This eliminates the need for manual configuration and prevents IP address conflicts.

Why is DHCP Important?

The DHCP Process (DORA)

1. DISCOVER

Client broadcasts a DHCP Discover message to find available DHCP servers on the network.

2. OFFER

DHCP server responds with a DHCP Offer message containing an available IP address and configuration parameters.

3. REQUEST

Client sends a DHCP Request message to accept the offered configuration.

4. ACKNOWLEDGE

Server confirms the assignment with a DHCP Acknowledge message, completing the process.

Key DHCP Components

DHCP Server: Manages IP address pools and configuration parameters

DHCP Client: Requests and uses assigned network configuration

DHCP Relay Agent: Forwards DHCP messages between clients and servers across different subnets

IP Address Pool: Range of available IP addresses for assignment

Lease Time: Duration for which an IP address is assigned to a client

DHCP Process Simulation

Watch the step-by-step DHCP process as a client obtains an IP address from a server.

DHCP Client
No IP Address
Ready to start
DHCP Server
192.168.1.1

Ready to Begin

Click "Start DHCP Process" to begin the simulation. You'll see each step of the DHCP process in action.

DHCP Packet Structure

Understanding the DHCP packet headers is crucial for network administrators and developers. DHCP messages are sent over UDP, typically using ports 67 (server) and 68 (client).

DHCP Message Header (240 bytes minimum)
Message Type (op)
1 byte
1 = BOOTREQUEST (client to server), 2 = BOOTREPLY (server to client)
Hardware Type (htype)
1 byte
Hardware address type (1 = Ethernet)
Hardware Length (hlen)
1 byte
Length of hardware address (6 for Ethernet MAC)
Hops
1 byte
Number of relay agents the message has passed through
Transaction ID (xid)
4 bytes
Random number chosen by client to match requests and replies
Seconds (secs)
2 bytes
Seconds since client began address acquisition process
Flags
2 bytes
Bit flags (broadcast flag indicates if client can receive unicast)
Client IP (ciaddr)
4 bytes
Client's current IP address (if client is bound to IP)
Your IP (yiaddr)
4 bytes
IP address being offered/assigned to client
Server IP (siaddr)
4 bytes
IP address of next server in bootstrap process
Relay Agent IP (giaddr)
4 bytes
IP address of relay agent (if used)
Client Hardware Address
16 bytes
Client's hardware address (MAC address)
Server Name
64 bytes
Optional server host name (null-terminated string)
Boot File Name
128 bytes
Boot file name for network booting
Options
Variable
DHCP options field containing additional configuration parameters

Important DHCP Options

Common DHCP Options
Option 53
1 byte
DHCP Message Type (1=Discover, 2=Offer, 3=Request, 5=Ack, 6=Nak)
Option 1
4 bytes
Subnet Mask
Option 3
Variable
Router/Default Gateway
Option 6
Variable
DNS Servers
Option 51
4 bytes
IP Address Lease Time
Option 54
4 bytes
DHCP Server Identifier

Test Your DHCP Knowledge

Answer these questions to check your understanding of the DHCP protocol.

1. What does DHCP stand for?
Dynamic Host Control Protocol
Dynamic Host Configuration Protocol
Direct Host Configuration Protocol
Dynamic Hardware Configuration Protocol
2. What are the four steps of the DHCP process in order?
Offer, Discover, Request, Acknowledge
Discover, Offer, Request, Acknowledge
Request, Discover, Offer, Acknowledge
Discover, Request, Offer, Acknowledge
3. Which UDP ports does DHCP typically use?
80 and 443
67 and 68
53 and 54
21 and 22
4. What is the purpose of the Transaction ID (xid) field?
To identify the client's MAC address
To match DHCP requests with their corresponding replies
To specify the lease time
To indicate the server's IP address