Killing tcp connection in linux

tcp

I have some dead connection in one application which is in hanged state if client machine is dead.

->192.168.1.214:49029 (ESTABLISHED)

Is there a way to terminate these option from linux command line without restarting the server?

After search I found solution called as tcpkill. But it will not work for me. As it permanently blocks that ip.

Best Answer

On linux kernel >= 4.9 you can use the ss command from iproute2 with key -K

ss -K dst 192.168.1.214 dport = 49029

the kernel have to be compiled with CONFIG_INET_DIAG_DESTROY option enabled.

Related Question