Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
ip_conntrack shows old and closed connections
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Kim84
n00b
n00b


Joined: 10 Nov 2004
Posts: 8

PostPosted: Wed Nov 10, 2004 1:00 am    Post subject: ip_conntrack shows old and closed connections Reply with quote

Hello.

I am using netstat-nat fairly often for monitoring. As far as I'm aware of, it's a parsing output from the ip_conntrack module (/proc/net/ip_conntrack). After a few days of running, I can see some old connections from computers which are not even online at the time. How can it be? My guess is that it waits for the FIN package and the connections I can see haven't yet sent this one. Am I right about this -- and is there anyway I can fix this?

I am running Gentoo with the gentoo-sources kernel "2.4.26-gentoo-r8".
Back to top
View user's profile Send private message
befa
Apprentice
Apprentice


Joined: 28 Oct 2004
Posts: 208
Location: rennes

PostPosted: Wed Nov 10, 2004 1:36 am    Post subject: Reply with quote

i think the best way to see your ip_conntrack module is to do
Code:

less /proc/net/ip_conntrack

then you type [shift] f to go at the end....and you wait...:lol
or if you just want the 10 last lines you can make
Code:
 tail /proc/net/ip_conntrack


i can't do more....

p.s: sorry for my bad english!;)
_________________
Open Minds! Open Sources! Open Future!
think_tux@jabber.org
Back to top
View user's profile Send private message
Kim84
n00b
n00b


Joined: 10 Nov 2004
Posts: 8

PostPosted: Wed Nov 10, 2004 1:39 am    Post subject: Reply with quote

Sure, but I already have 'netstat-nat' for that. I wish to get rid of the connections, which really aren't there anymore (like the ones i've had the last 4 days, which points to a machine which is turned off) :)
Back to top
View user's profile Send private message
befa
Apprentice
Apprentice


Joined: 28 Oct 2004
Posts: 208
Location: rennes

PostPosted: Wed Nov 10, 2004 1:42 am    Post subject: Reply with quote

in fact i know
Code:
netstat -nat

but no
Code:
netstat-nat
???
_________________
Open Minds! Open Sources! Open Future!
think_tux@jabber.org
Back to top
View user's profile Send private message
Kim84
n00b
n00b


Joined: 10 Nov 2004
Posts: 8

PostPosted: Wed Nov 10, 2004 1:44 am    Post subject: Reply with quote

Oh, take a look at the package "net-misc/netstat-nat" then :)
Back to top
View user's profile Send private message
befa
Apprentice
Apprentice


Joined: 28 Oct 2004
Posts: 208
Location: rennes

PostPosted: Wed Nov 10, 2004 1:48 am    Post subject: Reply with quote

oops sorry...so i post for nothing....excuse me...
_________________
Open Minds! Open Sources! Open Future!
think_tux@jabber.org
Back to top
View user's profile Send private message
Kim84
n00b
n00b


Joined: 10 Nov 2004
Posts: 8

PostPosted: Wed Nov 10, 2004 1:50 am    Post subject: Reply with quote

No problems at all :)
Back to top
View user's profile Send private message
Kim84
n00b
n00b


Joined: 10 Nov 2004
Posts: 8

PostPosted: Thu Nov 11, 2004 12:30 am    Post subject: Reply with quote

Noone knows anything about this at all?
Back to top
View user's profile Send private message
3lithium
n00b
n00b


Joined: 07 Mar 2004
Posts: 54

PostPosted: Thu Nov 11, 2004 9:51 am    Post subject: Reply with quote

Are those ESTABLISHED tcp connections?

ip_conntrack seems to use a ttl of 5 days (432 000 seconds) for those. I think you have to patch iptables if you need to decrease this timeout. It has never been a problem for me though - I've got a few of them but there's plenty of room left for other connections.
Back to top
View user's profile Send private message
Kim84
n00b
n00b


Joined: 10 Nov 2004
Posts: 8

PostPosted: Thu Nov 11, 2004 1:32 pm    Post subject: Reply with quote

> Are those ESTABLISHED tcp connections?

Yes they are.

> ip_conntrack seems to use a ttl of 5 days (432 000 seconds) for those. I think you have to patch iptables if you need to decrease this timeout. It has never been a problem for me though - I've got a few of them but there's plenty of room left for other connections.

Okay, 5 days isn't that bad - as long as they have a ttl in the long run. I currently have about 800 of those connections... I could live with that, but is there another way around fixing this, other than using a lower ttl?
Back to top
View user's profile Send private message
3lithium
n00b
n00b


Joined: 07 Mar 2004
Posts: 54

PostPosted: Thu Nov 11, 2004 2:47 pm    Post subject: Reply with quote

Like you guessed, the connection tracking code is waiting for an indication that the connection has been closed (FIN or RST or whatever). The 5 day ttl is conservative, but it's perfectly possible for a connection to be valid even though no packets have been seen for a couple of days.

If you don't want to lower the timeout you're probably pretty much left with trying to find out why those connections doesn't get closed and doing something about that. If there's a lot of them it might be an indication of a suboptimal configuration elsewhere, or perhaps ill-mannered software being used on the network.
Back to top
View user's profile Send private message
Kim84
n00b
n00b


Joined: 10 Nov 2004
Posts: 8

PostPosted: Thu Nov 11, 2004 2:57 pm    Post subject: Reply with quote

You got a point there -- and thanks for confirming that my guess right. I think it's most likely to be bad software on the network, but in this position, it's nothing I can do anything about.

I have a minor subquestion for this. Is it possible to tell the tracker that some connections aren't being used?

Thanks a lot for your help so far. I really appreciate it.
Back to top
View user's profile Send private message
3lithium
n00b
n00b


Joined: 07 Mar 2004
Posts: 54

PostPosted: Thu Nov 11, 2004 3:08 pm    Post subject: Reply with quote

AFAIK there's no way to kill specific tracked connections.
Back to top
View user's profile Send private message
Kim84
n00b
n00b


Joined: 10 Nov 2004
Posts: 8

PostPosted: Thu Nov 11, 2004 3:19 pm    Post subject: Reply with quote

Okay, thanks a lot for your help :)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum