Linux TCP – How to Kill TIME_WAIT Sockets Immediately

linuxsockettcp

Is there anyway to kill those TIME_WAIT sockets immediately ? e.g output of netstat:

tcp        0      0 127.0.0.1:8080          127.0.0.1:41500         TIME_WAIT   -                   
tcp        0      0 127.0.0.1:8080          127.0.0.1:41501         TIME_WAIT   - 

Best Answer

Need not, they're there by reason — «… The purpose of TIME-WAIT is to prevent delayed packets from one connection being accepted by a later connection …»

Linux also has net.ipv4.tcp_tw_recycle and net.ipv4.tcp_tw_reuse which can be helpful. Another tool to mention is linux-tcp-drop

Related Question