All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Gáspár Lajos" <swifty@freemail.hu>
To: Brian Austin - Standardknit <brian@standarduniversal.com.au>
Cc: sky_jason@yahoo.com, netfilter@vger.kernel.org
Subject: Re: MAC Hash
Date: Fri, 26 Sep 2008 16:22:28 +0200	[thread overview]
Message-ID: <48DCF024.7040100@freemail.hu> (raw)
In-Reply-To: <48DC332D.5030905@standarduniversal.com.au>

What about this?


iptables -t mangle -N PRE_BR1_MAC
cat /etc/firewall/mac_br1 | sort | grep '+' | while read line
 do
 iptables -t mangle -A PRE_BR1_MAC -j CONNMARK -m mac --mac-source `echo 
$line | awk '{print $1}'` --set-mark $MARK_KNOWN_MAC
 done
iptables -t mangle -A PRE_BR1_MAC -j RETURN -m connmark --mark 
$MARK_KNOWN_MAC

# UNKNOWN MAC !!!
iptables -A PRE_BR1_MAC -j LOG --log-prefix 'IPT: ***MAC BR1*** ' 
--log-level debug
iptables -A PRE_BR1_MAC -j DROP

# Only on BR1 !!!
iptables -t mangle -N PRE_BR1

# CHECK MAC
iptables -t mangle -A PRE_BR1 -j PRE_BR1_MAC -m connmark ! --mark 
$MARK_KNOWN_MAC
iptables -t mangle -A PRE_BR1 -j ACCEPT

iptables -t mangle -A PREROUTING -j PRE_BR1 -i br1



Swifty

Brian Austin - Standardknit írta:
>
> -----Original Message -----
> From: Jason Cosby
> Sent: 26/09/2008 8:18 AM
>> All,
>>
>> I have the following running on our server:
>>
>> for m in xx:xx:xx:xx:xx:xx...about 75 MACs
>> do
>>   iptables -t mangle -A PREROUTING -i eth1 -m mac --mac-source $m -j 
>> ACCEPT
>> done
>>
>> iptables -t mangle -A PREROUTING -i eth1 DROP
>>
>> iptables -t mangle -A PREROUTING -i eth1 -m iprange ! --src-range \
>>    192.168.1.1-192.168.1.74 -j DROP
>>
>> and encountered a noticable slowdown when I incorporated the above. 
>> Can anyone offer suggestions as to how to speed this up? I know that 
>> hash tables are out there, but I am not clear on their use.
>> Thanks,
>> Jason
>> -- 
>> To unsubscribe from this list: send the line "unsubscribe netfilter" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>   
> I would suggest the problem is your chain of 75 rules...
>
> You may want to make some stubby user chains and branch the tests out, 
> so packets go thru less checks.
>
> ie 7 user chains, with 10 checks in each
>
> so the worst case for chain traversal would be around 17 rules 
> traversed, not 75, with an average of 8 rules, not 37....
>
> and put your busiest mac addresses at the top of the checks if you can.
>
> regards
>
> b
>
>
>
>
> -- 
> To unsubscribe from this list: send the line "unsubscribe netfilter" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>


  reply	other threads:[~2008-09-26 14:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-25 22:18 MAC Hash Jason Cosby
2008-09-26  0:56 ` Brian Austin - Standardknit
2008-09-26 14:22   ` Gáspár Lajos [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-09-26 14:21 Jason Cosby

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48DCF024.7040100@freemail.hu \
    --to=swifty@freemail.hu \
    --cc=brian@standarduniversal.com.au \
    --cc=netfilter@vger.kernel.org \
    --cc=sky_jason@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.