路由器防火墙攻击防范:SYN 泛洪、端口扫描、ICMP 限速配置
针对路由器防火墙的SYN泛洪、端口扫描和ICMP攻击防范,以下是详细的配置思路和示例(以常见厂商如Cisco、Huawei、H3C为例):1. SYN泛洪攻击防范
原理:攻击者发送大量伪造的TCP SYN请求,耗尽服务器资源(半开连接)。
配置方法:
[*]启用TCP拦截(Cisco):
Router(config)# ip tcp intercept mode watch# 监控模式(自动拦截异常流量)
Router(config)# ip tcp intercept list ACL_NAME# 应用ACL指定受保护IP
[*]或使用ip tcp intercept max-incomplete high|low设置阈值。
[*]Huawei/H3C:
# 启用SYN Cookie机制(默认可能已开启)
system-view
firewall defend syn-flood enable
firewall defend syn-flood threshold 500# 设置触发防御的阈值
[*]其他优化:
[*]缩短TCP超时时间:ip tcp timewait-timeout 30(Cisco)。
[*]限制并发连接数:通过ACL或防火墙策略限制单个IP的连接数。
2. 端口扫描防范
原理:攻击者探测目标开放端口,寻找漏洞。
配置方法:
[*]启用端口扫描检测(Cisco IOS Firewall/Zone-Based):
Router(config)# class-map type inspect PORT_SCAN
Router(config-cmap)# match port eq any# 或指定高危端口(如22,3389)
Router(config)# policy-map type inspect SCAN_POLICY
Router(config-pmap)# class PORT_SCAN
Router(config-pmap-c)# drop# 直接丢弃扫描流量
[*]Huawei/H3C:
# 使用攻击防范策略
firewall defend port-scan enable
firewall defend port-scan threshold 10# 10秒内触发防御的扫描次数
action # 丢弃或记录日志
[*]动态黑名单:
[*]配置自动封禁频繁扫描的IP(如Cisco的ip inspect或Huawei的firewall session相关策略)。
3. ICMP限速配置
原理:防止ICMP泛洪(如Ping of Death)占用带宽。
配置方法:
[*]Cisco:
Router(config)# access-list 101 permit icmp any any echo# 定义ICMP流量
Router(config)# class-map type rate-limit ICMP_CLASS
Router(config-cmap)# match access-group 101
Router(config)# policy-map type rate-limit ICMP_POLICY
Router(config-pmap)# class ICMP_CLASS
Router(config-pmap-c)# police 1000000 100000 conform-action transmit exceed-action drop# 限速1Mbps
[*]Huawei/H3C:
# 全局或接口下限速
interface GigabitEthernet0/0/1
qos car inbound icmp cir 1024# 限制ICMP入方向速率为1Mbps
[*]简化方案:
[*]直接丢弃ICMP(不推荐,可能影响网络诊断):
access-list 102 deny icmp any any
access-list 102 permit ip any any
通用最佳实践
[*]日志与监控:
[*]启用日志记录攻击事件(如logging buffered或info-center log)。
[*]结合SIEM工具分析日志。
[*]ACL过滤:
[*]拒绝来自不可信区域的ICMP/TCP扫描(如deny ip any any在ACL末尾)。
[*]定期更新策略:
[*]根据实际流量调整阈值(如SYN泛洪的threshold值)。
[*]硬件辅助:
[*]高端设备可启用ASIC加速(如Cisco的ip tcp adjust-mss优化MTU)。
验证命令
[*]Cisco:
show ip tcp intercept statistics
show policy-map interface
[*]Huawei:
display firewall statistics
display qos car interface
通过以上配置,可有效缓解SYN泛洪、端口扫描和ICMP攻击的影响。根据实际网络环境调整参数,并定期审查策略有效性。
页:
[1]