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

This is a discussion on Anyone know how to make the iptables connection tracking table allocation larger? within the Linux Networking forums, part of the Linux Forums category; I ask because I'm seeing this in my logs: May 17 03:25:06 (none) kernel: nf_conntrack: table full, ...


Go Back   Usenet Forums > Linux Forums > Linux Networking

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-18-2008
D. Stussy
 
Posts: n/a
Default Anyone know how to make the iptables connection tracking table allocation larger?

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
  #2 (permalink)  
Old 05-18-2008
Larry Finger
 
Posts: n/a
Default Re: Anyone know how to make the iptables connection tracking tableallocation larger?

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
  #3 (permalink)  
Old 05-18-2008
David Schwartz
 
Posts: n/a
Default Re: Anyone know how to make the iptables connection tracking tableallocation larger?

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
  #4 (permalink)  
Old 05-18-2008
Grant
 
Posts: n/a
Default Re: Anyone know how to make the iptables connection tracking table allocation larger?

On Sun, 18 May 2008 01:06:06 GMT, Larry Finger <Larry.Finger@lwfinger.net> 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
  #5 (permalink)  
Old 05-18-2008
Larry Finger
 
Posts: n/a
Default Re: Anyone know how to make the iptables connection tracking tableallocation larger?

Grant wrote:
> On Sun, 18 May 2008 01:06:06 GMT, Larry Finger <Larry.Finger@lwfinger.net> 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
  #6 (permalink)  
Old 05-18-2008
D. Stussy
 
Posts: n/a
Default Re: Anyone know how to make the iptables connection tracking table allocation larger?

"Grant" <g_r_a_n_t_@dodo.com.au> wrote in message
news:ricv24h2unolaf7804ttsmlg8nuq8uibiq@4ax.com...
> On Sun, 18 May 2008 01:06:06 GMT, Larry Finger <Larry.Finger@lwfinger.net>

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
  #7 (permalink)  
Old 05-18-2008
Pascal Hambourg
 
Posts: n/a
Default Re: Anyone know how to make the iptables connection tracking tableallocation larger?

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
  #8 (permalink)  
Old 05-19-2008
D. Stussy
 
Posts: n/a
Default Re: Anyone know how to make the iptables connection tracking table allocation larger?

"Pascal Hambourg" <boite-a-spam@plouf.fr.eu.org> wrote in message
news:g0q4b0$1c0q$1@biggoron.nerim.net...
> 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
  #9 (permalink)  
Old 05-19-2008
Larry Finger
 
Posts: n/a
Default Re: Anyone know how to make the iptables connection tracking tableallocation larger?

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 Search this Thread
Search this Thread:

Advanced Search
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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 04:11 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0