免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12345下一页
最近访问板块 发新帖
查看: 29307 | 回复: 47

如何将一个已经创建TCP连接断开? [复制链接]

论坛徽章:
0
发表于 2005-08-10 18:54 |显示全部楼层
在liunx环境下用netstat看到的ESTABLISHED的连接如何用系统命令强制断开?
例如,下面如何将10.103.4.40的这个tcp连接断开?
[root@/root]# netstat -na|grep 7600
tcp        0      0 0.0.0.0:7600            0.0.0.0:*               LISTEN
tcp        0      0 10.103.4.3:7600         192.168.0.122:1110      SYN_RECV
tcp        0      0 10.103.4.3:7600         10.103.4.40:1366        ESTABLISHED

论坛徽章:
0
发表于 2005-08-10 19:26 |显示全部楼层

如何将一个已经创建TCP连接断开?

# iptables -I INPUT -s 10.103.4.40 -m state --state NEW,RELATED,ESTABLISHED -j DROP

论坛徽章:
0
发表于 2005-08-10 21:16 |显示全部楼层

如何将一个已经创建TCP连接断开?

楼上的老哥

可是那个tcp连接已经建立了

我们再写那个防火墙记录还有用吗?

论坛徽章:
0
发表于 2005-08-10 21:38 |显示全部楼层

如何将一个已经创建TCP连接断开?

用netstat -anp去看,然後kill pid如何?

论坛徽章:
0
发表于 2005-08-10 22:42 |显示全部楼层

如何将一个已经创建TCP连接断开?

谢谢楼上的,但是不解决问题。不能把server的监听进程kill,只能把已经建立的tcp连接通过操作系统命令断开,一直没有找到思路。

论坛徽章:
0
发表于 2005-08-10 23:14 |显示全部楼层

如何将一个已经创建TCP连接断开?

[quote]原帖由 "wufeiwf"]谢谢楼上的,但是不解决问题。不能把server的监听进程kill,只能把已经建立的tcp连接通过操作系统命令断开,一直没有找到思路。[/quote 发表:

我上面写的不能解决问题吗?

论坛徽章:
0
发表于 2005-08-10 23:30 |显示全部楼层

如何将一个已经创建TCP连接断开?

不管用,我对iptables只是了解,但是我的理解和txkss一样,这种方式对已经建立的tcp连接有用吗?而且我用你的命令试过了,没有断开

论坛徽章:
0
发表于 2005-08-10 23:34 |显示全部楼层

如何将一个已经创建TCP连接断开?

对了,我怎么把刚才加的这条防火墙记录给删除?

论坛徽章:
0
发表于 2005-08-10 23:37 |显示全部楼层

如何将一个已经创建TCP连接断开?

原帖由 "wufeiwf"]不管用,我对iptables只是了解,但是我的理解和txkss一样,这种方式对已经建立的tcp连接有用吗?而且我用你的命令试过了,没有断开[/quote 发表:

你是怎么试的?
man iptables
[quote]
   state
       This module, when combined with connection tracking, allows  access  to
       the connection tracking state for this packet.

       --state state
              Where  state  is a comma separated list of the connection states
              to match.  Possible states are INVALID meaning that  the  packet
              could  not  be identified for some reason which includes running
              out of memory and ICMP errors  which  don't  correspond  to  any
              known connection, ESTABLISHED meaning that the packet is associ-
              ated with a connection which has seen  packets  in  both  direc-
              tions, NEW meaning that the packet has started a new connection,
              or otherwise associated with a connection  which  has  not  seen
              packets  in both directions, and RELATED meaning that the packet
              is starting a new connection, but is associated with an existing
              connection, such as an FTP data transfer, or an ICMP error.

论坛徽章:
0
发表于 2005-08-11 00:01 |显示全部楼层

如何将一个已经创建TCP连接断开?

直接用你给的命令试的,其实这条tcp连接早已经断开(客户端已经退出),但是系统一直显示这条connection是ESTABLISHED状态,而且很长时间都是这样(两天),我想用操作系统命令将次状态清除。
对了,如何删除这条防火墙记录?这条防火墙记录已经起作用了10.103.4.40已经从这台服务器上ping不通了。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP