锐捷网管交换机DHCP 客户端基本功能配置举例

一、组网需求
如图所示,Device A的接口GigabitEthernet 0/1通过DHCP协议,从Device B(DHCP服务器)获取IP地址和DNS服务器地址20.1.1.1/24。
DHCP 客户端基本功能配置组网图

二、 配置要点
● 开启Device A接口GigabitEthernet 0/1上的DHCP客户端功能。
● 开启Device B的DHCP服务器功能,并按要求配置地址池参数。

三、配置步骤
(1) 配置Device A
# 配置在接口GigabitEthernet 0/1上启用DHCP Client服务。
DeviceA> enable
DeviceA# configure terminal
DeviceA(config)# interface gigabitethernet 0/1
DeviceA(config-if-GigabitEthernet 0/1)# ip address dhcp

(2) 配置Device B
# 启用DHCP Server服务。
DeviceB> enable
DeviceB# configure terminal
DeviceB(config)# service dhcp

# 配置与客户端连接的接口IP地址。
DeviceB(config)# interface gigabitethernet 0/1
DeviceB(config-if-GigabitEthernet 0/1)# ip address 20.1.1.2 255.255.255.0
DeviceB(config-if-GigabitEthernet 0/1)# exit

# 配置与DNS服务器连接的接口IP地址。
DeviceB(config)# interface gigabitethernet 0/2
DeviceB(config-if-GigabitEthernet 0/2)# ip address 20.1.2.2 255.255.255.0
DeviceB(config-if-GigabitEthernet 0/2)# exit

# 配置动态地址池。
DeviceB(config)# ip dhcp pool User
DeviceB(dhcp-config)# network 20.1.1.0 255.255.255.0
DeviceB(dhcp-config)# dns-server 20.1.2.1
DeviceB(dhcp-config)# exit

# 配置排除地址。
DeviceB(config)# ip dhcp excluded-address 20.1.1.2

(3) 配置DNS Server
# 配置DNS Server的IP地址为20.1.2.1/24。

四、验证配置结果
# 在Device B上通过show dhcp lease查看接口获取IP地址信息。
DeviceB# show dhcp lease
Temp IP addr: 20.1.1.1 for peer on Interface: GigabitEthernet 0/1
Temp sub net mask: 255.255.255.0
DHCP Lease server: 20.1.1.2, state: 7 Bound
DHCP transaction id: ca811331
Lease: 14400 secs, Renewal: 7200 secs, Rebind: 12600 secs
Next timer fires after: 4916 secs
Retry count: 0 Client-ID: 0158696cc59347
# 在Device A上通过show hosts查看接口获取DNS服务器信息。
DeviceA# show hosts
Name servers are:
20.1.2.1 dynamic from DHCP
Host type Address TTL(sec)

五、 配置文件
● Device A的配置文件
hostname DeviceA
!
interface gigabitethernet 0/1
ip address dhcp
!
● Device B的配置文件
hostname DeviceB
!
service dhcp
ip dhcp excluded-address 20.1.1.2
!
interface gigabitethernet 0/1
ip address 20.1.1.2 255.255.255.0
!
interface gigabitethernet 0/2
ip address 20.1.2.2 255.255.255.0
!
ip dhcp pool User
network 20.1.1.0 255.255.255.0
dns-server 20.1.2.1
!

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