华三交换机如何配置dhcp,开启dhcp snooping

一,核心交换机SW配置

使能dhcp

[SW]dhcp enable

创建vlan10并配置交换机vlan10地址

[SW]vlan 10

[SW-vlan10]inter vlan 10

[SW-Vlan-interface10]ip add 192.168.10.1 24

创建dhcp地址池vlan10并配置

[SW]dhcp server ip-pool vlan10 //创建地址池,名为vlan10

[SW-dhcp-pool-vlan10]network 192.168.10.0 mask 255.255.255.0 //分配dhcp的地址网段

[SW-dhcp-pool-vlan10]gateway-list 192.168.10.1 //设置dhcp分配的网关地址

[SW-dhcp-pool-vlan10]dns-list 192.168.10.1 //设置dhcp分配的dns地址

[SW-dhcp-pool-vlan10]expired day 0 hour 10 minute 0 second 0 //设置dhcp租期,可按天/小时/分钟/秒来设置

[SW-dhcp-pool-vlan10]forbidden-ip 192.168.10.1 //设置参于dhcp分配的地址

[SW-dhcp-pool-vlan10]quit

设置不参于dhcp分配的地址段

[SW]dhcp server forbidden-ip 192.168.10.2 192.168.10.10

设置pc端ip为自动获取,成功获取到地址。

二,接入交换机sw2上配置dhcp snooping

[SW2]dhcp snooping enable

[SW2]interface GigabitEthernet 1/0/1

[SW2-GigabitEthernet1/0/1]dhcp snooping trust

使用命令display dhcp snooping trust查看信任端口信息