The port numbers of the DHCP service are 68 and 67. dhcp is a LAN network protocol. It is usually used in large-scale LAN environments. Its main function is to centrally manage and allocate IP addresses and improve address usage. The DHCP protocol uses UDP as the transmission protocol. The host sends a request message to port 68 of the DHCP server, and the DHCP server responds with a response message to port 67 of the host. These two ports are normal DHCP service ports, which can be understood as one sending and one take over.
The operating environment of this tutorial: Windows 10 system, Dell G3 computer.
The ports for the DHCP service are 68 and 67.
DHCP (Dynamic Host Configuration Protocol) is a network protocol for local area networks. It refers to a range of IP addresses controlled by the server. When the client logs in to the server, it can automatically obtain the IP address and subnet mask assigned by the server. By default, DHCP, as a service component of Windows Server, is not automatically installed by the system and requires administrators to manually install and perform necessary configurations.
DHCP is usually used in large-scale local area network environments. Its main function is to 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 utilization rate of addresses.
The DHCP protocol adopts the client/server model, and the task of dynamic allocation of host addresses is driven by the network host. When the DHCP server receives the information from the network host applying for an address, it will send relevant address configuration and other information to the network host to achieve dynamic configuration of the network host address information.
DHCP protocol supports C/S (client/server) structure, which is mainly divided into two parts:
DHCP client: usually a PC or printer in the network Wait for the terminal device to use the IP information assigned from the DHCP server, including IP address, DNS, etc.
DHCP server: All IP network setting information is centrally managed by the DHCP server and handles DHCP requests from clients.
The DHCP protocol uses UDP as the transmission protocol. The host sends a request message to port 68 of the DHCP server, and the DHCP server responds with a response message to port 67 of the host.These two ports are normal DHCP service ports, which can be understood as one sending and one receiving.
Extended knowledge:
Usually the DHCP server provides at least the following information to the client:
IP address
Subnet mask
Default gateway
Also available Other information, such as the address of the Domain Name Service (DNS) server and the address of the Windows Internet Name Service (WINS) server.
There are three forms of DHCP server assigning IP addresses to clients:
The administrator assigns an IP address to a client.
Randomly assign addresses to clients permanently.
Randomly assign addresses to clients for use for a period of time.
The third is the most common form of use. The effective use period of an address is called the lease period. Before the lease expires, the client must request the server to continue the lease. The server must accept the request before it can continue to be used, otherwise it will be given up unconditionally.
By default, the router isolates broadcast packets and does not send received broadcast packets from one subnet to another. When the DHCP server and client are not in the same subnet, the router acting as the client's default gateway sends broadcast packets to the subnet where the DHCP server is located. This function is called DHCP Relay.
The types of messages involved in DHCP and their functions are as follows:
DHCP DISCOVER: The first message used by the client to start the DHCP process is Broadcast message requesting IP address and other configuration parameters.
DHCP OFFER: The server's response to the DHCP DISCOVER message is a unicast (or broadcast) message containing a valid IP address and configuration.
DHCP REQUEST: The client’s response to the DHCP OFFER message indicates acceptance of the relevant configuration. This message will also be sent when the client renews the IP address lease.
DHCP DECLINE: When the client finds that the IP address assigned by the server cannot be used (such as an IP address conflict), it will send this message to notify the server that the use of the IP address is prohibited.
DHCP ACK: The server’s confirmation response message to the client’s DHCP REQUEST message. After receiving this message, the client actually obtains the IP address and related configuration information.
DHCP NAK: The server rejects the client's DHCP REQUEST message. After receiving this message, the client will restart a new DHCP process.
DHCP RELEASE: The client actively releases the IP address assigned by the server. When the server receives this message, it reclaims the IP address and assigns it to other clients.
DHCP INFORM: After the client obtains the IP address, it sends this message to request other network configuration information of the server, such as DNS, etc.
The IP address leased by the DHCP server to the DHCP client generally has a lease period. After the expiration, the DHCP server will take back the leased IP address. In order to continue to use the original IP address, the DHCP client will send a lease renewal request to the DHCP server.
The workflow of DHCP lease renewal is described as follows:
At the time when 50% of the lease period has passed, the client sends a unicast to the server DHCP REQUEST message renews the lease period.
If a DHCP ACK message from the server is received, the lease period will be extended accordingly and the lease renewal will be successful. If no DHCP ACK message is received, the client continues to use this IP address. At 87.5% of the lease period, a broadcast DHCP REQUEST message is sent to the server to extend the lease period.
If a DHCP ACK message from the server is received, the lease period will be extended accordingly and the lease renewal will be successful. If no DHCP ACK message is received, the client continues to use this IP address. When the lease period expires, the client automatically gives up using this IP address and starts a new DHCP process.
Free learning video sharing:Introduction to Programming
The above is the detailed content of What is the dhcp port number?. For more information, please follow other related articles on the PHP Chinese website!