Sharing learning network device configuration from scratch - Task 2.8 Realize departmental computer dynamic acquisition of address (dhcp)

foreword

        This article is a supporting resource for the teaching material of the network equipment configuration and management project tutorial (Huawei eNSP simulator version), published by the Electronic Industry Press and edited by Mr. Zhang Wenku. The explanation is very detailed and shared with everyone. I hope you can gain something.

mission details

        A company's network adopts a fixed address method, because many employees manually modify the company's address by themselves. Address conflicts often occur. In order to optimize the management of the office network, it is decided not to use manual allocation of IP addresses; firstly, the management is difficult; secondly, problems such as address conflicts and address recycling are often found. The company decided to enable DHCP on the core layer switch in the office network to realize the dynamic address management of the company network, so that all devices can automatically obtain addresses and reduce the workload of network management.

   mission requirements

(1) Realize the dynamic acquisition of addresses by departmental computers, as shown in the network topology diagram

(2) Divide two VLANs (VLAN10, VLAN20) on SW2A and SW3A, and set GE0/0/1 port as Trunk. The detailed parameters are shown in the table

 

(3) The port IP addresses of PC1~PC2 are set as shown in the table

 

(4) Divide two VLANs on the switch SW3A, and enable the DHCP service at the same time, so that computers connected to different VLANs on the switch can obtain corresponding IP addresses, and finally realize the intercommunication of the whole network. 

   knowledge preparation

        The Dynamic Host Configuration Protocol (DHCP) is one of the TCP/IP protocol clusters, which provides a mechanism for dynamically allocating network configuration parameters, and is backward compatible with the BOOTP protocol.  

        As the scale of the network expands and the complexity of the network increases, computer locations change (such as laptops or wireless networks) and the number of computers exceeds the number of IP addresses that can be allocated. DHCP was developed to meet these needs. The DHCP protocol works in the client/server (Client/Server) mode. The DHCP Client dynamically requests configuration information from the DHCP Server, and the DHCP Server returns corresponding configuration information (such as IP addresses, etc.) according to policies. When the DHCP client logs in to the network for the first time, it mainly establishes contact with the DHCP server through four stages.

 (1) Discovery stage: the stage where the DHCP client looks for the DHCP server. The client broadcasts the DHCP_Discover message, and only the DHCP server responds.

 (2) Provisioning stage: the stage in which the DHCP server provides an IP address. After receiving the DHCP_Discover message from the client, the DHCP server selects an unallocated IP address from the IP address pool to assign to the client, and sends a DHCP_Offer message containing the leased IP address and other settings to the client.

(3) Selection phase: the phase in which the DHCP client selects an IP address. If multiple DHCP servers send DHCP_Offer messages to the client, the client only accepts the first received DHCP_Offer message, and then responds to each DHCP server with a DHCP_Request message in broadcast mode.

(4) Confirmation stage: the stage in which the DHCP server confirms the provided IP address. After the DHCP server receives the DHCP_Request message answered by the DHCP client, it sends a DHCP_ACK confirmation message including the IP address it provides and other settings to the client.

   task implementation

1. Refer to the diagram to build the network topology, use straight-through cables for all connections and turn on the power of all devices.

2. The basic configuration of the switch.

(1) Configure the name of the Layer 2 switch as S2A, divide two VLANs on the switch, VLAN10 and VLAN20, and allocate ports for the two VLANs as required.

(2) Configure the name of the layer-3 switch as SW3A, and divide two VLANs on the switch: VLAN10 and VLAN20.

 

3. Configure the switch port as Trunk, and allow VLAN10 and VLAN20 to pass through.

(1) Configure the GE0/0/1 port of the Layer 2 switch SW2A.

 

(2) Configure the GE0/0/1 port of the Layer 3 switch SW3A.

 4. Turn on the DHCP function of the switch.

 5. Configure the DHCP service of the switch.

 6. Configure the VLANIF port IP of the VLAN and enable the DHCP function of the VLANIF port of the VLAN. Configure the IP address of the VLANIF port of each VLAN divided on the switch, and enable the DHCP function of the VLANIF port of the VLAN at the same time.

7. Set the computer to use DHCP to obtain an IP address.

(1) Click the right mouse button on PC1, and select the "Settings" command in the pop-up shortcut menu to open the setting dialog box. In the "IPv4 Configuration" column in the "Basic Configuration" tab, select "DHCP", and then click the "Apply" button in the lower right corner of the dialog box, as shown in the figure

 

(2) Click the "Command Line" tab of PC1, and enter the "ipconfig" command to view the IP address of the port, as shown in the figure

 

(3) Using the same method, set another computer to use DHCP to obtain IP, and check the IP information obtained by the computer, and finally you will get the following table

 

It can be clearly seen from the analysis table that both computers have obtained IP addresses, subnet masks, gateways and DNS addresses, and the IP addresses obtained by the computer connected to VLAN10 belong to the IP address of the 192.168.10.0/24 network segment. The computer connected to VLAN20 obtains the IP address of the 192.168.20.0/24 network segment, which fulfills the requirements of the task. 

8. Set the reserved IP address. When performing DHCP service, it is usually necessary to reserve part of the IP addresses for use by servers or other network devices in a fixed allocation manner. For example, in this task, the port IPs of the two VLANs of the switch belong to fixed allocation. These reserved IPs cannot be assigned to other computers by DHCP. If in this experiment, the first 53 IPs of the 192.168.10.0/24 network segment are reserved for backup, and the first 100 IPs of the 192.168.20.0/24 network segment are reserved for backup. The specific implementation commands are as follows:

 After adding the above command, check the IP address obtained by the computer again. For the detection method, please refer to the sixth step, and the computer will regain the IP address parameters. So it can be obtained as the table

 It can be seen from the table that all computers have obtained new IP addresses again, and they are all IP addresses other than the reserved addresses. The purpose of reserving the IP address is realized.

task acceptance

In the two computers, check the acquisition of the IP address, and use the Ping command to test the connectivity of other computers. It can be concluded that the computers in the current network are connected.

task summary

        In this task, a Layer 3 switch is used as the DHCP server, so that the downlink computer can obtain the IP address, subnet mask, gateway, and DNS server address through the switch. When there are a large number of computers in a network, using the DHCP service can easily configure the corresponding IP address parameters for each computer, reducing the work of network administrators in assigning IP addresses.

Guess you like

Origin blog.csdn.net/m0_59193722/article/details/130080162