Skip to contentSkip to conversation

conntrack too eager to track everything

DISCUSSION Nadav Har'El 2 participants 2 messages Feb 16, 2003

lore
Share & tools
lore
#0 lore raw

In a transparent-proxy-like application, I'm redirecting connections forwarded through the machine and destined to some port (say, 80) into a local port.
Tracking these NATed connections by conntrack is obviously necessary, so the ip_conntrack modules needs to be run.

However, in some cases most of the connections (as much as 100%) that pass through the computer, or originate in it, or a destined to it, have nothing to do with these NATed connections. There is absolutely no reason to track these other connections, as no iptables filters, NAT, or anything else will ever affect them.

So I was wondering, is there a way for me to configure ip_conntrack (or modify its code) not to track any connections except those explictly created by netfilter while doing NAT?

Note that what bothers me isn't only the issue of time wasted while needlessly tracking connections - it's more the space issue of the space needed to track all these (potentially, hundreds of thousands) connections, and what happens when the connection tracking hash-tables gets filled up.

I'd be greatful for any hints or pointers,

Nadav.

Signature · 4 lines
Nadav Har'El                        |      Sunday, Feb 16 2003, 14 Adar I 5763
[email protected]             |-----------------------------------------
Phone: +972-53-245868, ICQ 13349191 |A messy desk is a sign of a messy mind.
http://nadav.harel.org.il           |An empty desk is a sign of an empty mind.
#1 lore raw
Quoted 16 lines · Nadav Har'El

In a transparent-proxy-like application, I'm redirecting connections forwarded through the machine and destined to some port (say, 80) into a local port.
Tracking these NATed connections by conntrack is obviously necessary, so the ip_conntrack modules needs to be run.

However, in some cases most of the connections (as much as 100%) that pass through the computer, or originate in it, or a destined to it, have nothing to do with these NATed connections. There is absolutely no reason to track these other connections, as no iptables filters, NAT, or anything else will ever affect them.

So I was wondering, is there a way for me to configure ip_conntrack (or modify its code) not to track any connections except those explictly created by netfilter while doing NAT?

Quoted 6 lines

Note that what bothers me isn't only the issue of time wasted while needlessly tracking connections - it's more the space issue of the space needed to track all these (potentially, hundreds of thousands) connections, and what happens when the connection tracking hash-tables gets filled up.

I'd be greatful for any hints or pointers,

Apply the raw.path from the userspace/ directory in patch-o-matic and then use the NOTRACK target in table raw and chain PREROUTING to tell conntrack what packets not to track.
It also contains a patch against the userspace iptables to get support for the NOTRACK (and TRACE) targets. I'm not sure how well patch-o-matic can apply userspace patches right now... (you can always patch that part manually with patch)

example:

iptables -t raw -A PREROUTING -p tcp --dport \! 80 -j NOTRACK

I hope that helps.

Signature · 3 lines
/Martin

Never argue with an idiot. They drag you down to their level, then beat you with experience.