「Huawei VRP」- 配置 DHCP 服务

  CREATED BY JENKINSBOT

Huawei ARG3 系列路由器支持两种地址池:全局地址池 ;接口地址池;

接口地址池

[Huawei] dhcp enable
[Huawei] interface GigabitEthernet0/0/0
[Huawei-GigabitEthernet0/0/0] dhcp select interface                             # 将该接口所在网络作为地址池
[Huawei-GigabitEthernet0/0/0] dhcp server dns-list 10.1.1.2
[Huawei-GigabitEthernet0/0/0] dhcp server excluded-ip-address 10.1.1.2          # 排除某些地址
[Huawei-GigabitEthernet0/0/0] dhcp server lease day 3                           # 设置租期为 3 天

查看 DHCP 配置:

[Huawei] display ip pool

全局地址池

[Huawei] dhcp enable
[Huawei] ip pool pool2
[Huawei-ip-pool-pool2] network 1.1.1.0 mask 24                                  # 地址池范围 
[Huawei-ip-pool-pool2] gateway-list 1.1.1.1
[Huawei-ip-pool-pool2] lease day 10
[Huawei-ip-pool-pool2] quit

[Huawei] interface GigabitEthernet0/0/0                          
[Huawei-GigabitEthernet0/0/0] dhcp select global                                # 选择全局地址池

如果由多个地址池,那么 dhcp select global 将选择哪个地址池?

参考 AR 系列接入路由器 产品版本:V200R007 | 文档版本:17 | 发布时间:2021-03-08

根据文档的描述,DHCP服务器选择地址池的原则:
1)当无中继场景时,DHCP Server 选择与接收DHCP请求报文的接口IP地址处于同一网段的地址池。
2)

修改 DHCP 的 DNS 地址

system-view
diplay ip pool
ip pool vlanXX
display this
undo dns-list 10.10.1.1
dns-list 10.10.1.3

配置 DHCP Rely 服务

DHCP Relay 请求 DHCP Server,其中最关键的一点是 192.168.0.254 到 10.0.12.2 网络互通,否则实验将失败。我们在 AR1 与 AR2 部署 OSPF 协议,实现网络互通(这里不再赘述配置)。

# for AR2

ip pool 0
 gateway-list 192.168.0.254 
 network 192.168.0.0 mask 255.255.255.0 
 dns-list 223.5.5.5 

interface GigabitEthernet0/0/1
 ip address 10.0.12.2 255.255.255.0 
 dhcp select global

# for AR1

dhcp server group DR 
 dhcp-server 10.0.12.2 0

interface GigabitEthernet0/0/0
 ip address 192.168.0.254 255.255.255.0 
 dhcp select relay
 dhcp relay server-select DR

interface GigabitEthernet0/0/1
 ip address 10.0.12.1 255.255.255.0