

图1 DHCP Snooping 防攻击组网图 (👉 可在实际发布时插入拓扑图)

在 DHCP 客户端动态获取 IP 地址过程中,DHCP Snooping 会对客户端与服务器之间的 DHCP 报文进行检测与过滤,从而实现:
✅ 阻止非法 DHCP Server ✅ 防止 IP 地址欺骗 ✅ 提升网络安全性
在以下场景中建议启用 DHCP Snooping:
👉 目标:
防止非法 DHCP Server 接入,确保 IP 地址由合法服务器分配
1️⃣ 在核心交换机 SwitchB 上配置 DHCP Server 2️⃣ 在接入交换机 SwitchA 上:
<HUAWEI> system-view
[HUAWEI] sysname SwitchB
[SwitchB] vlan batch 10
[SwitchB] interface gigabitethernet 0/0/1
[SwitchB-GE0/0/1] port link-type trunk
[SwitchB-GE0/0/1] port trunk allow-pass vlan 10
[SwitchB-GE0/0/1] quit
[SwitchB] dhcp enable
[SwitchB] interface vlanif 10
[SwitchB-Vlanif10] ip address 10.1.1.1 255.255.255.0
[SwitchB-Vlanif10] dhcp select interface
[SwitchB-Vlanif10] quit
<HUAWEI> system-view
[HUAWEI] sysname SwitchA
[SwitchA] vlan batch 10
# 上联接口
[SwitchA] interface gigabitethernet 0/0/1
[SwitchA-GE0/0/1] port link-type trunk
[SwitchA-GE0/0/1] port trunk allow-pass vlan 10
[SwitchA-GE0/0/1] quit
# 用户接口
[SwitchA] interface gigabitethernet 0/0/2
[SwitchA-GE0/0/2] port link-type access
[SwitchA-GE0/0/2] port default vlan 10
[SwitchA-GE0/0/2] quit
[SwitchA] interface gigabitethernet 0/0/3
[SwitchA-GE0/0/3] port link-type access
[SwitchA-GE0/0/3] port default vlan 10
[SwitchA-GE0/0/3] quit
# 开启 DHCP Snooping
[SwitchA] dhcp enable
[SwitchA] dhcp snooping enable ipv4
# 用户端口启用 Snooping
[SwitchA] interface gigabitethernet 0/0/2
[SwitchA-GE0/0/2] dhcp snooping enable
[SwitchA-GE0/0/2] quit
[SwitchA] interface gigabitethernet 0/0/3
[SwitchA-GE0/0/3] dhcp snooping enable
[SwitchA-GE0/0/3] quit
# 上联端口设为信任
[SwitchA] interface gigabitethernet 0/0/1
[SwitchA-GE0/0/1] dhcp snooping trusted
[SwitchA-GE0/0/1] quit
display dhcp snooping configuration
display ip pool interface vlanif10 used
display dhcp snooping user-bind all
📌 输出示例:
IP Address MAC Address VLAN Interface
10.1.1.254 xxxx-xxxx-xxxx 10 GE0/0/2
👉 表示绑定成功,DHCP Snooping 正常工作
sysname SwitchA
vlan batch 10
dhcp enable
dhcp snooping enable ipv4
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10
dhcp snooping trusted
interface GigabitEthernet0/0/2
port link-type access
port default vlan 10
dhcp snooping enable
interface GigabitEthernet0/0/3
port link-type access
port default vlan 10
dhcp snooping enable
sysname SwitchB
vlan batch 10
dhcp enable
interface Vlanif10
ip address 10.1.1.1 255.255.255.0
dhcp select interface
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10
项目 | 说明 |
|---|---|
核心功能 | 防止 DHCP 仿冒攻击 |
部署位置 | 接入层交换机 |
信任端口 | 上联接口 |
非信任端口 | 用户接入接口 |
核心机制 | 绑定表(IP + MAC + 接口) |