找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 1690|回复: 0

端口 DHCP Snooping 配置,绑定 IP+MAC + 端口,抵御 DHCP 服务器伪造

[复制链接]

0

主题

1

回帖

6

积分

管理员

积分
6
发表于 昨天 01:45 | 显示全部楼层 |阅读模式
# 端口 DHCP Snooping 配置指南

DHCP Snooping 是一种网络安全特性,用于防止 DHCP 服务器伪造攻击(DHCP spoofing),通过绑定 IP 地址、MAC 地址和交换机端口来确保网络安全性。

## 配置步骤

### 1. 启用 DHCP Snooping

```cisco
Switch(config)# ip dhcp snooping  // 全局启用 DHCP Snooping
```

### 2. 指定信任端口(连接合法 DHCP 服务器的端口)

```cisco
Switch(config)# interface gigabitethernet0/1  // 示例:连接合法DHCP服务器的端口
Switch(config-if)# ip dhcp snooping trust
```

- **重要提示**:只有连接合法 DHCP 服务器的端口应配置为信任端口,其他端口保持非信任状态。

### 3. (可选)限制 DHCP 报文速率

```cisco
Switch(config)# interface range gigabitethernet0/2-24  // 示例:客户端接入端口
Switch(config-if-range)# ip dhcp snooping limit rate 15  // 限制每秒15个DHCP报文
```

### 4. 启用端口安全(绑定 IP+MAC+端口)

```cisco
Switch(config)# interface gigabitethernet0/2  // 示例:客户端接入端口
Switch(config-if)# switchport port-security
Switch(config-if)# switchport port-security mac-address sticky  // 动态学习MAC地址并绑定
Switch(config-if)# switchport port-security maximum 1  // 每个端口最多绑定1个MAC
Switch(config-if)# switchport port-security violation restrict  // 违规时限制流量
```

**更严格的绑定(静态配置)**:
```cisco
Switch(config-if)# switchport port-security mac-address xxxx.xxxx.xxxx  // 静态指定MAC地址
```

### 5. 结合 DHCP Snooping 绑定表

DHCP Snooping 会自动建立 IP+MAC+端口的绑定表,可通过以下命令查看:

```cisco
Switch# show ip dhcp snooping binding
```

### 6. 启用动态 ARP 检测(可选,增强安全性)

```cisco
Switch(config)# ip arp inspection  // 启用动态ARP检测
Switch(config)# interface range gigabitethernet0/2-24
Switch(config-if-range)# ip arp inspection trust  // 通常信任端口与DHCP信任端口一致
```

## 配置验证

1. **查看 DHCP Snooping 状态**:
   ```cisco
   Switch# show ip dhcp snooping
   ```

2. **查看绑定表**:
   ```cisco
   Switch# show ip dhcp snooping binding
   ```

3. **查看端口安全状态**:
   ```cisco
   Switch# show port-security
   Switch# show port-security address
   ```

## 注意事项

1. **信任端口**:确保只有合法 DHCP 服务器连接的端口被标记为信任端口。

2. **绑定表**:DHCP Snooping 会自动建立绑定表,但静态配置的端口安全绑定优先级更高。

3. **违规处理**:根据网络需求选择适当的违规处理方式(protect/restrict/shutdown)。

4. **VLAN 范围**:如果需要,可以指定 DHCP Snooping 作用的 VLAN 范围:
   ```cisco
   Switch(config)# ip dhcp snooping vlan 10,20,30
   ```

5. **交换机型号差异**:不同厂商(Cisco、Huawei、H3C等)的配置命令可能略有不同,上述示例基于 Cisco IOS。

通过以上配置,可以有效防止 DHCP 服务器伪造攻击,确保只有合法的 DHCP 服务器能够为客户端分配 IP 地址,同时通过 IP+MAC+端口的绑定增强网络安全性。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|五云论坛 ( 黔ICP备2022001370号-1|贵公网安备52032102000798号 )

GMT+8, 2026-8-1 23:16 , Processed in 0.071758 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表