跳转至

华为交换机DHCP配置

拓扑结构

拓扑结构

操作步骤

1.全局启动DHCP服务

1
2
3
<Huawei>system-view 
Enter system view, return user view with Ctrl+Z.
[Huawei]dhcp enable  

2.创建地址池并配置相关属性。

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

1
2
3
4
5
6
7
8
[Huawei]ip pool 10
[Huawei-ip-pool-10]network 192.168.10.0 mask 255.255.255.0
[Huawei-ip-pool-10]excluded-ip-address 192.168.10.250 192.168.10.254 //保留一段地址
[Huawei-ip-pool-10]excluded-ip-address 192.168.10.199  //保留单个地址
[Huawei-ip-pool-10]dns-list 202.102.224.68
[Huawei-ip-pool-10]gateway-list 192.168.10.1
[Huawei-ip-pool-10]lease day 10
[Huawei-ip-pool-10]quit

3.配置IP地址池20的属性

主要配置地址池范围、DNS地址、出口网关、NetBOIS地址和地址池租期

1
2
3
4
5
6
[Huawei]ip pool 20
[Huawei-ip-pool-20]network 192.168.20.0 mask 255.255.255.0
[Huawei-ip-pool-20]dns-list 202.102.224.68
[Huawei-ip-pool-20]gateway-list 192.168.20.1
[Huawei-ip-pool-20]lease day 10
[Huawei-ip-pool-20]quit 

4.配置VLANIF接口下地址分配方式。

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

1
2
3
4
5
6
7
8
9
[Huawei]vlan batch 10 20  //batch配置多个VLAN
[Huawei]interface GigabitEthernet 0/0/1
[Huawei-GigabitEthernet0/0/1]port link-type access 
[Huawei-GigabitEthernet0/0/1]port default vlan 10
[Huawei-GigabitEthernet0/0/1]quit
[Huawei]interface GigabitEthernet 0/0/2
[Huawei-GigabitEthernet0/0/2]port link-type access 
[Huawei-GigabitEthernet0/0/2]port default vlan 20
[Huawei-GigabitEthernet0/0/2]quit

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
[Huawei]interface Vlanif 10
[Huawei-Vlanif10]ip address 192.168.10.1 24
[Huawei-Vlanif10]dhcp select global 
[Huawei-Vlanif10]quit

# 配置VLANIF20接口下的客户端从全局地址池中获取IP地址。
[Huawei]interface Vlanif 20
[Huawei-Vlanif20]ip add 192.168.20.1 24
[Huawei-Vlanif20]dhcp select global
[Huawei-Vlanif20]quit 

6.验证配置

huawei-display-ip-pool

上面显示了所有ip pool信息,也可以只显示某个pool的信息

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
[sw1]display ip pool name 10 
  Pool-name      : 10
  Pool-No        : 0
  Lease          : 10 Days 0 Hours 0 Minutes
  Domain-name    : -
  DNS-server0    : 202.102.224.68  
  NBNS-server0   : -               
  Netbios-type   : -               
  Position       : Local           Status           : Unlocked
  Gateway-0      : 192.168.10.1    
  Mask           : 255.255.255.0
  VPN instance   : --
 -----------------------------------------------------------------------------
         Start           End     Total  Used  Idle(Expired)  Conflict  Disable
 -----------------------------------------------------------------------------
    192.168.10.1  192.168.10.254   253     1        249(0)         0        3
 -----------------------------------------------------------------------------

7.PC上获取IP

huawei dhcp ipconfig

捐赠本站(Donate)

weixin_pay
如您感觉文章有用,可扫码捐赠本站!(If the article useful, you can scan the QR code to donate))