In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
First, the working principle of DHCP 1.DHCP service introduction
DHCP (Dynamic Host Configuration Protocol, dynamic host configuration protocol) is usually used in large-scale local area network environment, and its main function is to centrally manage and assign 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 of addresses.
Benefits of 2.DHCP services
(1) reduce the workload of administrators
(2) avoid IP address conflicts
(3) when the network changes the IP address range, there is no need to reconfigure the IP address of each user.
(4) the utilization of IP address is improved.
(5) facilitate the configuration of the client.
How 3.DHCP is allocated
(1) automatic allocation: permanent use after being assigned to one or more IP addresses
(2) Manual assignment: the DHCP server administrator specifically specifies the IP address
(3) dynamic allocation: release the IP for use by other clients after use.
The lease process of 4.DHCP
(1) client requests IP address (Discover)
When a DHCP client starts, the client does not have an IP address, so the client needs to obtain a legitimate address through DHCP, and the DHCP client broadcasts DHCP Discover discovery information to find the DHCP server.
(2) Server response (Offer)
When the DHCP server receives the information from the client requesting the IP address, it looks in its own IP address pool to see if there is a legitimate IP address provided to the client. If so, the DHCP server marks the IP address and adds it to the DHCP Offer message, and then the DHCP server broadcasts a DHCP Offer message.
(3) the client chooses the IP address (Request)
The DHCP client extracts the IP address from the first DHCP Offer message received, and the DHCP server that issued the IP address retains the address so that it can no longer be assigned to another DHCP client. There may be multiple DHCP servers in a network environment, so the DHCP client will get multiple DHCP offer, which is the DHCP client needs to select one of the supplied IP, and then broadcast the request to tell all the DHCP servers of their choice.
(4) the server confirms the lease (ACK)
After receiving the DHCP Request message, the DHCP server broadcasts a successful confirmation to the client in the form of an DHCP ACK message containing a valid lease and other configurable information for the IP address. When the client receives the DHCP ACK message, it configures the IP address to complete the initialization of the TCP/IP.
(5) re-login
Each time the DHCP client logs back into the network, it no longer needs to send DHCP Discover information, but directly sends the DHCP Request request information containing the previously assigned IP address.
(6) renew the tenancy agreement
When the lease of the IP address leased by the DHCP server to the client reaches 50%, the lease needs to be renewed. The client sends a DHCP Request packet directly to the server that provides the lease, requesting that the existing address lease be updated.
II. Configuration of DHCP relay service
1. First set up the topology diagram in GNS3, and then connect the device according to the interface in the figure.
Interface connection:
Sw1:f1/0-sw2:f1/0
Sw1:f1/1-DHCP:VMnet1
Sw1:f1/2-win10:VMnet2
Sw1:f1/3-server:VMnet8
Vlan allocation:
Win10:vlan 10
Server:vlan 20
DHCP:vlan 100
Network segment assignment:
Win10:192.168.10.0/24
Server:192.168.20.0/24
DHCP:192.168.100.0/24
two。 Install the DHCP service with the yum source on the Linux system. Note: installation needs to be in a networked environment.
3. Select the network mode of the win10 system to customize and bind the VMnet1 network card.
4. Select the network mode of the server system to customize and bind the VMnet2 network card.
5. Select the network mode of the Linux system to customize and bind the VMnet8 network card.
6. Click "Edit" to select "Virtual Network Editor", then select "change Settings", then select "VMnet8" network card to change to host-only mode, and remove "√" from the "assign IP addresses using local DHCP services" option. (steps 4, 5 and 6 are to create an experimental environment without DHCP servers in the local area network.)
7. Enter the Linux system and use the vim editor to edit the configuration file of the network card "ens33" and configure it with a fixed IP.
Enter: vim / etc/sysconfig/network-scripts/ifcfg-ens33 change dhcp to static add: IPADDR=192.168.100.100NETMASK=255.255.255.0GATEWAY=192.168.100.1
8. After changing the configuration of the network card "ens33", restart the network service, and then check the network card information, you can see that the IP address is set successfully.
Input: service network restart input: ifconfig
9. We copy the template "/ usr/share/doc/dhcp-4.2.5/dhcpd.conf.example" of the DHCP configuration file given by the system to the configuration file "/ etc/dhcp/dhcpd.conf" of the DHCP service and overwrite it.
Input: cp/ usr/share/doc/dhcp-4.2.5/dhcpd.conf.example / etc/dhcp/dhcpd.conf
10. Configure the configuration file "/ etc/dhcp/dhcpd.conf" of the DHCP service with the vim editor. Add the DHCP service of three network segments to it.
Input: vim / etc/dhcp/dhcpd.conf add: subnet 192.168.10.0 netmask 255.255.255.0 {range 192.168.10.50 192.168.10.100; option routers 192.168.10.1;} subnet 192.168.20.0 netmask 255.255.255.0 {range 192.168.20.50 192.168.20.100; option routers 192.168.20.1 } subnet 192.168.100.0 netmask 255.255.255.0 {range 192.168.100.50 192.168.100.100; option routers 192.168.100.1;}
11. Open the dhcp service and check the service status.
Input: systemctl start dhcpd input: systemctl status dhcpd
twelve。 Enter GNS3 and turn on all devices.
13. Double-click sw1 to open the configuration panel of sw1. Enter global mode and turn off the routing function.
Input: conf t input: no ip routing
14. Create three new vlan, namely vlan 10, vlan 20, and vlan 100. Then check to see if the vlan was added successfully.
Input: vlan 1010 20100 input: do show vlan-sw b input: exit
15. Enter the f1access 1, f1max 2, and f1max 3 interfaces, set the interface mode to "access" mode, and then add the three interfaces to vlan 100, vlan 10, and vlan 20, respectively. Then enter the f1 0 interface and set the f1thumb 0 interface mode to "trunk" mode and the trunk encapsulation type to "dot1q".
Input: int f1ram 1 input: switch mode access input: switch access vlan 100input: exit input: int f1max 2 input: switch mode access input: switch access vlan 10 input: exit input: int f1max 3 input: switch mode access input: switch access vlan 20 input: exit input: int f1ram 0 input: switch mode trunk input: switchport trunk encapsulation dot1q input: exit input
16. Double-click the sw2 device to open the configuration panel of sw2. Enter global mode first, and then create three new vlan,vlan 10, vlan 20, and vlan 100s. Then check to see if the addition is successful.
Input: conf t input: vlan 10pm 20100 input: exit input: do show vlan-switch brief
17. Enter the f1ax 0 interface, set the f1apace 0 interface mode to "trunk" mode, and set the trunk encapsulation type to "dot1q".
Input: int f1max 0 input: switch mode trunk input: switchport trunk encapsulation dot1q input: exit
18. Enter vlan 10, vlan 20 and vlan 100 respectively, set their gateway addresses and turn them on.
Input: int vlan 10 input: ip add 192.168.10.1 255.255.255.0 input: no shutdown input: exit input: int vlan 20 input: ip add 192.168.20.1 255.255.255.0 input: no shutdown input: exit input: int vlan 100input: ip add 192.168.100.1 255.255.255.0 input: no shutdown input: exit
19. Check to see if the IP address is set successfully.
Input: do show ip int brief
20. Enter vlan 10, vlan 20, and vlan 100, respectively, and set the IP address of the DHCP server to them.
Input: int vlan 10 input: ip helper-address 192.168.100.100 input: no shutdown input: exit input: int vlan 20 input: ip helper-address 192.168.100.100 input: no shutdown input: exit input: int vlan 100input: ip helper-address 192.168.100.100 input: no shutdown input: exit
21. Enter the win10 system, first release the previously obtained IP address, and then re-obtain the IP address. As a result, the IP address 192.168.10.50 assigned by the DHCP server was successfully obtained.
Input: ipconfig / release input: ipconfig / renew
twenty-two。 Use the "ipconfig / all" command to check the address of the DHCP server. That's 192.168.100.100.
23. Enter the server system, first release the previously obtained IP address, and then re-obtain the IP address. As a result, the IP address 192.168.20.51 assigned by the DHCP server was successfully obtained.
Input: ipconfig / release input: ipconfig / renew
23. Use the "ipconfig / all" command to check the address of the DHCP server. That's 192.168.100.100.
24. Assign a fixed IP address to the win10 system. First use the "ipconfig / all" command to check the MAC address of win10.
25. Enter the DHCP service configuration file of the Linux system again, and set the fixed IP address of win10 to 192.168.10.10
Input: vim / etc/dhcp/dhcpd.conf add: host fantasia {hardware ethernet 00VOCJU 29JEV 27RV 9B; fixed-address 192.168.10.10;}
twenty-six。 Restart the DHCP service.
Input: systemctl restart dhcpd
twenty-seven。 Enter the win10 system again, first release the previously obtained IP address, and then re-obtain the IP address. As a result, the fixed IP address 192.168.10.10 assigned by the DHCP server was successfully obtained.
Input: ipconfig / release input: ipconfig / renew
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.