From: Jason Opperisano <opie@817west.com>
To: netfilter@lists.netfilter.org
Subject: Re: A secure router, by MAC address
Date: Wed, 20 Oct 2004 16:39:53 -0400 [thread overview]
Message-ID: <20041020203953.GA7940@bender.817west.com> (raw)
In-Reply-To: <1098297965.5686.9.camel@6-allhosts>
On Wed, Oct 20, 2004 at 12:46:06PM -0600, jgalvez@webpipe.net wrote:
> I am trying to setup a router, that forwards traffic from one interface
> for only a specific set of MAC addresses.
>
> Users on eth1 side will use a static IP address with a known MAC
> address. DHCP will be running on eth1 for rogue users. If the source IP
> is 10.0.0.0/8 all port 80 traffic needs to be redirected to localhost
> port 80. ONLY traffic from a listed IP and MAC should be allowed to be
> forwarded out.
# create new chain to mark known MAC/IP pairs
iptables -t mangle -N mark_known_hosts
# go to that chain first
iptables -t mangle -A PREROUTING -i eth1 -j mark_known_hosts
# mark known MAC/IP pairs
iptables -t mangle -A mark_known_hosts -m mac --mac-source XX:XX:XX:XX:XX:XX \
-s w.x.y.z -j MARK --set-mark 1
# redirect unmarked 10.0.0.0/8 port 80 traffic to localhost
iptables -t nat -A PREROUTING -i eth1 -p tcp --syn -s 10.0.0.0/8 \
--dport 80 -m mark ! --mark 1 -j REDIRECT --to-port 80
# allow unmarked 10.0.0.0/8 port 80 traffic to localhost
iptables -A INPUT -i eth1 -p tcp --syn -s 10.0.0.0/8 \
--dport 80 -m mark ! --mark 1 -j ACCEPT
# allow marked traffic to be forwarded out
iptables -A FORWARD -i eth1 -m mark --mark 1 -j ACCEPT
this example only points out the general concept--this is (obviously)
not a complete firewall ruleset--but should point you in one of many
"right" directions.
-j
--
Jason Opperisano <opie@817west.com>
prev parent reply other threads:[~2004-10-20 20:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-20 18:46 A secure router, by MAC address jgalvez
2004-10-20 19:12 ` Eric Leblond
2004-10-20 19:28 ` jgalvez
2004-10-20 20:23 ` Eric Leblond
2004-10-20 20:39 ` Jason Opperisano [this message]
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=20041020203953.GA7940@bender.817west.com \
--to=opie@817west.com \
--cc=netfilter@lists.netfilter.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