动态主机配置协议DHCP(Dynamic Host Configuration Protocol)是一种用于集中对用户IP地址进行动态管理和配置的技术。
下面我为大家整理了非常详细的配置步骤和命令,仅供参考学习,如有错误,还望指点指点。
![](https://pics5.baidu.com/feed/c83d70cf3bc79f3da09755b4ded74c1b738b2944.png@f_auto?token=b5ceef82e0715dbade7044aac9099365)
一、华为交换机配置DHCP服务
1、交换机开启dhcp服务
[Huawei] dhcp enable
2、配置用户网关,并在接口下开启dhcp全局模式
[Huawei] interface vlanif 10
[Huawei-Vlanif10] ip address 192.168.10.254 255.255.255.0
[Huawei-Vlanif10] dhcp select global
[Huawei-Vlanif10] quit
[Huawei]
3、创建地址池
[Huawei] ip pool vlan10
[Huawei-ip-pool-pool1] network 192.168.10.0 mask 255.255.255.0
[Huawei-ip-pool-pool1] dns-list 114.114.114.114
[Huawei-ip-pool-pool1] gateway-list 192.168.10.254
4、保留 192.168.10.1-192.168.10.10 不下发
[Huawei-ip-pool-pool1] excluded-ip-address 192.168.10.1 192.168.10.10
[Huawei-ip-pool-pool1] quit
[Huawei]
![](https://pics0.baidu.com/feed/8601a18b87d6277f8eaf2e90744e9e3ae824fc5d.png@f_auto?token=f9391cfc158711a3d72737a6918e8a1d)
二、华三交换机配置DHCP服务
1、交换机开启dhcp服务
[H3C] dhcp enable
2、配置用户网关,并在接口下开启dhcp全局模式
[H3C] interface vlan-interface 10
[H3C-Vlan-interface10] ip address 192.168.10.254 255.255.255.0
[H3C-Vlan-interface10] dhcp select server global-pool
[H3C-Vlan-interface10] quit
[H3C]
3、创建地址池
[H3C] dhcp server ip-pool vlan10
[SwitchA-dhcp-pool-vlan10] network 192.168.10.0 mask 255.255.255.0
[SwitchA-dhcp-pool-vlan10] dns-list 114.114.114.114
[SwitchA-dhcp-pool-vlan10] gateway-list 192.168.10.254
[SwitchA-dhcp-pool-vlan10] quit
[H3C]
4、保留 192.168.10.1-192.168.10.10 不下发
[H3C] dhcp server forbidden-ip 192.168.10.1 192.168.10.10
![](https://pics6.baidu.com/feed/6d81800a19d8bc3e0f8322a3dffd2714a9d34554.png@f_auto?token=90ba3215db21a942d66f22847699344b)
三、锐捷交换机配置DHCP服务
1、交换机开启dhcp服务
Ruijie(config)# service dhcp
2、创建用户网关(以vlan10为例)
Ruijie(config)#interface vlan 10
Ruijie(config-if-VLAN 10)#ip address 192.168.10.254 255.255.255.0
Ruijie(config-if-VLAN 10)#exit
Ruijie(config)#
3、创建地址池
Ruijie(config)# ip dhcp pool vlan10
Ruijie(dhcp-config)# network 192.168.10.0 255.255.255.0
Ruijie(dhcp-config)# dns-server 114.114.114.114
Ruijie(dhcp-config)# default-router 192.168.10.254
Ruijie(dhcp-config)# exit
Ruijie(config)#
4、保留 192.168.10.1-192.168.10.10 不下发
Ruijie(config)# ip dhcp excluded-address 192.168.10.1 192.168.10.10
![](https://pics3.baidu.com/feed/aa18972bd40735fa19267effc3278eb90e240826.png@f_auto?token=f49aa775f2c9634ff476a1897d363821)