Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Jason Cosby <sky_jason@yahoo.com>
To: netfilter@vger.kernel.org
Subject: MAC Hash
Date: Fri, 26 Sep 2008 07:21:13 -0700 (PDT)	[thread overview]
Message-ID: <993551.35879.qm@web37301.mail.mud.yahoo.com> (raw)

As far as I can figure out, the following:

iptables -N mymap macipmap
for ip in 192.168.1.`seq 6 75`; do
  for mac in xx:xx:xx:xx:xx....75 MACs; do 
    iptables -A mymap $ip:$mac
    iptables -T mymap $ip -j ACCEPT
  done
done

should yield the same result and be faster than: 

for mac in xx:xx:xx:xx:xx....75 MACs; do
  iptables -t mangle -A PREROUTING -i eth1 -m mac --mac-source \
${mac} -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

but I am not sure of this. The drawback of using the hash is that the MACs must match the IPs in dhcpd.conf, but this can be dealt with. Is there no -m flag before macipmap? Can someone with experience weigh in on this, both concerning speed and correctness? ipset doesn't seem to be what I need here. 

Thanks,
Jason

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

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-26 14:21 Jason Cosby [this message]
  -- strict thread matches above, loose matches on Subject: below --
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

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=993551.35879.qm@web37301.mail.mud.yahoo.com \
    --to=sky_jason@yahoo.com \
    --cc=netfilter@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox