锐捷网管交换机DHCP动态分配地址配置举例

一、组网需求
如图所示,Device A作为DHCP服务器为同一网段中的客户端动态分配IP地址,地址池分为两个网段:192.1.1.0/25和192.1.1.128/25。
网段192.1.1.0/25内的IP地址租用期限为5天,域名后缀名为test.com,DNS服务器地址为192.1.1.130,网关地址为192.1.1.1;网段10.1.1.128/25内的IP地址租用期限为3天,域名后缀名为test.com,DNS服务器地址为192.1.1.130,网关地址为192.1.1.129。
动态分配地址配置组网图

二、配置要点
配置Device A:
●配置接口的IP地址。
●开启DHCP Server服务,配置2个地址池的参数。

三、 配置步骤
(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.128
DeviceA(config-if-GigabitEthernet 0/1)# exit
DeviceA(config)# interface gigabitethernet 0/2
DeviceA(config-if-GigabitEthernet 0/2)# ip address 192.1.1.129 255.255.255.128
DeviceA(config-if-GigabitEthernet 0/2)# exit

# 启用DHCP Server服务。
DeviceA(config)# service dhcp

# 配置地址池pool1的网络参数。
DeviceA(config)# ip dhcp pool pool1
DeviceA(dhcp-config)# network 192.1.1.0 255.255.255.128
DeviceA(dhcp-config)# default-router 192.1.1.1
DeviceA(dhcp-config)# dns-server 192.1.1.130
DeviceA(dhcp-config)# domain-name test.com
DeviceA(dhcp-config)# lease 5
DeviceA(dhcp-config)# exit

# 配置地址池pool2的网络参数。
DeviceA(config)# ip dhcp pool pool2
DeviceA(dhcp-config)# network 192.1.1.128 255.255.255.128
DeviceA(dhcp-config)# default-router 192.1.1.129
DeviceA(dhcp-config)# dns-server 192.1.1.130
DeviceA(dhcp-config)# domain-name test.com
DeviceA(dhcp-config)# lease 3

(2) 配置DNS Server
# 配置DNS Server的IP地址为192.1.1.130/25。

(3) 配置Host
# 配置Host A、Host B、Host C启动DHCP获取地址的功能。

四、验证配置结果
# Host A和Host B申请到192.1.1.0/25网段的地址。
# Host C申请到192.1.1.128/25网段的地址。
# 在Device A通过show ip dhcp pool命令查看地址池配置及使用情况。
DeviceA(config)# show ip dhcp pool
Pool name Total Distributed Remained Percentage
———— ———– ———– ——– ———–
pool1 126 2 124 0.98413
pool2 126 1 125 0.99206

五、 配置文件
Device A的配置文件
hostname DeviceA
!

interface gigabitethernet 0/1
ip address 192.1.1.1 255.255.255.128
!
interface gigabitethernet 0/2
ip address 192.1.1.129 255.255.255.128
!
service dhcp
!
ip dhcp pool pool1
network 192.1.1.0 255.255.255.128
default-router 192.1.1.1
dns-server 192.1.1.130
domain-name test.com
lease 5
!
ip dhcp pool pool2
network 192.1.1.128 255.255.255.128
default-router 192.1.1.129
dns-server 192.1.1.130
domain-name test.com
lease 3
!

六、 常见错误
●未配置地址池。
●未开启DHCP Server服务。

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