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 选择全局dhcp类型
[Huawei-Vlanif10] quit
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 配置DNS
[Huawei-ip-pool-pool1] gateway-list 192.168.10.254 配置网关
[Huawei-ip-pool-pool1] lease day 3 设置租约
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]dis ip pool name vlan10 used 查看地址池ip使用情况
<Huawei>reset ip pool name pool1 192.168.2.1 回收IP地址192.168.2.1
5、 配置DHCP通过vlanif接口下的接口获取来获取地址
<Huawei> system-view 进入系统视图
[Huawei] interface Vlanif 20
[Huawei-Vlanif20]ip address 192.168.20.1 255.255.255.0 vlan地址
[Huawei-Vlanif20]dhcp select interface 选择基于接口的dhcp类型
[Huawei-Vlanif20]dhcp server excluded-ip-address 192.168.20.200 192.168.20.253 排除保
留的地址
[Huawei-Vlanif20] dhcp server static-bind ip-address 192.168.20.100 mac-address 5489-98b7-7378 绑定MAC静态IP
[Huawei-Vlanif20]dhcp server lease day 8 hour 0 minute 0 设置租约
[Huawei-Vlanif20]dhcp server dns-list 114.114.114.114 配置DNS
6、华为交换机配置dhcp中继
拓扑图
SW2配置:
vlan batch 10 20 50
dhcp enable
dhcp server group yukong
dhcp-server 10.3.50.50 0
interface Vlanif10
ip address 10.0.0.1 255.255.255.0
dhcp select relay
dhcp relay server-ip 10.3.50.50
interface Vlanif20
ip address 20.0.0.1 255.255.255.0
dhcp select relay
dhcp relay server-ip 10.3.50.50
interface Vlanif50
ip address 10.3.50.1 255.255.255.0
interface Vlanif10
ip address 10.0.0.1 255.255.255.0
dhcp select relay
dhcp relay server-ip 10.3.50.50
interface Vlanif20
ip address 20.0.0.1 255.255.255.0
dhcp select relay
dhcp relay server-ip 10.3.50.50
interface Vlanif50
ip address 10.3.50.1 255.255.255.0
interface GigabitEthernet0/0/1
port link-type access
port default vlan 10
interface GigabitEthernet0/0/2
port link-type access
port default vlan 20
interface GigabitEthernet0/0/3
port link-type access
port default vlan 50
AR1配置:
dhcp enable
ip pool vlan10
gateway-list 10.0.0.1
network 10.0.0.0 mask 255.255.255.0
dns-list 114.114.114.114
ip pool vlan20
gateway-list 20.0.0.1
network 20.0.0.0 mask 255.255.255.0
dns-list 114.114.114.114
interface GigabitEthernet0/0/0
ip address 10.3.50.50 255.255.255.0
dhcp select global
ip route-static 10.0.0.0 255.255.255.0 10.3.50.1
ip route-static 20.0.0.0 255.255.255.0 10.3.50.1
版权归原作者 爱学习的小任 所有, 如有侵权,请联系我们删除。