How does a virtual platform computer obtain an IP address automatically?

** In Huawei eNSP virtual platform demonstration, how does the terminal obtain an IP address automatically? (Router assigns IP)**

1: First place 4 computers, set to DHCP (automatically obtain IP address)

2: Two computers respectively select the appropriate interface and connect to the two switches
Insert picture description here

3: Take out another router, and connect the two switches to port 0/0/0 and port 0/0/1 of the router respectively

4: Configure the gateway IP corresponding to port 0/0/0 and port 0/0/1, the corresponding command is:

     <Huawei>system-view    键入系统视图命令
     [Huawei]        系统模式    可以对设备进行管理
     [Huawei]interface GigabitEthernet 0/0/0 或 0/0/1
     [Huawei-GigabitEthernet0/0/0]ip address 192.168.1.1 255.255.255.0  (配置ip地址,也就是对应区域的网关IP)
     [Huawei-GigabitEthernet0/0/0]quit  退出该模式
     [Huawei]display ip interface brief  查看接口摘要



 Interface                         IP Address/Mask      Physical   Protocol  
 GigabitEthernet0/0/0              192.168.1.1/24       up         up        
 GigabitEthernet0/0/1              192.168.2.1/24       up         up        
 GigabitEthernet0/0/2              unassigned           down       down      
 NULL0                             unassigned           up         up(s)     

If the above code appears, it means that the port IP configuration is successful.
Next, enter a command on the router to enable the DHCP service. The command is as follows:

[Huawei]dhcp enable    开启DHCP的服务
[Huawei]ip pool a   创建名为a的池塘,一台设备上可以创建多个池塘,但一个池塘只能服务一个广播域
[Huawei-ip-pool-a]network 192.168.1.0 mask 24  关联接口
[Huawei-ip-pool-a]gateway-list 192.168.1.1   网关地址
[Huawei-ip-pool-a]dns-list 114.114.114.114 8.8.8.8  两个DNS服务器的地址必须在需要进行地址下发的接口上也开启dhcp服务
[Huawei]interface GigabitEthernet 0/0/0   开启接口
[Huawei-GigabitEthernet0/0/0]dhcp select global

The above is the DHCP command to open an interface, the second interface command is similar

输入:quit 命令,将设备退到最后一层

Then start the second interface command, because it is in a different area, so you need to make a different pond

[Huawei]ip pool b

The corresponding associated interface IP is not the same, to associate another port, add the gateway address

[Huawei-ip-pool-a]network 192.168.2.0 mask 24  
[Huawei-ip-pool-a]gateway-list 192.168.2.1
[Huawei-ip-pool-a]dns-list 114.114.114.114 8.8.8.8  两个DNS服务器的地址必须在需要进行地址下发的接口上也开启dhcp服务

Finally, return the pond to this layer [Huawei] The system mode can manage the device.
The interface of the area is different, and you must enter the command to open the interface again to change the address to the interface of another area, as follows:

[Huawei]interface GigabitEthernet 0/0/1   开启接口
[Huawei-GigabitEthernet0/0/1]dhcp select global

The above is all the commands to turn on DHCP, and then you can realize the data transmission between the two devices and send packets normally

But because the computer's IP is automatically obtained, you have to enter the command ipconfig to query the computer's automatically obtained IP, and use two devices to ping

There will be a problem:

You will find that the first ping will fail, because the system default ping time is 2 seconds, the computer needs to find the MAC address of the gateway through the ARP protocol within these two seconds, and the gateway needs to find the MAC address of another computer, so the time is not enough Use, the first ping failure belongs to the normal range
Insert picture description here

Guess you like

Origin blog.csdn.net/wwyyh/article/details/110728146