All of lore.kernel.org
 help / color / mirror / Atom feed
From: Josh Nerius <jnerius@gmail.com>
To: Moritz Gartenmeister <moritz@uplink-verein.ch>
Cc: netfilter@lists.netfilter.org
Subject: Re: iptables dnat, ebtables, mark
Date: Wed, 10 Nov 2004 10:22:18 -0600	[thread overview]
Message-ID: <4f3930a704111008222e7650cd@mail.gmail.com> (raw)
In-Reply-To: <419236F6.4060306@uplink-verein.ch>

I have been experimenting with a very similar setup and have found
that in order to DNAT traffic transparently coming through the bridge,
it was necessary to set an ip address on the virtual bridge interface
and appropriate routes.

I haven't needed to use ebtables up to this point...Here is a rule
that I've used that I've had some luck with.

iptables -t nat -I PREROUTING -m physdev --physdev-in $IN_INT -m mac
--mac-source $MAC -j DNAT --to $WEBSERVER

Make sure to properly set the physdev interface. Though this isn't
entirely necessary, I've seen weird things happen without it.

It is important that the site you're DNATing to doesn't require host
headers as this has seemingly caused issues.

Another approach I'm experimenting with is DNATing dns requests
instead to a server set for the purpose of resolving everything to a
particular ip and then dropping all other traffic from that customer
that's not either destined for the dns server or the web server that
you're directing them to.

Let me know if this helps.

Josh Nerius

On Wed, 10 Nov 2004 16:42:46 +0100, Moritz Gartenmeister
<moritz@uplink-verein.ch> wrote:
> hi
> 
> my idea:
> i know the mac-adress from a compromised computer in my lan. i want to redirect all the traffic from
> this computer to a webserver (to show up a page with e.g. "bad guy! you got a virus").
> 
> my system:
> debian testing 2.6.7
> iptables
> ebtables
> bridge-code
> 
> my solution so far:
> ebtables -t nat -A PREROUTING -s $MAC -j mark --set-mark 8 --mark-target CONTINUE
> there are no other rules in this chain.
> some more rules in -A FORWARD all with -s macadress, but not the one above.
> 
> is the only rule in prerouting nat.
> iptables -t nat -A PREROUTING -m mark --mark 0x8 -j DNAT --to-destination $IP-WWW
> 
> is the first role in the mangle chain.
> iptables -t mangle -A PREROUTING -m mark --mark 0x8 -j ACCEPT
> 
> one check rule in mangl POSTROUTING
> iptables -t mangle -A POSTROUTING -m -mark --makr 0x8 -j LOG --log-prefix IPT_MARK
> 
> my problem:
> the user can access the webserver and only this server, but the user is not redirected to the
> web-server, if he tries to access e.g. www.google.com. he only get an error-message.
> 
> my observation:
> number of packets differ...
> ebtables 213 packets
> prerouting mangle 200 packets
> prerouting nat 118 packets
> postrouting mangle 93 packets
> 
> any explanations? the number should be at least the same. i don't understand this. the filter-rules
> seem to work properly...
> 
> cheers
> moritz
> 
> --
> Uplink student association
> Moritz Gartenmeister
> Bülachstrasse 1 F
> 8057 Zürich
> Switzerland
> 
> 


-- 
Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]


  parent reply	other threads:[~2004-11-10 16:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-10 15:42 iptables dnat, ebtables, mark Moritz Gartenmeister
2004-11-10 15:56 ` Jason Opperisano
2004-11-10 16:16   ` Moritz Gartenmeister
2004-11-10 16:22 ` Josh Nerius [this message]
2004-11-15 14:36   ` Moritz Gartenmeister
  -- strict thread matches above, loose matches on Subject: below --
2004-11-10 15:41 Moritz Gartenmeister

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=4f3930a704111008222e7650cd@mail.gmail.com \
    --to=jnerius@gmail.com \
    --cc=moritz@uplink-verein.ch \
    --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 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.