同网段内配置基于全局地址池的DHCP服务器示例组网需求
如图1所示,某企业有两个处于同一网络内的办公室,为了节省资源,两个办公室内的主机由SwitchA作为DHCP服务器统一分配IP地址 。
办公室1所属的网段为10.1.1.0/25,主机都加入VLAN10,办公室1的主机只使用DNS服务,不使用NetBIOS服务,地址租期为10天;办公室2所属的网段为10.1.1.128/25,主机都加入VLAN20,办公室2的主机使用DNS服务和NetBIOS服务,地址租期为2天 。
在SwitchA上配置全局地址池,并采取动态地址分配方式为两个办公室的主机分配IP地址 。
图1 配置基于全局地址池的DHCP服务器组网图

文章插图
配置思路
DHCP服务器的配置思路如下:
- 在SwitchA上创建两个全局地址池,并配置各自的地址池相关属性,实现根据不同需求,为办公室1和办公室2动态分配地址 。
- 在SwitchA上配置VLANIF接口下本地DHCP服务器的地址分配方式,实现DHCP服务器从全局地址池中给客户端分配IP地址 。
操作步骤
启动DHCP服务 <HUAWEI> system-view[HUAWEI] sysname SwitchA[SwitchA] dhcp enable
- 创建地址池并配置相关属性
- # 配置IP地址池1的属性(地址池范围、DNS地址、出口网关、不参与分配的地址和地址池租期) 。
[SwitchA] ip pool 1[SwitchA-ip-pool-1] network 10.1.1.0 mask 255.255.255.128[SwitchA-ip-pool-1] dns-list 10.1.1.2[SwitchA-ip-pool-1] gateway-list 10.1.1.1[SwitchA-ip-pool-1] excluded-ip-address 10.1.1.2[SwitchA-ip-pool-1] excluded-ip-address 10.1.1.4[SwitchA-ip-pool-1] lease day 10[SwitchA-ip-pool-1] quit
- # 配置IP地址池2的属性(地址池范围、DNS地址、出口网关、NetBIOS地址和地址池租期) 。
[SwitchA] ip pool 2[SwitchA-ip-pool-2] network 10.1.1.128 mask 255.255.255.128[SwitchA-ip-pool-2] dns-list 10.1.1.2[SwitchA-ip-pool-2] nbns-list 10.1.1.4[SwitchA-ip-pool-2] gateway-list 10.1.1.129[SwitchA-ip-pool-2] lease day 2[SwitchA-ip-pool-2] quit
- 配置VLANIF接口下地址分配方式
- # 配置接口GigabitEthernet1/0/1和GigabitEthernet1/0/2分别加入相应的VLAN 。
【华为交换机配置基于全局地址池的DHCP服务器】[SwitchA] vlan batch 10 20[SwitchA] interface gigabitethernet 1/0/1[SwitchA-GigabitEthernet1/0/1] port link-type hybrid[SwitchA-GigabitEthernet1/0/1] port hybrid pvid vlan 10[SwitchA-GigabitEthernet1/0/1] port hybrid untagged vlan 10[SwitchA-GigabitEthernet1/0/1] quit[SwitchA] interface gigabitethernet 1/0/2[SwitchA-GigabitEthernet1/0/2] port link-type hybrid[SwitchA-GigabitEthernet1/0/2] port hybrid pvid vlan 20[SwitchA-GigabitEthernet1/0/2] port hybrid untagged vlan 20[SwitchA-GigabitEthernet1/0/2] quit
- # 配置VLANIF10接口下的客户端从全局地址池中获取IP地址 。
[SwitchA] interface vlanif 10[SwitchA-Vlanif10] ip address 10.1.1.1 255.255.255.128[SwitchA-Vlanif10] dhcp select global[SwitchA-Vlanif10] quit
- # 配置VLANIF20接口下的客户端从全局地址池中获取IP地址 。
[SwitchA] interface vlanif 20[SwitchA-Vlanif20] ip address 10.1.1.129 255.255.255.128[SwitchA-Vlanif20] dhcp select global[SwitchA-Vlanif20] quit
- 验证配置结果
- 在SwitchA上使用display ip pool命令用来查看IP地址池配置情况 。
[SwitchA] display ip pool ----------------------------------------------------------------------- Pool-name : 1 Pool-No : 0 Lease : 10 Days 0 Hours 0 MinutesPosition : Local Status : Unlocked Gateway-0 : 10.1.1.1 Network : 10.1.1.0Mask : 255.255.255.128 VPN instance : -- Address Statistic: Total :125 Used :2Idle :121 Expired :0Conflict :0 Disable :2----------------------------------------------------------------------- Pool-name : 2 Pool-No : 1 Lease : 2 Days 0 Hours 0 MinutesPosition : Local Status : Unlocked Gateway-0 : 10.1.1.129 Network : 10.1.1.128Mask : 255.255.255.128 VPN instance : -- Address Statistic: Total :125 Used :4Idle :121 Expired :0Conflict :0 Disable :0IP address Statistic Total :250 Used :6 Idle :242 Expired :0 Conflict :0 Disable :2配置文件
SwitchA的配置文件
#sysname SwitchA#vlan batch 10 20#dhcp enable#ip pool 1 gateway-list 10.1.1.1 network 10.1.1.0 mask 255.255.255.128 excluded-ip-address 10.1.1.2 excluded-ip-address 10.1.1.4 lease day 10 hour 0 minute 0 dns-list 10.1.1.2#ip pool 2 gateway-list 10.1.1.129 network 10.1.1.128 mask 255.255.255.128 lease day 2 hour 0 minute 0 dns-list 10.1.1.2 nbns-list 10.1.1.4#interface Vlanif10 ip address 10.1.1.1 255.255.255.128 dhcp select global #interface Vlanif20 ip address 10.1.1.129 255.255.255.128 dhcp select global #interface GigabitEthernet1/0/1 port link-type hybrid port hybrid pvid vlan 10 port hybrid untagged vlan 10 #interface GigabitEthernet1/0/2 port link-type hybrid port hybrid pvid vlan 20 port hybrid untagged vlan 20 #return
推荐阅读
-
-
神乐人舌人舌|巴萨球迷:铲出感情了,皇马队长挽留梅西!一席话令人动容
-
野球帝|什么感觉?前国手颜射3分全中,他有多强?,奥运会对位詹姆斯
-
-
菁菁萌妈说|能让其自觉将手机放下,孩子整日沉迷手机怎么办?这3个妙招
-
李枫|69岁TVB女星认住老人院,曾因无钱治病爬地求医
-
看点|今年首次!小清河洪园闸7孔大小闸门同时开闸泄水
-
央视网|印度一化工厂锅炉爆炸引发火灾已致近40人受伤
-
『微信』马化腾再次出手!微信版“花呗”灰度上线,名字也恰到好处
-
小畜播报@无心调皮捉弄他,欢喜冤家被困也欢乐,无心法师3:白琉璃居然怕妖火
-
【指数】深圳警方发布2020年第19期深圳治安安全指数
-
「趣闻晨报」陈纫香是怎么死的,鬓边不是海棠红陈纫香是第几集死的
-
-
-
『亲妮小菇凉』天蝎座容忍度为0,发现将失去彼此,爱情不能够接受谎言的星座
-
今日趣闻|女星尝试汉服,鞠婧祎有韵味,郑爽娇俏,看到杨颖一次比一次惊艳
-
肠道|肠道是人体里的“第二大脑”和“第二心脏”,选择这样吃就对了
-
商务部|商务部流通产业促进中心组织召开二手车促消费新模式暨消费新引擎活动研讨会
-
60岁何赛飞带火了一种新穿法:“新中式风+高马尾”,时髦高级又优雅
-
「育儿小手册」让游戏体验更棒,《蔚蓝》开发者盘点跳跃小机制