What is DHCP?
Dynamic Host Allocation protocol for dynamic assignment of IP addresses
Why use DHCP?
Reduce workload
Reduce input errors
Avoid IP collisions
Dynamically assigning IP
Increase IP Address utilization
Do not configure IP information repeatedly
How does DHCP work?
Implementation method
When a DHCP client is started, the client will request an IP address in the network, and when the DHCP server receives a request for an IP address, it will select one of the available addresses to provide DHCP clients
Some features of DHCP
DHCP leases
I. Lease generation
1. Client Request Lease
DHCP client broadcasts DHCP discover packets in the network (using UDP port 67, source IP 0.0.0.0 destination IP 255.255.255.255, including client's MAC address, computer name) so that DHCP server receives DHCP Confirm Sender After Discover package
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/54/32/wKioL1R75qKDqJy5AAHvH1KuGbA159.jpg "/>
2. Client response
When DHCP server receives the client request IP address information, it starts looking for an available IP address in its own IP address library, and if so, DHCP server broadcasts a DHCP offer package (using UDP port 68, the source address of the DHCP server IP, Destination IP address 255.255.255.255)
1.DHCP Client's MAC address
Legitimate IP address provided by 2.DHCP server
3. Subnet mask
4. Lease duration
5.DHCP Server IP Address
Windows assignment IP starts from scratch
Linux assignment IP starts at the end
3. Client Selection
The DHCP client selects the IP address from the first DHCP offer package received and sends a DHCP Request packet broadcast (using UDP port 67, source IP 0.0.0.0, destination ip255.255.255.255), indicating that the server using the IP address
4. Server Confirmation
After DHCP server receives the DHCPREQUEST package, the client broadcasts an acknowledgement of success with the DHCPACK package (UDP port is 68, the source IP is the IP of the DHCP server, the destination IP 255.255.255.255), and when the client receives the DHCP ACK, will use the resulting IP address, at this point the entire lease ends!!!
Two. Lease updates
When the client restarts or leases to 50%, the lease is re-updated, then the DHCPREQUEST package is sent directly to the DHCP server that provides the lease, requires the update of the address lease, the DHCP client receives the request, sends the DHCPACK to the client to update the client lease, If communication is not possible, the lease is re-updated at 87.5%, which is to broadcast to all DHCP servers on the network to update the lease, the DHCP server responds to the client request, and the client uses that server address information to update the existing lease. If it still cannot be updated, the client will not be able to use the lease IP
Three. Relay Agent (DHCP across subnets)
1.DHCP Client broadcast DHCP discovery package
The 2.DHCP Relay Agent forwards the DHCPDISCOVER packet to the DHCP server as unicast
3.DHCP server sends Dhcpoffer package to DHCP Relay Agent on a single advertisement
4.DHCP Relay Agent Broadcast DHCPOFFER package
5.DHCP Client Broadcast DHCPRequest package
The 6.DHCP Relay Agent sends DHCPACK packets to the DHCP Relay agent in a single advertisement
7.DHCP server sends DHCPAck packages to DHCP relay agents on a single advertisement
8.DHCP Relay Agent Broadcast DHCPACK package
Basic concepts of DHCP