DHCP 攻击方式:
1 饿死攻击: MAC 地址限制, 不断获取 IP 地址, 这种结合交换机端口安全技术防范
2DHCP Server 仿冒者攻击: 信任 (Trusted)/ 不信任 (Untrusted)
3 中间人攻击 / IP/MAC Spoofing 攻击: DHCP Snooping 绑定表
4 改变 CHADDR 值的 DoS 攻击: 检查 DHCP 报文的 CHADDR 字段 (不断申请 IP 地址)
DHCP Server 仿冒者攻击:
由于 DHCP 使用 discovery 广播包 offer 报文提供 IP/mask GW,requset 先来先得地址, ACK 确认包
ARP 欺骗, MAC 地址绑定
- [SwitchA] dhcp enable
- [SwitchA] interface vlanif 100
- [SwitchA-Vlanif100] ip address 10.1.1.1 24
- [SwitchA-Vlanif100] dhcp select interface
[SwitchA-Vlanif100] dhcp server excluded-ip-address 10.1.1.100 10.1.1.200 排除地址
[SwitchA-Vlanif100] dhcp server lease day 10 修改租期
[SwitchA-Vlanif100] dhcp server static-bind ip-address 10.1.1.100 mac-address dcd2-fc96-e4c0 为客户端分配固定的 IP 地址
reset ip pool interface vlanif100 conflict 清除冲突地址
[SwitchA] dhcp snooping enable ipv4 配置设备仅处理 IPv4 报文, 节约设备的 CPU 利用率
[SwitchA] interface gigabitethernet 2/0/1 配置接口 GE2/0/1 为 DHCP Snooping 信任接口
- [SwitchA-GigabitEthernet2/0/1] dhcp snooping trusted
- [SwitchA-GigabitEthernet2/0/1] quit
[SwitchA] user-bind static ip-address 10.0.0.2 mac-address 0001-0001-0001 interface gigabitethernet 1/0/3 vlan 10 静态绑定
[SwitchA] interface gigabitethernet 1/0/1
[SwitchA-GigabitEthernet1/0/1] arp anti-attack check user-bind enable 即对 ARP 报文进行绑定表匹配检查功能
- [SwitchA-GigabitEthernet1/0/1] quit
- [SwitchA] interface gigabitethernet 0/0/2
[SwitchA-GigabitEthernet0/0/2] dhcp snooping enable 用户侧接口的 DHCP Snooping 功能
- [SwitchA-GigabitEthernet0/0/2] quit
- [SwitchA] interface gigabitethernet 0/0/3
- [SwitchA-GigabitEthernet0/0/3] dhcp snooping enable
- [SwitchA-GigabitEthernet0/0/3] quit
- [SwitchA] vlan 10
[SwitchA-vlan10] ip source check user-bind enable IPSG 功能
[SwitchA-vlan10] dhcp snooping enable VLAN 10 下的 DHCP Snooping 功能
[SwitchA-vlan10] dhcp snooping trusted interface gigabitethernet 0/0/4 配置信任接口
display arp anti-attack statistics check user-bind interface gigabitethernet 1/0/1 查看接口下 ARP 报文丢弃计数
display ip pool interface vlanif10 used 查看地址池中已经使用的 IP 地址信息
display dhcp static user-bind all 查看静态绑定表信息
配置 DHCP 中继
- [access] dhcp enable
- [access] interface vlan 20
- [access-Vlanif20] dhcp select relay // 配置 DHCP 中继
- [access-Vlanif20] dhcp relay server-ip 10.20.1.1 // 配置 DHCP 服务器 IP 地址
- [access-Vlanif20] quit
[Switch] port-group portgroup1 创建永久端口组 portgroup1
[Switch-port-group-portgroup1] group-member GE1/0/1 to GE1/0/3 物理端口加入 portgroup1 中
[Switch-port-group-portgroup1] undo negotiation auto 批量配置接口工作在非自协商模式
[Switch-port-group-portgroup1] duplex full 批量配置接口为全双工模式
[Switch-port-group-portgroup1] speed 100 批量配置接口速率为 100Mbit/s
[Switch-port-group-portgroup1] undo portswitch 配置单个接口切换到三层模式
[Switch-port-group-portgroup1]combo-port copper 修改为电口模式
[Switch] mac-address static 4-4-4 gigabitethernet 1/0/2 vlan 2 在 Switch 上添加服务器对应的静态 MAC 地址表项
[Switch] mac-address blackhole 非法 PC 的 MAC 地址 其对应 vlan 防止非法 MAC 地址攻击
[Switch] vlan 2 最多可以学习 100 个 MAC 地址, 超过最大 MAC 地址学习数量的报文丢弃并进行告警提示
- [Switch-vlan2] mac-limit maximum 100 action discard
- [Switch] interface gigabitethernet 1/0/1
- [Switch-GigabitEthernet1/0/1] mac-limit maximum 100 action discard
display mac-address static vlan 2 查看静态 MAC 表是否添加成功
display mac-address blackhole 命令, 查看黑洞 MAC 表是否添加成功
端口安全
[Switch] interface gigabitethernet 1/0/1
[Switch-GigabitEthernet1/0/1] port-security enable 开启端口安全
[Switch-GigabitEthernet1/0/1] port-security mac-address sticky 使 sticky MAC 功能
[Switch-GigabitEthernet1/0/1] port-security max-mac-num 1 默认限制数为 1
来源: http://www.bubuko.com/infodetail-2515001.html