华为交换机配置DHCP

DHCP Server

DHCP有区分全局地址池与基于接口的地址池,本篇主要介绍基于接口的DHCP配置

网络拓扑

华为交换机配置DHCP_第1张图片

DHCP Server配置

<Huawei>u t m
<Huawei>system-view 
[Huawei]sysname DHCP Server
[DHCP Server]vlan batch 10 20
[DHCP Server]dhcp enable
[DHCP Server]ip pool vlan10
[DHCP Server-ip-pool-vlan10]gateway-list 10.0.0.254
[DHCP Server-ip-pool-vlan10]network 10.0.0.0 mask 24
[DHCP Server-ip-pool-vlan10]excluded-ip-address 10.0.0.240 10.0.0.253  #限制IP范围
[DHCP Server-ip-pool-vlan10]lease day 2  #有效期
[DHCP Server-ip-pool-vlan10]dns-list 114.114.114.114
[DHCP Server-ip-pool-vlan10]quit
[DHCP Server]ip pool vlan20
[DHCP Server-ip-pool-vlan20]gateway-list 10.1.1.254 
[DHCP Server-ip-pool-vlan20]network 10.1.1.0 mask 24
[DHCP Server-ip-pool-vlan20]excluded-ip-address 10.1.1.240 10.1.1.253
[DHCP Server-ip-pool-vlan20]lease day 2
[DHCP Server-ip-pool-vlan20]dns-list 114.114.114.114
[DHCP Server-ip-pool-vlan20]quit
[DHCP Server]interface vlanif 10
[DHCP Server-Vlanif10]ip address 10.0.0.254 24
[DHCP Server-Vlanif10]dhcp select global 
[DHCP Server-Vlanif10]quit
[DHCP Server]interface vlanif 20
[DHCP Server-Vlanif20]ip address 10.1.1.254 24
[DHCP Server-Vlanif20]dhcp select global 
[DHCP Server-Vlanif20]quit
[DHCP Server]interface g0/0/1
[DHCP Server-GigabitEthernet0/0/1]port link-type trunk
[DHCP Server-GigabitEthernet0/0/1]port trunk allow-pass vlan 10
[DHCP Server-GigabitEthernet0/0/1]quit
[DHCP Server]inter g0/0/2
[DHCP Server-GigabitEthernet0/0/2]port link-type trunk
[DHCP Server-GigabitEthernet0/0/2]port trunk allow-pass vlan 20

sw1配置

<Huawei>u t m
<Huawei>system-view 
[Huawei]vlan batch 10 20
[Huawei]dhcp enable
[Huawei]inter e0/0/1
[Huawei-Ethernet0/0/1]port link-type trunk 
[Huawei-Ethernet0/0/1]port trunk allow-pass vlan 10
[Huawei-Ethernet0/0/1]quit
[Huawei]inter e0/0/2
[Huawei-Ethernet0/0/2]port link-type access 
[Huawei-Ethernet0/0/2]port default vlan 10
[Huawei-Ethernet0/0/2]quit

sw2配置

<Huawei>u t m
<Huawei>system-view 
[Huawei]dhcp enable
[Huawei]sysname sw2
[sw2]vlan 20
[sw2-GigabitEthernet0/0/1]inter e0/0/1
[sw2-Ethernet0/0/1]port link-type trunk 
[sw2-Ethernet0/0/1]port trunk allow-pass vlan 20
[sw2-Ethernet0/0/1]inter e0/0/2
[sw2-Ethernet0/0/2]port link-type access 
[sw2-Ethernet0/0/2]port default vlan 20
[sw2-Ethernet0/0/2]quit
[sw2]inter e0/0/2
[sw2-Ethernet0/0/2]port default vlan 20
[sw2-Ethernet0/0/2]quit

查看客户端地址

PC2的IP
华为交换机配置DHCP_第2张图片
PC3的IP

华为交换机配置DHCP_第3张图片
从PC2 (10.0.0.239)ping PC3(10.1.1.239)
华为交换机配置DHCP_第4张图片
查看地址池
华为交换机配置DHCP_第5张图片

你可能感兴趣的:(路由交换)