华为S23/S27/S5700二三层交换机配置DHCP服务

2025-10-18 22:24:07

1、如图1所示,

SwitchA应用为DHCP服务器

SwitchB和SwitchC为用户接入交换机,用户通过向SwitchA请求DHCP服务

华为S23/S27/S5700二三层交换机配置DHCP服务

2、DHCP服务器的配置思路如下:

3、启动公司网络内SwitchA的DHCP服务器功能。

在Switch上创建地址池并配置地址池的相关属性,如地址池范围、出口网关、NetBIOS地址、地址租用期限等,准备提供给客户端。

配置VLANIF接口下本地DHCP服务器的地址分配方式,DHCP服务器从全局地址池中给客户端分配IP地址。

4、启动DHCP服务。

<Quidway> system-view

[Quidway] dhcp enable

5、创建地址池并配置相关属性。

# 配置IP地址池1的属性(地址池范围、DNS地址、出口网关和地址池租期)。

[Quidway] ip pool 1

[Quidway-ip-pool-1] network 10.1.1.0 mask 255.255.255.128

[Quidway-ip-pool-1] dns-list 10.1.1.2

[Quidway-ip-pool-1] gateway-list 10.1.1.126

[Quidway-ip-pool-1] excluded-ip-address 10.1.1.2

[Quidway-ip-pool-1] excluded-ip-address 10.1.1.4

[Quidway-ip-pool-1] lease day 10

[Quidway-ip-pool-1] quit

6、# 配置IP地址池2的属性(地址池范围、DNS地址、出口网关、NetBOIS地址和地址池租期)

[Quidway] ip pool 2

[Quidway-ip-pool-2] network 10.1.1.128 mask 255.255.255.128

[Quidway-ip-pool-2] dns-list 10.1.1.2

[Quidway-ip-pool-2] nbns-list 10.1.1.4

[Quidway-ip-pool-2] gateway-list 10.1.1.254

[Quidway-ip-pool-2] lease day 2

[Quidway-ip-pool-2] quit

7、配置VLANIF接口下地址分配方式。

# 配置接口Eth 0/0/1和Eth 0/0/2分别加入相应的VLAN。

[Quidway] vlan batch 10 20

[Quidway] interface ethernet 0/0/1

[Quidway-Ethernet0/0/1] port hybrid pvid vlan 10

[Quidway-Ethernet0/0/1] port hybrid untagged vlan 10

[Quidway-Ethernet0/0/1] quit

[Quidway] interface ethernet 0/0/2

[Quidway-Ethernet0/0/2] port hybrid pvid vlan 20

[Quidway-Ethernet0/0/2] port hybrid untagged vlan 20

[Quidway-Ethernet0/0/2] quit

8、# 配置VLANIF10接口下的客户端从全局地址池中获取IP地址。

[Quidway] interface vlanif 10

[Quidway-Vlanif10] ip address 10.1.1.1 255.255.255.128

[Quidway-Vlanif10] dhcp select global

[Quidway-Vlanif10] quit

9、# 配置VLANIF20接口下的客户端从全局地址池中获取IP地址。

[Quidway] interface vlanif 20

[Quidway-Vlanif20] ip address 10.1.1.129 255.255.255.128

[Quidway-Vlanif20] dhcp select global

[Quidway-Vlanif20] quit

10、查看当前SwitchA的配置文件

#

 sysname Quidway

#

 vlan batch 10 20

#

dhcp enable

#

 ip pool 1

 ip pool 2 

#

ip pool 1

 gateway-list 10.1.1.126

 network 10.1.1.0 mask 255.255.255.128

 excluded-ip-address 10.1.1.2

 excluded-ip-address 10.1.1.4

 dns-list 10.1.1.2

 lease day 10 hour 0 minute 0

#

ip pool 2

 gateway-list 10.1.1.254

 network 10.1.1.128 mask 255.255.255.128

 dns-list 10.1.1.2

 nbns-list 10.1.1.4

 lease day 5 hour 0 minute 0

#

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 Ethernet0/0/1

 port hybrid pvid vlan 10

 port hybrid untagged vlan 10 

#

interface Ethernet0/0/2

 port hybrid pvid vlan 20

 port hybrid untagged vlan 20 

#

return

11、验证配置结果。

在Switch上使用display ip pool命令用来查看IP地址池配置情况。

12、[Quidway] display ip pool

   -----------------------------------------------------------------------

  Pool-Name      : 2

  Pool-No        : 0

  Position       : Local           Status           : Unlocked

  Gateway-0      : 10.1.1.254

  Mask           : 255.255.255.128

  Vpn instance   : --

  -----------------------------------------------------------------------

  Pool-Name      : 1

  Pool-No        : 2

  Position       : Local           Status           : Unlocked

  Gateway-0      : 10.1.1.126

  Mask           : 255.255.255.128

  Vpn instance   : --

   IP address Statistic

    Total       :250

    Used        :0          Idle        :248

    Expired     :0          Conflict    :0          Disable   :2

13、如果您觉得本经验有帮助,请点击正下方的或右上角的“大拇指”或“分享”或“关注TA”给我支持和鼓励

为了方便下次寻找,您可以点击“收藏”收藏本经验

如有其他问题请联系我本人

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢