The application and principle of DHCP in the enterprise network campus

  
I. Introduction to DHCP: The full name of DHCP is the Dynamic Host Configuration Protocol (Dynamic Host Configuration Protoco), which is commonly used in local area networks and uses UDP protocol. It is mainly used to allocate machines in the internal network. The IP address is convenient for the administrator to centrally manage the computer ip allocation in the network. Second, the DHCP component: It consists of the server and the client. The server is responsible for handling the client's DHCP request. Negotiate with the client and then assign an IP address to the client. Third, the DHCP address allocation is divided into three ways: Manual allocation: Also known as static IP, often fixed permanent IP for some servers or a few computers with special functions. Automatic allocation method: Automatically assign IP addresses to clients, and the lease period is permanent. Dynamic allocation: This method is now the most common, assigning a temporary IP address to the client. Fourth, the difference between the three distribution methods: Single scope: manage a single scope. Only one network is included. Superscope: Can contain multiple DHCP scopes to include multiple subnets. Use two dhcp servers to manage separate logical IP networks on the same physical network segment. A plane-based network. Dhcp Relay: A layered network. V. Dynamic allocation method: Schematic: 1. The client sends the DHCP discover packet using the broadcast address of 0.0.0.0, waiting for the response from the DHCP server. 2. After receiving the message, the DHCP server returns a DHCP offer, and the client receives it. Send the DHCPrequest packet, which contains the IP address of the server that provided the offer. 3. When other DHCP servers receive the DHCP request message, they will reclaim their offer message. 4. The server providing the offer information sends a DHCP ack acknowledgment message to the client, and the client will initialize its own TCP/IP protocol again after receiving it. The process of updating the address by the DHCP client: Since the dynamically allocated lease is temporary, when the lease term reaches 50%, the DHCP client automatically attempts to renew the lease. Send a DHCPrequest, if the server receives it, it will send a DHCPack, if the server is down, the client will continue to use the current configuration information. When the lease term reaches 87.5%, the client broadcasts a DHCPdiscover message to update his lease. If the DHCP offer message response from the server is received at this time, the current lease will be updated, and the client can continue to use normally. If there is no response, the previous IP configuration information will continue to be used. If the lease time reaches 100% (the lease expires), the client must release the currently used ip address. The client then resends the DCHP discover and waits for a response. (Attach: View the lease file in linux: /var/lib/dhcpd/dhcpd.leases) Case 1. Single-scope implementation steps: 1. Mount the CD and edit the local yum to better solve the installation package. Time dependencies. 2. Install the dhcp service on the Linux server. 3. Edit /etc/dhcpd.conf. After the dhcp service is successfully installed, the file will be generated. a) Follow the prompts to read the corresponding asking price in the bottom line mode. b) :r /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample c) Modify the scope, gateway, subnet mask, Address pool, address binding related information i. Subnet scope ii. Option routers gateway iii. Opition domian-name host domain name iv. range dynamic-bootp address pool v. host XXX{ ... } static address binding, Some servers issue fixed IP addresses for other users to access. The detailed modification information is as follows: d) Save after modification: wq e) Then use ipconfig /release to release the IP address on the physical machine to which the IP is bound, and re-acquire the IP address using ipconfig /renew, and find that the IP address is fixed. f) At this end of the single-scope dchp test. In our corporate network, you may encounter multiple non-contiguous network segments. With super-scope, you can combine multiple scopes into a single managed entity. Case 2, super scope implementation steps: a) 1. Modify the /etc/dhcpd.conf file b) Read: r /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample c) Restart linux . d) The super-scope trial is now complete. Summary: Single scope and super scope are almost the same, only the scope of the /etc/dhcpd.conf is slightly different. Therefore, I will not repeat them here. Case 3: DHCP Relay: Test Topology: 1. Edit vim /etc/dhcpd.conf to edit the three scopes 192.168.98.0, 192.168.99.0, and 192.168.100.0 empty scope respectively. The empty scope is the area where the SERVER cluster is located, and the server often uses a fixed IP address. So we no longer create an address pool, only create an empty scope, so that the DHCPD service in Linux can be enabled normally. 2. Create 3 scopes and restart the service. 3. Now we use a Linux host with 3 network cards to simulate the router in the figure. The environment is built for the router. Implement routing forwarding. 4. Then edit the /etc/sysctl.conf file and change the value of line 7 to 1. Open the route forwarding function. 5. Install the dhcp service. (Mainly used in the dhcrealy relay function) 6. Execute sysctl -p to enable forwarding. Check the modified parameters for errors. 7. Edit and configure the dhcrelay service and reboot. The following is an example of the modification method of the /etc/sysconfig/dhcrelay file. At this point, the partial simulation of the router is completed. 7. Then we test the communication situation in the zhangch network machine in the network zhangc in different areas, the assigned IP address. This article comes from “ Learning Sea Endless" blog, please be sure to keep this source http://zhangc.blog.51cto.com/5627676/963665
Copyright © Windows knowledge All Rights Reserved