Killing Active Connections
This is a real newbie question but I can't figure out how to do it. When I run netstat -a I see the active connections. How would you terminate one of those connections?
tcp 0 0 192.168.0.100:34887 unknown.Level3.net:http ESTABLISHED tcp 0 0 192.168.0.100:34888 unknown.Level3.net:http ESTABLISHED tcp 0 0 192.168.0.100:34479 64.12.24.137:5190 ESTABLISHED tcp 0 0 192.168.0.100:34886 unknown.Level3.net:http ESTABLISHED tcp 0 0 192.168.0.100:34883 unknown.Level3.net:http ESTABLISHED tcp 0 0 192.168.0.100:34894 216.151.201.137:http ESTABLISHED tcp 0 0 192.168.0.100:34893 216.151.201.137:http ESTABLISHED tcp 0 0 192.168.0.100:34906 65.122.104.1:ircd ESTABLISHED I don't know what those "unknown.Level3.net:http" connections are. Obviously it is an http connection but I want to kill them. How is it done? |
Do these persist?
What other applications are running? Was your browser open? |
No they go away eventually but I just want to know if there is a command to stop a specific connection.
|
The only way you can kill a connection is by killing the pid that is owning/using the socket that the connection goes through.
netstat -ntlapee ( as root ) will display the PID/program name that owns the socket. See netstat man page for more info. |
I wonder how to kill, processes without a pid? Is this possible? killing the actual connecting rather than the program at which the connection is using?
xx.xxx.xxx.xx:smtp xx.xxx.xxx.xx:7844 TIME_WAIT - Sometimes I see no pid. |
If you dont see a PID, you may have to do some guesswork looking at the TCP ports at the local and remote IPs . In your case it looks like a TCP connection to your SMTP server from a temporary port in a remote machine. Restart your SMTP server and it will be gone, if you just want to play with it. Generally speaking, if you start doing this to kill connections that are usually kept alive, you'd be engaged all day :)
|
All times are GMT -5. The time now is 01:52 PM. |