You are on page 1of 13

DHCP Protocol Principle

Foreword

Manually configuring IP addresses, masks, gateways and other parameters for a big number of hosts
in a LAN is tedious and error-prone.

DHCP (Dynamic Host Configuration Protocol) can centrally manage and allocate IP addresses so that
hosts in the network environment can dynamically obtain IP addresses, Gateway addresses, DNS
server addresses, and other information, and can improve the use of addresses while avoiding the
problem of IP address conflicts.
Usage Scenarios

Laptops, desktop computers, cell phones, smart appliances and other devices are closely related to
our lives. But the basis of all these connections to the Internet is the IP address.

How to obtain IP address efficiently and securely with no perceived user experience?
Static IP Address Allocation

Even if all users know exactly how to


manually configure the IP.

The network center maintenance Users are likely to have IP address


staff still needs to develop an IP conflicts due to misconfiguration
allocation table to specify which settings to the same IP address.
user uses which IP address.

Is there a way to:


1. Reduce the difficulty for users to configure IP addresses
2. Reduce the workload of network center maintenance staff
3. Avoid IP address conflicts due to misconfiguration
DHCP Overview

DHCP, Dynamic Host Configuration Protocol.

Defined in RFC2131, C/S architecture, the server is responsible for centralized management, the
client submits a configuration request to the server, the server returns the corresponding configuration
information according to the policy.

DHCP messages are encapsulated with UDP. The port number the server is listening on is 67, and the
port number for the client is 68.

PC: What is my IP Address?


DHCP Protocol: I'll ask for you!
DHCP System Components

DHCP client
o A host that needs to obtain an IP address dynamically.

DHCP server
o A DHCP-capable server or network device to assign IP addresses to clients and manages these IP addresses.

DHCP relay
o When a DHCP client and a DHCP server are not in a same subnet, they need a DHCP relay to forward DHCP request and reply
packets. Generally, it is a network device such as a router or a Layer 3 switch.

Network 1 Network 2

DHCP Client DHCP Relay DHCP Server


DHCP Process

Network 1

DHCP Client DHCP Server

DHCP-DISCOVER Can someone allocate me an IP address?


(Broadcast)
I can allocate IP address 192.168.1.2/24 to you
DHCP-OFFER
(Broadcast/Unicast)

DHCP-REQUEST Okay, I'll use the 192.168.1.2/24 you allocated


(Broadcast)

Okay, I acknowledge!
DHCP-ACK
(Broadcast/Unicast)
DHCP Discover

This message is the first request message sent by the PC, it is a broadcast message, the main
purpose is to discover the DHCP server, but the PC does not know the IP address of DHCP, so the
destination MAC and destination IP address are broadcasts.
DHCP Offer

This message is the first message returned by the DHCP server, when there are multiple DHCP
servers in the network, the PC will only keep the DHCP Offer received first. DHCP Offer contains the
IP address, gateway IP, DNS parameters and other configuration information that the DHCP server
can allocate to the PC.
DHCP Request

The second request message from the PC, the PC initiates a formal request based on the information
in the Offer returned by the server.
DHCP ACK

After the server receives the request message from the PC, it allocates the corresponding IP address from the
address pool and returns it to the PC.
IP Address Rejection and Release

Network 1

DHCP Client DHCP Server

The 192.168.1.2/24 you provided is already being used and I refuse to use it!
DHCP-Decline

I don't want to use the address you allocated, please give it to someone else
DHCP-Release
DHCP Lease Renewal

Network 1

DHCP Client DHCP Server

I would like to continue using the IP address you allocated, is that OK? DHCP-REQUEST
Upon 50% time of
the lease term
Ok, you can continue to use it
DHCP-ACK

Upon 87.5% time I would like to continue using the IP address you allocated, is that OK? DHCP-REQUEST
of the lease term

Ok, you can continue to use it DHCP-ACK

No, you can not continue to use it DHCP-NAK

You might also like