一、拓扑图如下
二、配置思路
1、启动DHCP服务;
2、创建VLANIF接口,并配置VLANIF接口的IP地址;
3、使能VLANIF接口地址池;
4、配置地址池的相关属性
三、操作步骤
1、启动DHCP服务
[DHCPServer] dhcp enable
2、创建VLAN
[DHCPServer]vlan batch 10 20
3、配置接口并加入vlan
#配置GE0/0/1接口加入vlan10
[DHCPServer] interface gigabitethernet 0/0/1
[DHCPServer-GigabitEthernet0/0/1] port hybrid pvid vlan 10 [DHCPServer-GigabitEthernet0/0/1] port hybrid untagged vlan 10 [DHCPServer-GigabitEthernet0/0/1] quit#配置GE0/0/2接口加入vlan20
[DHCPServer] interface gigabitethernet 0/0/2
[DHCPServer-GigabitEthernet0/0/2] port hybrid pvid vlan 20 [DHCPServer-GigabitEthernet0/0/2] port hybrid untagged vlan 20 [DHCPServer-GigabitEthernet0/0/2] quit4、配置VLANIF接口IP地址
# 配置VLANIF10接口地址。 [DHCPServer] interface vlanif 10 [DHCPServer-Vlanif10] ip address 192.168.10.1 24 [DHCPServer-Vlanif10] quit # 配置VLANIF11接口地址。 [DHCPServer] interface vlanif 20 [DHCPServer-Vlanif20] ip address 192.168.20.1 24 [DHCPServer-Vlanif20] quit5、使能VLANIF接口地址池
# 配置VLANIF10接口下的客户端从接口地址池中获取IP地址。
[DHCPServer] interface vlanif 10 [DHCPServer-Vlanif10] dhcp select interface [DHCPServer-Vlanif10] quit # 配置VLANIF20接口下的客户端从接口地址池中获取IP地址。 [DHCPServer] interface vlanif 20 [DHCPServer-Vlanif11] dhcp select interface [DHCPServer-Vlanif11] quit6、配置接口地址池地址租用期限
# 配置VLANIF10接口地址租用期限为30天。
[DHCPServer] interface vlanif 10
[DHCPServer-Vlanif10] dhcp server lease day 30 [DHCPServer-Vlanif10] quit # 配置VLANIF20接口地址租用期限为20天。[DHCPServer] interface vlanif 20
[DHCPServer-Vlanif11] dhcp server lease day 20 [DHCPServer-Vlanif11] quit7、验证配置结果。
在DHCPServer上使用display ip pool interface命令用来查看接口地址池配置情况
配置完成,你学会了吗,请继续关注