<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Improving Snort_inline&#8217;s NFQ performance</title>
	<atom:link href="http://www.inliniac.net/blog/2008/01/23/improving-snort_inlines-nfq-performance.html/feed" rel="self" type="application/rss+xml" />
	<link>http://www.inliniac.net/blog/2008/01/23/improving-snort_inlines-nfq-performance.html</link>
	<description>Everything inline.</description>
	<pubDate>Mon, 08 Sep 2008 10:42:20 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.1</generator>
		<item>
		<title>By: Dave R</title>
		<link>http://www.inliniac.net/blog/2008/01/23/improving-snort_inlines-nfq-performance.html#comment-10938</link>
		<dc:creator>Dave R</dc:creator>
		<pubDate>Tue, 12 Feb 2008 23:24:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.inliniac.net/blog/2008/01/23/improving-snort_inlines-nfq-performance.html#comment-10938</guid>
		<description>You're right - I'd forgotten that you can do it that way. Actually, I expose the queue_max in /sys, so I just change it once and forget it 8-).</description>
		<content:encoded><![CDATA[<p>You&#8217;re right - I&#8217;d forgotten that you can do it that way. Actually, I expose the queue_max in /sys, so I just change it once and forget it 8-).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Victor Julien</title>
		<link>http://www.inliniac.net/blog/2008/01/23/improving-snort_inlines-nfq-performance.html#comment-10926</link>
		<dc:creator>Victor Julien</dc:creator>
		<pubDate>Mon, 11 Feb 2008 14:11:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.inliniac.net/blog/2008/01/23/improving-snort_inlines-nfq-performance.html#comment-10926</guid>
		<description>Thanks for your explanations Dave. I think the number of outstanding packets nfqueue can deal with can also be changed with the –queue-maxlen option. It uses the nfq_set_queue_maxlen() call for that...</description>
		<content:encoded><![CDATA[<p>Thanks for your explanations Dave. I think the number of outstanding packets nfqueue can deal with can also be changed with the –queue-maxlen option. It uses the nfq_set_queue_maxlen() call for that&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave R</title>
		<link>http://www.inliniac.net/blog/2008/01/23/improving-snort_inlines-nfq-performance.html#comment-10919</link>
		<dc:creator>Dave R</dc:creator>
		<pubDate>Sun, 10 Feb 2008 23:14:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.inliniac.net/blog/2008/01/23/improving-snort_inlines-nfq-performance.html#comment-10919</guid>
		<description>D'oh! Forgot to mention the other side of the max packets on a queue versus memory conundrum.... The number of packets allowed to be outstanding on a netfilter_queue. Which is 1024. So.... Which ever you run into first (max packets outstanding) or out of memory to put 'em in is what bites... 

To change the number of outstanding packets on an NFQUEUE isn't as easy as a sysctl -w, though - you need to modify nfnetfilter_queue.c and recompile it to change the value:

#define NFQNL_QMAX_DEFAULT 1024

Here's one way to look at it - each outstanding packet takes up one of the above QMAX spots, and some amount of memory. If your acerage traffic is 600 bytes in size, you can use up something like 650K (I think there's a little overhead per packet) of memory. For full size TCP streams and acks the average packet size is more like 1100, so you're looking at more like 1.2MB of buffer. If you're using jumbo packets, order more RAM now 8-).

What you're trying to buy by adjusting the QMAX and rmem_default settings upward is breathing space for snort, when that new PCRE rule you wrote this afternoon takes waaaaaaayyyyyy longer to match than you thought it would, or you just get slammed with a DOS attack....</description>
		<content:encoded><![CDATA[<p>D&#8217;oh! Forgot to mention the other side of the max packets on a queue versus memory conundrum&#8230;. The number of packets allowed to be outstanding on a netfilter_queue. Which is 1024. So&#8230;. Which ever you run into first (max packets outstanding) or out of memory to put &#8216;em in is what bites&#8230; </p>
<p>To change the number of outstanding packets on an NFQUEUE isn&#8217;t as easy as a sysctl -w, though - you need to modify nfnetfilter_queue.c and recompile it to change the value:</p>
<p>#define NFQNL_QMAX_DEFAULT 1024</p>
<p>Here&#8217;s one way to look at it - each outstanding packet takes up one of the above QMAX spots, and some amount of memory. If your acerage traffic is 600 bytes in size, you can use up something like 650K (I think there&#8217;s a little overhead per packet) of memory. For full size TCP streams and acks the average packet size is more like 1100, so you&#8217;re looking at more like 1.2MB of buffer. If you&#8217;re using jumbo packets, order more RAM now 8-).</p>
<p>What you&#8217;re trying to buy by adjusting the QMAX and rmem_default settings upward is breathing space for snort, when that new PCRE rule you wrote this afternoon takes waaaaaaayyyyyy longer to match than you thought it would, or you just get slammed with a DOS attack&#8230;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave R</title>
		<link>http://www.inliniac.net/blog/2008/01/23/improving-snort_inlines-nfq-performance.html#comment-10871</link>
		<dc:creator>Dave R</dc:creator>
		<pubDate>Tue, 05 Feb 2008 16:17:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.inliniac.net/blog/2008/01/23/improving-snort_inlines-nfq-performance.html#comment-10871</guid>
		<description>The line
   sysctl -w net.core.rmem_default=’8388608′
tells the kernel to allow up to 8388608 bytes worth of (received) packets to be queued for every open socket in the system. It's dynamically allocated from free memory (Low Memory on 32 bit kernels). You *don't* want to run out of Low Memory on a 32 bit kernel... (cat /proc/meminfo).  Bad things happen - the OOM killer goes on a rampage, and random process get killed (unless protected against OOM killing (echo "-17" &#62; /proc/pid/oom_adj)).

So the buffer sizes allocated have to be weighed against the possibility that under duress, the kernel will have too much memory used up in outstanding receive buffers, and start freeing things up in an unpleasant manner. Tuning the kernel for these condtions is an art, not a science...</description>
		<content:encoded><![CDATA[<p>The line<br />
   sysctl -w net.core.rmem_default=’8388608′<br />
tells the kernel to allow up to 8388608 bytes worth of (received) packets to be queued for every open socket in the system. It&#8217;s dynamically allocated from free memory (Low Memory on 32 bit kernels). You *don&#8217;t* want to run out of Low Memory on a 32 bit kernel&#8230; (cat /proc/meminfo).  Bad things happen - the OOM killer goes on a rampage, and random process get killed (unless protected against OOM killing (echo &#8220;-17&#8243; &gt; /proc/pid/oom_adj)).</p>
<p>So the buffer sizes allocated have to be weighed against the possibility that under duress, the kernel will have too much memory used up in outstanding receive buffers, and start freeing things up in an unpleasant manner. Tuning the kernel for these condtions is an art, not a science&#8230;</p>
]]></content:encoded>
	</item>
</channel>
</rss>
