The client obtains the IP address through DHCP.

Source: Internet
Author: User

The client sets the DHCP server through DHCP: the server name is win2k3, the IP address is 192.168.1.1, the client host name is winxp2, and Scope: 192.168.1.1-192.168.1.10. Part 1: 1. the client sends a DHCP Discover packet. The client sends a DHCP Discover packet using UDP port 68 broadcast, and specifies that the host that opened UDP port 67 can accept this packet. In this case, the Client IP Address is 0.0.0.0. The information in the packet includes the DHCP packet type, the IP address allocated last time, or the address allocated by APIPA, and indicates whether the IP address can be used. This information is included in the Bootstrap Protocol (BOOTP) Protocol. This is also the original DHCP protocol. The DHCP Discover packet is also triggered when the machine is started or the request is rejected. 2. The server responds to the DHCP Offer packet. After the DHCP server responds to the client's DHCP Discover request, it checks its configuration. If there is a redundant and valid address, it returns a broadcast message of DHCP Offer. Because the server does not know where the client is. In addition to the IP address and mask, the packet also has the lease time limit corresponding to this address. Of course, the assigned IP address may be used by other hosts and may cause IP conflict. 3. After receiving the IP address, the client sends a DHCP Request packet to the DHCP server. DCHP Request indicates all DHCP servers, including the IP address assigned to the DHCP server. The purpose is to let everyone know that XP2 has accepted an IP address assigned by a DHCP server and advertised the IP address. Because there may be more than one DHCP server in the network, and the first packet sent by XP2 is for all, XP2 does not know who will assign an IP address to it, at the same time, other DHCP servers will check their respective configurations after receiving the query request, and then allocate IP addresses. The key is that XP2 receives the Offer first. When other DHCP servers receive the Request packet, they will take back the sent address for other purposes. The client must receive a confirmation message from the DHCP server assigned to the IP address, which is 192.168.1.1. 4. DHCP receives a Request and reports a dhcp ack packet to respond to the client. The DHCP server uses the ACK packet as a confirmation to respond to the client's Request packet. The Option in the packet also contains the lease IP address, mask, term, and other information. The client and server use DHCP to complete an interactive query and response process. Although the IP address of the server is fixed, these four processes are all broadcast, and the four processes use the same Transaction ID. XP2 can now obtain the IP address 192.168.1.1, which is a conflicting IP address. Part 2: After the client receives the dhcp ack packet, it uses the Gratuitous ARP Protocol to detect the IP address conflict to determine whether the IP address is used in the network. This mechanism exists in 2000 or later systems. If the IP address is used by the same machine in the network, data packets are returned. Broadcast the IP address conflict to the other party. The entire detection process has three data packets. 1. The client broadcasts the Request packet sent by Gratuitous ARP. This packet is used by client broadcast to detect IP conflict. This package includes: source IP address 192.168.1.1, MAC address, MAC address of the other Party: 000000000000 (do not know the MAC address of the other party, replace it with 0), IP address of the other Party: 192.168.1.1 (this IP address returns a response packet after receiving the packet, indicating that the IP address of a host is 192.168.1.1. After receiving the packet, XP2 will know that the IP address already exists at the URL, there is a network IP conflict ). 2. A host with the same IP address sends a Gratuitous ARP Reply packet to the destination. Host IP Address: 192.168.1.1 XP2 is returned when a data packet is sent. The source IP address of the data packet is 192.168.1.1, source MAC address, destination IP address: 192.168.1.1, and destination MAC address. 3. hosts with the same IP address send Gratuitous ARP conflict messages in broadcast mode. The packet is the original owner of the original IP Address: 192.168.1.1. It is broadcast to inform the network that a network IP address conflict exists. In this case, the DHCP server will receive the information and record it in the log. To prevent IP conflict, the DHCP client uses ARP to detect the conflict after receiving the specified address. 4. XP2 broadcast sends a Decline denial packet to the DHCP server, indicating that the IP address 192.168.1.1 is unavailable. The IP address of XP2 is 0.0.0.0, indicating that the assigned IP address 192.168.1.1 is in conflict and unavailable. The Transaction ID of this packet is the same as the first four DHCP packets. A case for applying for a transaction is completed. Part 3: 1. The client obtains the IP address for the second time. This is the same as the application process in the first part, but the Transaction ID has changed. During the second application, because 192.168.1.1 was previously assigned and rejected, the next available IP address will be assigned to the XP2 host in order, which is 192.168.1.2, because only one of the hosts is applying. 2. For the second IP address conflict detection, three ARP packets are usually sent at a time. 3. After the IP address is obtained successfully, the next step for the client is to find the WINS server and register the NETBIOS name.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.