Networking Forums

Networking Forums > Computer Networking > Linux Networking > Anyone know how to make the iptables connection tracking table allocation larger?

Reply
Thread Tools Display Modes

Anyone know how to make the iptables connection tracking table allocation larger?

 
 
D. Stussy
Guest
Posts: n/a

 
      05-18-2008, 12:17 AM
I ask because I'm seeing this in my logs:

May 17 03:25:06 (none) kernel: nf_conntrack: table full, dropping packet.
May 17 03:25:08 (none) last message repeated 9 times
May 17 03:25:47 (none) last message repeated 8 times
May 17 03:26:29 (none) kernel: printk: 12 messages suppressed.
May 17 03:26:29 (none) kernel: nf_conntrack: table full, dropping packet.
May 17 03:26:29 (none) last message repeated 7 times
May 17 03:27:09 (none) kernel: printk: 1 messages suppressed.
May 17 03:27:09 (none) kernel: nf_conntrack: table full, dropping packet.
....

Is there some setting in /proc/sys that I can change? If it's a static
value and I have to recompile the kernel, please point me to which file
needs changing....


 
Reply With Quote
 
 
 
 
Larry Finger
Guest
Posts: n/a

 
      05-18-2008, 01:06 AM
D. Stussy wrote:
> I ask because I'm seeing this in my logs:
>
> May 17 03:25:06 (none) kernel: nf_conntrack: table full, dropping packet.
> May 17 03:25:08 (none) last message repeated 9 times
> May 17 03:25:47 (none) last message repeated 8 times
> May 17 03:26:29 (none) kernel: printk: 12 messages suppressed.
> May 17 03:26:29 (none) kernel: nf_conntrack: table full, dropping packet.
> May 17 03:26:29 (none) last message repeated 7 times
> May 17 03:27:09 (none) kernel: printk: 1 messages suppressed.
> May 17 03:27:09 (none) kernel: nf_conntrack: table full, dropping packet.
> ...
>
> Is there some setting in /proc/sys that I can change? If it's a static
> value and I have to recompile the kernel, please point me to which file
> needs changing....
>
>


A little googling seems to indicate that /proc/sys/net/ipv4/ip_conntrack_max
contains the information. To change it to 8192 then

echo "8192" > /proc/sys/net/ipv4/ip_conntrack_max


Larry
 
Reply With Quote
 
David Schwartz
Guest
Posts: n/a

 
      05-18-2008, 04:11 AM
On May 17, 5:17*pm, "D. Stussy" <s...@bde-arc.ampr.org> wrote:
> I ask because I'm seeing this in my logs:
>
> May 17 03:25:06 (none) kernel: nf_conntrack: table full, dropping packet.
> May 17 03:25:08 (none) last message repeated 9 times
> May 17 03:25:47 (none) last message repeated 8 times
> May 17 03:26:29 (none) kernel: printk: 12 messages suppressed.
> May 17 03:26:29 (none) kernel: nf_conntrack: table full, dropping packet.
> May 17 03:26:29 (none) last message repeated 7 times
> May 17 03:27:09 (none) kernel: printk: 1 messages suppressed.
> May 17 03:27:09 (none) kernel: nf_conntrack: table full, dropping packet.
> ...
>
> Is there some setting in /proc/sys that I can change? *If it's a static
> value and I have to recompile the kernel, please point me to which file
> needs changing....


This drove me nuts, as it allows a very simple denial-of-service
attack, even if you raise the number. I eventually wrote a patch to
cause the system to *pass* a packet when the table is full rather than
drop it. Obviously, you don't want to do this if you use connection
tracking for security reasons rather than rate shaping or accounting
reasons.

DS
 
Reply With Quote
 
Grant
Guest
Posts: n/a

 
      05-18-2008, 04:39 AM
On Sun, 18 May 2008 01:06:06 GMT, Larry Finger <(E-Mail Removed)> wrote:

>D. Stussy wrote:
>> I ask because I'm seeing this in my logs:
>>
>> May 17 03:25:06 (none) kernel: nf_conntrack: table full, dropping packet.
>> May 17 03:25:08 (none) last message repeated 9 times
>> May 17 03:25:47 (none) last message repeated 8 times
>> May 17 03:26:29 (none) kernel: printk: 12 messages suppressed.
>> May 17 03:26:29 (none) kernel: nf_conntrack: table full, dropping packet.
>> May 17 03:26:29 (none) last message repeated 7 times
>> May 17 03:27:09 (none) kernel: printk: 1 messages suppressed.
>> May 17 03:27:09 (none) kernel: nf_conntrack: table full, dropping packet.
>> ...
>>
>> Is there some setting in /proc/sys that I can change? If it's a static
>> value and I have to recompile the kernel, please point me to which file
>> needs changing....
>>
>>

>
>A little googling seems to indicate that /proc/sys/net/ipv4/ip_conntrack_max
>contains the information. To change it to 8192 then
>
>echo "8192" > /proc/sys/net/ipv4/ip_conntrack_max


Um, you seem to be out of date? I have default value:

~$ cat /proc/sys/net/ipv4/netfilter/ip_conntrack_max
16384

with:
~$ uname -r
2.6.24.7a

Grant.
--
http://bugsplatter.mine.nu/
 
Reply With Quote
 
Larry Finger
Guest
Posts: n/a

 
      05-18-2008, 03:17 PM
Grant wrote:
> On Sun, 18 May 2008 01:06:06 GMT, Larry Finger <(E-Mail Removed)> wrote:
>
>> D. Stussy wrote:
>>> I ask because I'm seeing this in my logs:
>>>
>>> May 17 03:25:06 (none) kernel: nf_conntrack: table full, dropping packet.
>>> May 17 03:25:08 (none) last message repeated 9 times
>>> May 17 03:25:47 (none) last message repeated 8 times
>>> May 17 03:26:29 (none) kernel: printk: 12 messages suppressed.
>>> May 17 03:26:29 (none) kernel: nf_conntrack: table full, dropping packet.
>>> May 17 03:26:29 (none) last message repeated 7 times
>>> May 17 03:27:09 (none) kernel: printk: 1 messages suppressed.
>>> May 17 03:27:09 (none) kernel: nf_conntrack: table full, dropping packet.
>>> ...
>>>
>>> Is there some setting in /proc/sys that I can change? If it's a static
>>> value and I have to recompile the kernel, please point me to which file
>>> needs changing....
>>>
>>>

>> A little googling seems to indicate that /proc/sys/net/ipv4/ip_conntrack_max
>> contains the information. To change it to 8192 then
>>
>> echo "8192" > /proc/sys/net/ipv4/ip_conntrack_max

>
> Um, you seem to be out of date? I have default value:
>
> ~$ cat /proc/sys/net/ipv4/netfilter/ip_conntrack_max
> 16384
>
> with:
> ~$ uname -r
> 2.6.24.7a


It is memory dependent and set dynamically at boot time. I just gave an
example. BTW, the documentation says that there will be ~350 byles of
non-paged kernel memory for each allowed connection.

Larry
 
Reply With Quote
 
D. Stussy
Guest
Posts: n/a

 
      05-18-2008, 07:51 PM
"Grant" <g_r_a_n_t_@dodo.com.au> wrote in message
news:(E-Mail Removed)...
> On Sun, 18 May 2008 01:06:06 GMT, Larry Finger <(E-Mail Removed)>

wrote:
> >D. Stussy wrote:
> >> I ask because I'm seeing this in my logs:
> >>
> >> May 17 03:25:06 (none) kernel: nf_conntrack: table full, dropping

packet.
> >> May 17 03:25:08 (none) last message repeated 9 times
> >> May 17 03:25:47 (none) last message repeated 8 times
> >> May 17 03:26:29 (none) kernel: printk: 12 messages suppressed.
> >> May 17 03:26:29 (none) kernel: nf_conntrack: table full, dropping

packet.
> >> May 17 03:26:29 (none) last message repeated 7 times
> >> May 17 03:27:09 (none) kernel: printk: 1 messages suppressed.
> >> May 17 03:27:09 (none) kernel: nf_conntrack: table full, dropping

packet.
> >> ...
> >>
> >> Is there some setting in /proc/sys that I can change? If it's a static
> >> value and I have to recompile the kernel, please point me to which file
> >> needs changing....

> >
> >A little googling seems to indicate that

/proc/sys/net/ipv4/ip_conntrack_max
> >contains the information. To change it to 8192 then
> >
> >echo "8192" > /proc/sys/net/ipv4/ip_conntrack_max

>
> Um, you seem to be out of date? I have default value:
>
> ~$ cat /proc/sys/net/ipv4/netfilter/ip_conntrack_max
> 16384
>
> with:
> ~$ uname -r
> 2.6.24.7a


Thank you. Now that I know where to look, I checked and saw this:

$ cat /proc/sys/net/ipv4/netfilter/ip_conntrack_max
65536

Do I already have a maximal value? I guess not, because I was able to set
it to 131072 successfully. However, if internally, a short integer (16
bits) is used, then that won't make a difference. I'm using kernel version
2.6.25.4 - so maybe the defaults are larger.



 
Reply With Quote
 
Pascal Hambourg
Guest
Posts: n/a

 
      05-18-2008, 08:42 PM
Hello,

D. Stussy a écrit :
>
> $ cat /proc/sys/net/ipv4/netfilter/ip_conntrack_max
> 65536
>
> Do I already have a maximal value? I guess not, because I was able to set
> it to 131072 successfully. However, if internally, a short integer (16
> bits) is used, then that won't make a difference.


ip_conntrack_max is an int. 65536 (2^16) would not fit in a short int.
 
Reply With Quote
 
D. Stussy
Guest
Posts: n/a

 
      05-19-2008, 05:03 AM
"Pascal Hambourg" <boite-a-(E-Mail Removed)> wrote in message
news:g0q4b0$1c0q$(E-Mail Removed)...
> Hello,
>
> D. Stussy a écrit :
> >
> > $ cat /proc/sys/net/ipv4/netfilter/ip_conntrack_max
> > 65536
> >
> > Do I already have a maximal value? I guess not, because I was able to

set
> > it to 131072 successfully. However, if internally, a short integer (16
> > bits) is used, then that won't make a difference.

>
> ip_conntrack_max is an int. 65536 (2^16) would not fit in a short int.


That depends on implementation. It's quite possible that such means all
values 0-65535 are in use (so it actually prints the top value +1). This is
a "border value" and therefore suspect. One could still be using a short
int to do indexing into an associative array. That also means that although
it allowed me to set a larger value, that value might not be honored over a
pre-compiled limit.


 
Reply With Quote
 
Larry Finger
Guest
Posts: n/a

 
      05-19-2008, 03:47 PM
D. Stussy wrote:
>
> That depends on implementation. It's quite possible that such means all
> values 0-65535 are in use (so it actually prints the top value +1). This is
> a "border value" and therefore suspect. One could still be using a short
> int to do indexing into an associative array. That also means that although
> it allowed me to set a larger value, that value might not be honored over a
> pre-compiled limit.


In include/net/netfilter/nf_conntrack.h, one finds

extern int nf_conntrack_max


It is a 32-bit integer. As it is signed, you will be limited to roughly 2
billion connections, but I doubt you have that much RAM.

Larry
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
public ip allocation to servers behind isp connection hardware Scott Windows Networking 2 03-31-2008 11:46 AM
PPTPD connection tracking markvr Linux Networking 9 11-30-2006 03:39 PM
IPv6 connection tracking newsposter@carceri.dk Linux Networking 0 09-10-2006 09:45 AM
Is there any problem in my iptables table? jwhan Linux Networking 1 06-12-2004 08:54 AM
iptables "can't initialize iptables table `filter'" pete Linux Networking 1 10-10-2003 03:44 AM



1 2 3 4 5 6 7 8 9 10 11