我有一个被我需要杀死的进程阻止的端口. (一个崩溃的小telnet守护进程).
该进程已成功终止,但该端口仍处于“FIN_WAIT1”状态.它没有出来,它的超时似乎被设置为“十年”.
该进程已成功终止,但该端口仍处于“FIN_WAIT1”状态.它没有出来,它的超时似乎被设置为“十年”.
我发现释放端口的唯一方法是重启整个机器,这是我不想做的事情.
$netstat -tulnap | grep FIN_WAIT1 tcp 0 13937 10.0.0.153:4000 10.0.2.46:2572 FIN_WAIT1 -
有没有人知道如何在不重新启动的情况下解锁此端口?
解决方法
# record what tcp_max_orphans's current value original_value=$(cat /proc/sys/net/ipv4/tcp_max_orphans) #set the tcp_max_orphans to 0 temporarily echo 0 > /proc/sys/net/ipv4/tcp_max_orphans # watch /var/log/messages # it will split out "kernel: TCP: too many of orphaned sockets" # it won't take long for the connections to be killed # restore the value of tcp_max_orphans whatever it was before. echo $original_value > /proc/sys/net/ipv4/tcp_max_orphans # verify with netstat -an|grep FIN_WAIT1