Professional Documents
Culture Documents
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
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.
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
Network 1
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
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
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