netstat大量time_wait連接


http://chembo.iteye.com/blog/1503770

http://www.2cto.com/os/201007/54067.html

http://blog.csdn.net/dacong/article/details/50485585

 

 主動關閉一方會進入一個TIME_WAIT的中間狀態. 通過netstat 查看到的內容如下:

tcp 0 0 10.19.67.11:40184 10.19.67.11:7012 TIME_WAIT
tcp 0 0 10.19.67.11:39167 10.19.67.11:7012 TIME_WAIT

是 40184的端口主動關閉,處於TIME_WAIT狀態。

 

檢查一下time wait的值:

1 [root@vFStor-1RTqI ~]# sysctl -a | grep time | grep wait
2 net.netfilter.nf_conntrack_tcp_timeout_close_wait = 60
3 net.netfilter.nf_conntrack_tcp_timeout_fin_wait = 120
4 net.netfilter.nf_conntrack_tcp_timeout_time_wait = 120
5 [root@vFStor-1RTqI ~]# 

 

檢查net.ipv4.tcp_tw當前值:

1 [root@vFStor-1RTqI ~]# sysctl -a|grep net.ipv4.tcp_tw
2 net.ipv4.tcp_tw_recycle = 0
3 net.ipv4.tcp_tw_reuse = 0
4 [root@vFStor-1RTqI ~]#

 

修改 /etc/sysctl.conf 配置文件,添加內容。

重新生效sysctl.conf 配置文件:

 1 [root@vFStor-1RTqI ~]# sysctl -p
 2 net.ipv4.ip_forward = 0
 3 net.ipv4.conf.default.rp_filter = 1
 4 net.ipv4.conf.default.accept_source_route = 0
 5 kernel.sysrq = 0
 6 kernel.core_uses_pid = 1
 7 net.ipv4.tcp_syncookies = 1
 8 net.bridge.bridge-nf-call-ip6tables = 0
 9 net.bridge.bridge-nf-call-iptables = 0
10 net.bridge.bridge-nf-call-arptables = 0
11 net.ipv4.tcp_tw_reuse = 1
12 net.ipv4.tcp_tw_recycle = 1

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM