锐捷网管交换机DHCP中继配置举例

一、 组网需求
如图所示,DHCP客户端Host所在网段为192.1.1.0/24,Device A为网关设备,Device B为DHCP服务器。DHCP客户端要想向DHCP服务器申请到IP地址等相关配置信息,需要将网关作为DHCP中继,使得DHCP报文能够被中继转发给DHCP服务器。
DHCP 中继配置组网图

二、 配置要点
● 配置Device A。
○配置接口的IP地址。
○开启DHCP中继功能。

●配置Device B。
○ 配置接口的IP地址。
○ 配置从Device B到Device A的接口GigabitEthernet 0/1的路由。
○ 开启DHCP Server服务,配置地址池的参数。

三、配置步骤
(1) 配置Device A
# 配置接口的IP地址。
DeviceA> enable
DeviceA# configure terminal
DeviceA(config)# interface gigabitethernet 0/1
DeviceA(config-if-GigabitEthernet 0/1)# ip address 192.1.1.1 255.255.255.0
DeviceA(config-if-GigabitEthernet 0/1)# exit
DeviceA(config)# interface gigabitethernet 0/2
DeviceA(config-if-GigabitEthernet 0/2)# ip address 172.2.2.2 255.255.255.0
DeviceA(config-if-GigabitEthernet 0/2)# exit

# 开启DHCP中继功能。
DeviceA(config)# service dhcp

# 添加DHCP服务器的地址。
DeviceA(config)# ip helper-address 172.2.2.1

(2) 配置Device B
# 配置接口的IP地址。
DeviceB> enable
DeviceB# configure terminal
DeviceB(config)# interface gigabitethernet 0/1
DeviceB(config-if-GigabitEthernet 0/1)# ip address 172.2.2.1 255.255.255.0
DeviceB(config-if-GigabitEthernet 0/1)# exit

# 配置到192.1.1.0/24网段的静态路由。
DeviceB(config)# ip route 192.1.1.0 255.255.255.0 gigabitethernet 0/1

# 启用DHCP Server功能。
DeviceB(config)# service dhcp

# 配置地址池pool1的网络参数。
DeviceB(config)# ip dhcp pool pool1
DeviceB(dhcp-config)# network 192.1.1.0 255.255.255.0
DeviceB(dhcp-config)# default-router 192.1.1.1
DeviceB(dhcp-config)# dns-server 192.1.1.2
DeviceB(dhcp-config)# exit

(3) 配置Host启动DHCP获取地址的功能。

5. 验证配置结果
# Host申请到192.1.1.0/24网段的地址。
# 在Device B通过show ip dhcp pool命令查看地址池配置及使用情况。
DeviceB(config)# show ip dhcp pool
Pool name Total Distributed Remained Percentage
———— ———– ———– ——– ———–
pool1 126 1 125 0.99206

四、 配置文件
● Device A的配置文件
hostname DeviceA
!
interface gigabitethernet 0/1
ip address 192.1.1.1 255.255.255.0
!
interface gigabitethernet 0/2
!
service dhcp
ip helper-address 172.2.2.1
!

● Device B的配置文件
hostname DeviceB
!
interface gigabitethernet 0/1
ip address 172.2.2.1 255.255.255.0
!
ip route 192.1.1.0 255.255.255.0 gigabitethernet 0/1
service dhcp
!
ip dhcp pool pool1
network 192.1.1.0 255.255.255.0
default-router 192.1.1.1
dns-server 192.1.1.2
!

六、常见错误
●DHCP中继没有启动DHCP Relay功能。
●没有配置DHCP Relay与DHCP Service之间的路由。
● 在DHCP中继上没有配置DHCP服务器IP地址。

ICP备案号:晋ICP备18007549号-1
站长微信:13613567205