Operating System - Linux
1819702 Members
3255 Online
109605 Solutions
New Discussion юеВ

Re: How to kill a tcp connection

 
SOLVED
Go to solution
Daniel Ubeda
Frequent Advisor

How to kill a tcp connection

Hi,

I need to kill several tcp connections in linux RH 8 and 9.
Are there any command to do this ?

thanks
Daniel
4 REPLIES 4
Steven E. Protter
Exalted Contributor

Re: How to kill a tcp connection

If the process id's or names are identifyable, you can use the utility I'm attaching to kill the processes.

Its a hpux script and will require adaptation.

You should also consider setting up iptables to block certain ports if you want to stop these tcp connections permanently.


http://www.linuxguruz.com/iptables/howto/iptables-HOWTO.html

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Daniel Ubeda
Frequent Advisor

Re: How to kill a tcp connection

I can't identify the process because is a broken connection, and I can view it with netstat -na

bye
Daniel
Dave Falloon
Trusted Contributor
Solution

Re: How to kill a tcp connection

if you add a -p to your netstat command:

netstat -anp the running command may show up in the last column

what state is the port in?

if it is in fin_wait2 then you may have to do something drastic. I usually restart my network device to clear these

Dave
Clothes make the man, Naked people have little to no effect on society
Steven E. Protter
Exalted Contributor

Re: How to kill a tcp connection

service network restart

will restart the network for your verison of redhat.

If this or other posts have been useful, please assign points.
SEP
forums ettiquette:
http://66.34.90.71/ITRCForumsEtiquette/
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com