Linux Server Optimization --time_wait Questions:
Check for server time_wait issues:
Netstat-n | awk '/^tcp/{++s[$NF]} END {for (a in S) print A, S[a]} ' return: time_wait 41735close_wait 145fin_wait2 3ESTABLISHED 413
Optimized configuration:
sudo nano/etc/sysctl.conf Add the following: Net.ipv4.tcp_syncookies = 1net.ipv4.tcp_tw_reuse = 1net.ipv4.tcp_tw_recycle = 1net.ipv4.tcp_fin_timeout = 30
Parameters are valid:
/sbin/sysctl-p modification Note: net.ipv4.tcp_syncookies = 1 means that Syn cookies are turned on. When a SYN wait queue overflow occurs, cookies are enabled to protect against a small number of SYN attacks, the default is 0, which means close; Net.ipv4.tcp_tw_reuse = 1 means turn on reuse. Allow time-wait sockets to be reused for new TCP connections, which defaults to 0, which means shutdown, net.ipv4.tcp_tw_recycle = 1 for fast recycling of time-wait sockets on TCP connections, and 0 for shutdown by default. Net.ipv4.tcp_fin_timeout Modify the default timeout time for the system
Time_wait Status Generation:
The port status of the server-side connection is time_wait after the client has established a TCP/IP connection to the server and the socket is closed
The active closed party will enter the TIME_WAIT state to stay 2MSL (max segment lifetime) time after the last ACK is sent
This is necessary for TCP/IP
Linux Server Optimization--time_wait problem