本文将介绍如何在华为路由器上配置DHCP服务,实现自动向局域网内的主机分配IP地址的目的。拓扑如下:
DHCP有两种配置方式,具体配置如下:
1.按接口地址池的方式配置:
[Huawei]interface g0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 192.168.1.1 255.255.255.0
[Huawei-GigabitEthernet0/0/0]undo shutdown
[Huawei-GigabitEthernet0/0/0]dhcp select interface
[Huawei-GigabitEthernet0/0/0]dhcp server dns-list 192.168.20.50
[Huawei-GigabitEthernet0/0/0]dhcp server excluded-ip-address 192.168.1.1
[Huawei-GigabitEthernet0/0/0]dhcp server lease day 1
2.按全局地址池的方式配置:
[Huawei]dhcp enable
[Huawei]ip pool qgtest
[Huawei-ip-pool- qgtest]network 192.168.1.0 mask 24
[Huawei-ip-pool- qgtest]gateway-list 192.168.1.1
[Huawei-ip-pool- qgtest]lease day 1
[Huawei]interface g0/0/0
[Huawei-GigabitEthernet0/0/0]dhcp select global