Linux Netfilter discussions
 help / color / mirror / Atom feed
From: "Javier Prieto Martínez" <javier.prieto.ext@juntadeandalucia.es>
To: netfilter@vger.kernel.org
Subject: Redirecting ports in a bridge
Date: Fri, 18 Apr 2008 11:27:44 +0200	[thread overview]
Message-ID: <48086990.5060000@juntadeandalucia.es> (raw)

Hi.
I have a linux appliance from Eneo Tech. 
(http://www.eneotecnologia.com/) with the following setup:

   (192.168.1.x)        
192.168.1.7                                                     ---- 
SERVER1 192.168.2.1
    [ LAN1 ] ----------- [ ROUTER ] ---------- [ APPLIANCE ] -------- [ 
LAN 2 ] --------|
                        192.168.2.7            192.168.2.140        
(192.168.2.x)       ---- SERVER2 192.168.2.2

The appliance has 4 ethernet cards, and a br0 bridge which includes all 
them. ETH2 is connected to the router, ETH3 is connected to LAN2, and 
BR0 has an IP address of LAN2.

Now, I want to redirect all HTTP traffic going to SERVER1, to the same 
port SERVER2.

I've tried the following rule:

    iptables -t nat -A PREROUTING -p tcp -d 192.168.2.1 --dport 80 
--to-destination 192.168.2.2:80 -j DNAT


The redirection seems to be working, as far as I've seen with tcpdump on 
SERVER2, but I'm not able to make a connection.

I have two suppositions:

    1) I have to SNAT the response. I've tried that rule:
    iptables -t nat -A POSTROUTING -p tcp --sport 80 -s 192.168.2.2 -d 
192.168.1.0/24 -j SNAT --to-source 192.168.2.1

    2) I have to use ebtables, as I'm using a bridge.

Any help? Thanks in advance :-)


             reply	other threads:[~2008-04-18  9:27 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-18  9:27 Javier Prieto Martínez [this message]
2008-04-18 10:35 ` Redirecting ports in a bridge Jan Engelhardt
2008-04-18 10:55   ` Javier Prieto Martínez
2008-04-18 11:29     ` Jan Engelhardt
2008-04-18 11:41       ` Javier Prieto Martínez
2008-04-18 12:26         ` Marc Cozzi
2008-04-18 12:34           ` Javier Prieto Martínez
2008-04-23 15:25           ` Jan Engelhardt
2008-04-18 14:38         ` Grant Taylor
2008-04-21  6:55           ` Javier Prieto Martínez
2008-04-22  1:30             ` Grant Taylor
2008-04-22  6:15               ` Javier Prieto Martínez
2008-04-22 14:29                 ` Grant Taylor
2008-04-22 15:10                   ` Javier Prieto Martínez
2008-04-22 19:24                     ` Grant Taylor
2008-04-23 15:24         ` Jan Engelhardt
2008-04-23 17:16           ` Grant Taylor
2008-04-23 18:48             ` Jan Engelhardt
2008-04-23 18:57               ` Grant Taylor
2008-04-24  6:15                 ` Javier Prieto Martínez
2008-04-18 14:34   ` Grant Taylor
2008-04-18 14:44 ` Grant Taylor

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=48086990.5060000@juntadeandalucia.es \
    --to=javier.prieto.ext@juntadeandalucia.es \
    --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