I'm trying to come up with a way to load the spamhaus IP lists and
various other IP lists into my firewall to knock out a lot of spam and
crap that we get hit with. Our setup is a Debian woody box with kernel
2.4.25, iptables v1.2.9, bridge-utils 0.9.6, and the
ebtables-brnf-5_vs_2.4.25 patch. Hardware is a 2.4ghz Dell Optiplex
using built-in gigabit Intel and also an Intel Pro/100, however, the
outside interface is set at 10mbit so it's not a whole heck of a lot
of traffic.
We're bridging the two interfaces and I'm firewalling using the
Forward tables mostly. The rules are set to jump to a special SPAM
table with all of the DROP statements. It's only jumping to this table
for port 80/tcp, 53/tcp and 53/udp traffic. I dynamically load each
spam network (from /8's to /32's) at rule load and only after I check
that the list has been updated locally. At the end of the SPAM rule is
an accept to allow the traffic to pass.
The spam tables have about 3000-something rules in them right now and
it takes a little bit to load but seems to be doing okay. It uses a
bit of memory but it's nothing bad.
The other day the ruleset grew to 12,000 lines and it started loading
VERY slowly. iptables seems to not like it when you go over 5000 lines
or more.

I decided to break the spam table out into supernets
(1.x.x.x, 2.x.x.x, etc) and load rules based on the first digits, but
that just increased my rule count and didn't really do anything
useful. One side-effect of all of this is my memory usage went through
the roof. Something like 300 megs or whatever unaccounted for in top
(I just assume in the kernel).
Is there a better way to accomplish what I want? We really do get hit
with a lot of traffic from these bozos and aren't too concerned about
false positives. I just want to decrease traffic and noise on my
boxes.
We're not routing, just bridging so I can't load up BGP and null-route
them all.
If anyone has any ideas, please let me know.. Thanks