Currently, the IP address assignment of routers mainly includes DHCP and BOOTP, which are also the Dynamic Host Allocation Protocol. Its predecessor is BOOTP. BOOTP was originally used on a network without a disk host connection, the following describes the differences between the two methods.
I. DHCP can be said to be an enhanced version of BOOTP. It is divided into two parts: one is the server side and the other is the client side. All IP Address Settings are centrally managed by the DHCP server and are responsible for handling the DHCP requirements of the client;
The client uses the IP environment data allocated from the server. Compared with BOOTP, DHCP uses the "lease" concept to effectively and dynamically allocate TCP/IP settings of the Client. In addition, DHCP takes full care of BOOTP Client requirements as compatibility considerations.
2. At least one DHCP server must work on the network. It will listen to DHCP requests from the network and intercept the TCP/IP setting environment with the client. It provides two IP address locating methods:
1. Automatic Allocation: Once the DHCP Client is successfully rented from the DHCP server to an IP address for the first time, it will always be used.
2. Dynamic Allocation. After DHCP is rented from the HDCP server for the first time to an IP address, it is not permanently used. As long as the lease term expires, the client must release the (release) ip address, for other workstations. Of course, the client can give priority to the update lease or lease other IP addresses than other hosts.
3. In addition to dynamically setting IP addresses, DHCP can also retain some IP addresses for use by machines with special purposes. It can assign fixed IP addresses based on hardware addresses, this gives you a larger design space.
In addition, DHCP can also help clients specify projects such as router, netmask, DNS Server, and WINS Server, there is almost no need to set any IP environment.
4. Find the Server. When the DHCP client logs on to the network for the first time, that is, when the client finds that there is no IP address data set on the local machine, it sends a dhcp discover packet to the network.
Because the client does not know which network it belongs to, the source address of the packet will be 0.0.0.0, And the destination address will be 255.255.255.255, and then the DHCP discover information will be attached to broadcast to the network.
5. IP address leasing is provided. When the DHCP server listens to the DHCP discover broadcast sent by the client, it selects the first vacant IP address from the address range that has not been rented out, along with other TCP/IP Settings, a dhcp offer packet is returned to the client. Because the client does not have an IP address at the beginning, its DHCP discover packet carries its MAC address information.
6. Accept the IP lease. If the client receives a response from Multiple DHCP servers on the network, it selects only one DHCP offer and sends a DHCP request broadcast packet to the network, tell all DHCP servers to specify the IP address provided by the server to be accepted. The client also sends an ARP packet to the router to check whether other machines on the network use the IP address;
If the IP address is occupied, the client sends a DHCPDECLINE packet to the DHCP server, rejects the DHCP offer, and resends the DHCP discover information.
7. When the DHCP server receives the DHCP request from the client, it will send a DHCPACK response to the client to confirm that the IP lease takes effect. This completes the DHCP process, once the DHCP Client successfully obtains the DHCP lease from the server, no DHCP discover information is required unless the lease has expired and the IP address is reset to 0.0.0.0, instead, the IP address that has been rented will be used directly to send a DHCP request information to the previous DHCP server. The DHCP server will try its best to allow the client to use the original IP address. If there is no problem, directly Respond To DHCPack to confirm.
From the process described above, it is not difficult to find that DHCDISCOVER is broadcast, and the situation can only be carried out within the same network, because the router will not transmit the broadcast. But what if the DHCP server is deployed on another network?
The DHCP client has no IP environment settings, so it does not know the Router address, and some routers do not transmit DHCP broadcast packets, therefore, in this case, dhcp discover will never be able to reach the DHCP server, and of course no OFFER or other actions will occur.