How to kill a tcp connection (active/inactive)

How to kill a tcp connection (active/inactive)

background

Recently, when deploying services in the test environment, there are always port occupancy situations. After checking with netstat/ss, it is found that the port has been occupied all the time.

A tcp connection is established with another ip, similar to this:

 ESTAB 0 0 192.168 .103 .169 : 12345 192.168 .103 .12 : 10261

Of course, this problem is not encountered recently, I have encountered it before, but before this connection disappeared automatically, I can be happy

I use my favorite port 12345, but unfortunately this connection has been there for several days this time, so I have been unable to use this port.

solution process

1. google the answer

Google really told me the answer, there is a tool called tcpkill (you can search it yourself), and immediately download the source code after seeing it

After compiling, follow the prompts to install several real packages and compile them successfully, and then follow the help documentation of tcpkill

 tcpkill -i eth0 src port 12345 and

The post How to kill a tcp connection (active/inactive) first appeared on Lenix Blog .

This article is reprinted from https://blog.p2hp.com/archives/9446
This site is for inclusion only, and the copyright belongs to the original author.

Leave a Comment