LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 06-25-2010, 06:25 AM   #1
davinder31may
LQ Newbie
 
Registered: Jun 2010
Posts: 3

Rep: Reputation: 0
Post How to kill a TCP connection which has status TIME_WAIT & no PID


Hi,

I want to kill TCP connections which have status as TIME_WAIT & no PID

(as per the output of the "netstat - p" command).

The problem is that these connections don't have process ID (see below).
====================================================================
[remedy@CNDAUNREDBOP13 ~]$ netstat -p |grep 56000
tcp 0 0 CNDAUNREDBOP13:59388 10.5.45.39:56000 TIME_WAIT -
tcp 0 0 CNDAUNREDBOP13:59389 10.5.45.39:56000 TIME_WAIT -
tcp 0 0 CNDAUNREDBOP13:59390 10.5.45.39:56000 TIME_WAIT -
tcp 0 0 CNDAUNREDBOP13:59385 10.5.45.39:56000 TIME_WAIT -
tcp 0 0 CNDAUNREDBOP13:59386 10.5.45.39:56000 TIME_WAIT -
tcp 0 0 CNDAUNREDBOP13:59411 10.5.45.39:56000 TIME_WAIT -
====================================================================
 
Old 06-25-2010, 07:26 AM   #2
g33ky
Member
 
Registered: Jun 2010
Location: France
Distribution: openSUSE 11.2, (B)LFS, Mepis, Linux Mint 9
Posts: 30

Rep: Reputation: 17
Hi,

Just check if it's not a software service running, sub-service, or hiddent software listener linked to an application or such.
 
Old 06-25-2010, 07:46 AM   #3
TimothyEBaldwin
Member
 
Registered: Mar 2009
Posts: 249

Rep: Reputation: 27
They are closed. The TIME-WAIT state is a precaution against connections being reopened by old duplicate packets, or new connections being corrupted.
 
Old 06-25-2010, 09:45 AM   #4
vishesh
Member
 
Registered: Feb 2008
Distribution: Fedora,RHEL,Ubuntu
Posts: 661

Rep: Reputation: 66
Try
netstat -a -n -t and check that what is Local address and Foreign address of those connection and investigate further.
 
Old 06-28-2010, 03:01 AM   #5
davinder31may
LQ Newbie
 
Registered: Jun 2010
Posts: 3

Original Poster
Rep: Reputation: 0
Hi,

I know which application is leavig these open connections.It is actually a shell script file that picks up data from one server & sends it to another server.

Since these connections are not having any pid, i cant kill these connections.
These connections are also not shown as the output of "lsof -i tcp:56000" command.

Can i put a timeout interval for these TIME_WAIT connections?
 
Old 06-28-2010, 07:02 AM   #6
vishesh
Member
 
Registered: Feb 2008
Distribution: Fedora,RHEL,Ubuntu
Posts: 661

Rep: Reputation: 66
You change change tcp keepalive using following command
echo 2300 > /proc/sys/net/ipv4/tcp_keepalive_time

thanks
 
Old 06-28-2010, 04:51 PM   #7
TimothyEBaldwin
Member
 
Registered: Mar 2009
Posts: 249

Rep: Reputation: 27
Quote:
Originally Posted by davinder31may View Post
Can i put a timeout interval for these TIME_WAIT connections?
There is a timeout of 4 minutes. From you description it is working perfectly, what problem are you having?
 
Old 06-28-2010, 04:57 PM   #8
TimothyEBaldwin
Member
 
Registered: Mar 2009
Posts: 249

Rep: Reputation: 27
Quote:
Originally Posted by vishesh View Post
You change change tcp keepalive using following command
echo 2300 > /proc/sys/net/ipv4/tcp_keepalive_time
Which not what was asked.
 
Old 06-29-2010, 12:40 AM   #9
davinder31may
LQ Newbie
 
Registered: Jun 2010
Posts: 3

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by TimothyEBaldwin View Post
There is a timeout of 4 minutes. From you description it is working perfectly, what problem are you having?
My main concern is tcp connections with status as "TIME_WAIT" which i dont want.
 
Old 06-29-2010, 01:11 PM   #10
TimothyEBaldwin
Member
 
Registered: Mar 2009
Posts: 249

Rep: Reputation: 27
Quote:
Originally Posted by davinder31may View Post
My main concern is tcp connections with status as "TIME_WAIT" which i dont want.
Do you really want to destroy the reliability of TCP? Read RFC 1337 for some examples of what can go wrong if you get rid the TIME-WAIT state.
 
  


Reply

Tags
connection, connections, kill, reset, tcp


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
TCP Stack and Netstat: Could having lots of TIME_WAIT connection slow down the server helptonewbie Linux - Networking 7 06-20-2012 02:48 PM
pls tell difference between waitpid(pid,&status,0) and waitpid(pid,&status,WNOHANG) nagendrar Linux - Newbie 3 07-08-2009 09:51 PM
how do i kill a tcp connection sunlinux Linux - Security 1 08-24-2007 08:33 AM
how to kill tcp connection that nothing is going on the socket yuvalbm Linux - Networking 3 11-07-2006 08:32 AM
tcp connection and interface status vasanthbp Linux - Networking 7 07-04-2006 03:38 AM


All times are GMT -5. The time now is 01:05 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration