当前位置: 首页 > news >正文

DoS Attacks Prevention with TCP Intercept

【实验说明】


 
在路由器上配置,使用 TCP intercept 检查所有TCP连接。

 
【实验拓扑】

 

 

【实验配置】

 
tcp intercept  拦截有两种模式一种是拦截,一种是监视。默认为拦截模式,

 
R1:
interface FastEthernet0/0
ip address 12.1.1.1 255.255.255.0
no sh
ip route 23.1.1.0 255.255.255.0 12.1.1.2

 
R2:
interface FastEthernet0/0
ip address 12.1.1.2 255.255.255.0
interface FastEthernet1/0
ip address 23.1.1.2 255.255.255.0
!首先定义要保护的网络
access-list 199 permit tcp any 23.1.1.0 0.0.0.255 eq telnet
!配置拦截模式,默认为intercept ,还有一种模式为watch
ip tcp intercept mode intercept
!调用访问控制列表
ip tcp intercept list 199
!设置半开连接超时时间,1小时, (默认TCP连接是永远不超时的)
ip tcp intercept connection-timeout 3600
! 设置半开连接的数量限制 low 1200high 1500; 所有半开连接数达到1500后,进入主动模式,主动模式会将所有的超时时间减半,比如上面配置的connection-timeout会由3600s变成1800s。当连接数低于1200时,再恢复正常。
ip tcp intercept max-incomplete low 1200
ip tcp intercept max-incomplete high 1500
!设置丢弃模式为随机,另一种为丢弃模式为oldest ,丢弃老的连接
ip tcp intercept drop-mode random
!开启intercept的debug模式
debug ip tcp intercept
R3:
interface FastEthernet0/0
ip address 23.1.1.3 255.255.255.0
!
ip route 12.1.1.0 255.255.255.0 23.1.1.2

 
------------------------------------------------------说明-------------------------------------------------------
两种模式的对比

intercept

Active mode in which the TCP intercept software intercepts TCP packets from clients to servers that match the configured access list and performs intercept duties. This is the default.

watch

Monitoring mode in which the software allows connection attempts to pass through the router and watches them until they are established.


【实验验证】


 
在R1上telnet R3,建立TCP连接
R1#telnet 23.1.1.3
Trying 23.1.1.3 ... Open

 
User Access Verification

 
在R4上观察debug信息
R4:
*Mar 1 00:12:22.199:  INTERCEPT: new connection (12.1.1.1:21323 SYN -> 23.1.1.3:23)
*Mar 1 00:12:22.203:  INTERCEPT(*): (12.1.1.1:21323 <- ACK+SYN 23.1.1.3:23)
*Mar 1 00:12:22.263:  INTERCEPT: 1st half of connection is established (12.1.1.1:21323 ACK -> 23.1.1.3:23)
*Mar 1 00:12:22.263:  INTERCEPT(*): (12.1.1.1:21323 SYN -> 23.1.1.3:23)
*Mar 1 00:12:22.315:  INTERCEPT: 2nd half of connection established (12.1.1.1:21323 <- ACK+SYN 23.1.1.3:23)
*Mar 1 00:12:22.315: INTERCEPT(*): (12.1.1.1:21323 ACK -> 23.1.1.3:23)
*Mar 1 00:12:22.319: INTERCEPT(*): (12.1.1.1:21323 <- WINDOW 23.1.1.3:23)

 
TCP intercept 模式工作原理
1、客户端发送SYN包
2、中间的路由器伪装自己作为服务器来处理对客户端发送的SYN
3、客户端和路由器建立三次握手之后,证明会话没有问题(若无法形成会话,则丢弃)
4、此时路由器再伪装为客户端向服务器发送SYN包
5、服务器发送SYN/ACK给伪装客户端的路由器
6、伪装客户端的路由器发送ACK给服务器
7、三次握手之后,路由器和服务器也形成了会话,于是客户端和服务器形成会话。

 

 

R2#show tcp intercept connections
Incomplete:
Client Server State Create Timeout Mode

Established:
Client Server State Create Timeout Mode
12.1.1.1:12267 23.1.1.3:23 ESTAB 00:00:15 00:59:56 I

R2#show tcp intercept statistics
Intercepting new connections using access-list 199
0 incomplete, 1 established connections (total 1)
1 connection requests per minute

 


 

----------------------------------------------------------watch 模式的配置---------------------------------------------------
R2:增加
!配置为监听模式
ip tcp intercept watch
!设置监听
ip tcp intercept watch-timeout 15

 
【验证监听模式】
R2(config)#ip tcp intercept watch-timeout
*Mar 1 00:56:50.767: INTERCEPT: new connection (12.1.1.1:61984 SYN -> 23.1.1.3:23)
*Mar 1 00:56:50.871: INTERCEPT: (12.1.1.1:61984 <- ACK+SYN 23.1.1.3:23)
*Mar 1 00:56:50.923: INTERCEPT: (12.1.1.1:61984 ACK -> 23.1.1.3:23)

 

 

 
-------------------------------------------------两种模式的对比--------------------------------
拦截模式,而采取主动的方式处理TCP SYN洪水攻击,watch模式需要一个时间反应的方法。拦截模式的主要优点之一是,它消除内部服务器处理TCP SYN洪水的负载。然而,这是一把双刃剑,因为,在大多数时间内,不会发生TCP SYN洪水,但路由器仍然是执行拦截,它将消耗路由器的负载。
为了缓解这个问题,您可以使用TCP 拦截中的watch模式。watch模式是被动的。在watch模式中,路由器被动地观察从客户端到服务器的TCP连接。它可以通过监视这些连接的超时时间。然后与预先设定的超时值(它默认为30秒)比较。如果一个TCP连接在预设值内没有完成三次握手,思科IOS发送的TCP重置,删除该连接。当服务器受到TCP syn攻击时,它消除了半开连接的数量,从而减少了服务器上的负载,并允许合法的连接尝试处理。
 
 
 

本文转自zcm8483 51CTO博客,原文链接:http://blog.51cto.com/haolun/991729

相关文章:

  • NIOS2随笔——自定义IP(DPRAM)
  • Webpack入门教程十五
  • IPv6, DAD 工作原理详解
  • 解决configure: error: Please reinstall the libcurl distribution
  • tweak 支持第三方库
  • 第十一章 持有对象
  • 条件变量的接口函数和使用原则
  • C# DataGridView中DataGridViewComboBoxCell列,下拉框事件的处理【完美解决】
  • C# 中的枚举类型 enum (属于值类型)
  • jQuery选择器之表单对象属性过滤选择器Demo
  • Cloudera Mountable HDFS (hadoop-fuse-dfs).
  • linux reiserfs文件系统损坏后的数据恢复过程记录
  • 把一个用户的相关权限赋予另外一个用户
  • gets函数的不安性详解
  • Silverlight知识链接整理(11月-12月)
  • [iOS]Core Data浅析一 -- 启用Core Data
  • 【EOS】Cleos基础
  • 【翻译】babel对TC39装饰器草案的实现
  • HTTP--网络协议分层,http历史(二)
  • java概述
  • laravel5.5 视图共享数据
  • Linux中的硬链接与软链接
  • magento2项目上线注意事项
  • Mysql优化
  • PHP 的 SAPI 是个什么东西
  • vue2.0项目引入element-ui
  • 程序员最讨厌的9句话,你可有补充?
  • 解决jsp引用其他项目时出现的 cannot be resolved to a type错误
  • 体验javascript之美-第五课 匿名函数自执行和闭包是一回事儿吗?
  • 通过来模仿稀土掘金个人页面的布局来学习使用CoordinatorLayout
  • 详解NodeJs流之一
  • #设计模式#4.6 Flyweight(享元) 对象结构型模式
  • (14)目标检测_SSD训练代码基于pytorch搭建代码
  • (PWM呼吸灯)合泰开发板HT66F2390-----点灯大师
  • (Python) SOAP Web Service (HTTP POST)
  • (草履虫都可以看懂的)PyQt子窗口向主窗口传递参数,主窗口接收子窗口信号、参数。
  • (附源码)spring boot球鞋文化交流论坛 毕业设计 141436
  • (附源码)ssm跨平台教学系统 毕业设计 280843
  • (剑指Offer)面试题34:丑数
  • (转)我也是一只IT小小鸟
  • .FileZilla的使用和主动模式被动模式介绍
  • .NET Core 中插件式开发实现
  • .NET Framework杂记
  • .NET MVC第三章、三种传值方式
  • .NET/C# 将一个命令行参数字符串转换为命令行参数数组 args
  • .NET开发人员必知的八个网站
  • .NET学习全景图
  • .NET业务框架的构建
  • /*在DataTable中更新、删除数据*/
  • /etc/sudoer文件配置简析
  • @RequestMapping处理请求异常
  • @SuppressWarnings(unchecked)代码的作用
  • [ vulhub漏洞复现篇 ] GhostScript 沙箱绕过(任意命令执行)漏洞CVE-2019-6116
  • [30期] 我的学习方法
  • [autojs]逍遥模拟器和vscode对接