华为路由器作DHCP服务配置(接口地址池和全局地址池配置)
一、接口地址池方式配置
1.配置DHCP服务为AR1
[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
[Huawei]display ip pool
-----------------------------------------------------------------------
Pool-name : GigabitEthernet0/0/0
Pool-No : 0
Position : Interface Status : Unlocked
Gateway-0 : 192.168.1.1
Mask : 255.255.255.0
××× instance : --
IP address Statistic
Total :253
Used :0 Idle :253
Expired :0 Conflict :0 Disable :0
二、全局地址池方式配置
原理:全局方式下,设置多个全局地址池,并存在定义的地址池网段与端口IP是同一网段的对应关系,即多个不同网段地池对应各自的端口,最终实现不同网段客户端自动获取相应地址
配置DHCP服务为AR1
[Huawei]dhcp enable
[Huawei]ip pool jszx
[Huawei-ip-pool-jszx]network 192.168.1.0 mask 24
[Huawei-ip-pool-jszx]gateway-list 192.168.1.1
[Huawei-ip-pool-jszx]lease day 1
[Huawei]interface g0/0/0
[Huawei-GigabitEthernet0/0/0]dhcp select global
[Huawei]display ip pool
Pool-name : jszx
Pool-No : 0
Position : Local Status : Unlocked
Gateway-0 : 192.168.1.1
Mask : 255.255.255.0
××× instance : --
IP address Statistic
Total :253
Used :0 Idle :253
Expired :0 Conflict :0 Disable
三、附加升级试验
依照"二"的全局配置过程,需要几个网段就定义几个地址池
1.在"二"的基础上再添中JYD地址池,拓扑如下:
配置AR1添加JYD地址池
[Huawei]interface GigabitEthernet 0/0/1
[Huawei-GigabitEthernet0/0/1]ip address 192.168.100.1 255.255.255.0
[Huawei]ip pool JYD
[Huawei-ip-pool-jszx]network 192.168.100.0 mask 24
[Huawei-ip-pool-jszx]gateway-list 192.168.100.1
[Huawei-ip-pool-jszx]lease day 1
[Huawei]interface g0/0/1
[Huawei-GigabitEthernet0/0/0]dhcp select global
[Huawei]display ip pool
PC5获得地址
PC1获得地址