原帖由 "wufeiwf"]不管用,我對(duì)iptables只是了解,但是我的理解和txkss一樣,這種方式對(duì)已經(jīng)建立的tcp連接有用嗎?而且我用你的命令試過(guò)了,沒(méi)有斷開(kāi)[/quote 發(fā)表:
你是怎么試的?
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.
原帖由 "wufeiwf"]謝謝樓上的,但是不解決問(wèn)題。不能把server的監(jiān)聽(tīng)進(jìn)程kill,只能把已經(jīng)建立的tcp連接通過(guò)操作系統(tǒng)命令斷開(kāi),一直沒(méi)有找到思路。[/quote 發(fā)表:
[quote]mail:~# netstat -anp | more
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 7886/sshd
tcp 0 52 123.123.123.123:22 192.168.4.145:2946 ESTABLISHED 20183/sshd: ericshe
原帖由 "ericshei" 發(fā)表:
kill 20183 只會(huì)把ESTABLISHED給中斷掉,但原本LISTEN在22 port的sshd還是會(huì)持續(xù)監(jiān)聽(tīng).若這不是您想要的結(jié)果,那就是我會(huì)錯(cuò)意了.
原帖由 "platinum" 發(fā)表:
# sysctl -w net.ipv4.netfilter.ip_conntrack_tcp_timeout_established=600
然后你再試試,應(yīng)該就好了,默認(rèn) TCP 連接癡呆保持是 120 小時(shí),也就是 5 天
這樣就改成 10 分鐘了,數(shù)值可隨你心意去調(diào)
歡迎光臨 Chinaunix (http://www.72891.cn/) | Powered by Discuz! X3.2 |