Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Marek Kierdelewicz <marek@piasta.pl>
To: Giacomo Bernardi <mino@minux.it>, netfilter@vger.kernel.org
Subject: Re: Awkward scenario: 3 interfaces and 3 devices with same ip/subnet.
Date: Wed, 1 Sep 2010 09:14:26 +0200	[thread overview]
Message-ID: <20100901091426.216b1778@catus> (raw)
In-Reply-To: <AANLkTikfsOHuTwGcs=-wn5+FGXkb8zWynThxxoFRMmia@mail.gmail.com>

Hi,

Here's the solution for your awkward scenario. It involves using
kvm/qemu guests like in the diagram
http://cat.piasta.pl/awkward_solution.jpeg

After implementing this configuration host system should be able to
access devices on ip addressess 10.(1,2,3).0.3

* Config on v1:

ip addr add 10.0.0.2/24 dev eth1
ip addr add 10.1.0.2/24 dev eth0
ip ro add default via 10.1.0.1
enable ipv4 forwarding

iptables -t nat -A PREROUTING -d 10.1.0.3 -j DNAT --to 10.0.0.1
iptables -t nat -A POSTROUTING -s 10.0.0.1 -j SNAT --to 10.1.0.3

* Config on v2:

ip addr add 10.0.0.2/24 dev eth1
ip addr add 10.2.0.2/24 dev eth0
ip ro add default via 10.2.0.1
enable ipv4 forwarding

iptables -t nat -A PREROUTING -d 10.2.0.3 -j DNAT --to 10.0.0.1
iptables -t nat -A POSTROUTING -s 10.0.0.1 -j SNAT --to 10.2.0.3

* Config on v3:

ip addr add 10.0.0.2/24 dev eth1
ip addr add 10.3.0.2/24 dev eth0
ip ro add default via 10.2.0.1
enable ipv4 forwarding

iptables -t nat -A PREROUTING -d 10.3.0.3 -j DNAT --to 10.0.0.1
iptables -t nat -A POSTROUTING -s 10.0.0.1 -j SNAT --to 10.3.0.3

* Config on host system

start kvms to get tap devices up
ip addr add 10.1.0.1/24 dev tap0
ip addr add 10.2.0.1/24 dev tap2
ip addr add 10.3.0.1/24 dev tap4
brctl addbr br0
ip link set up dev br0
brctl addif br0 tap1
brctl addif br0 eth1
brctl addbr br1
ip link set up dev br1
brctl addif br1 tap3
brctl addif br1 eth2
brctl addbr br2
ip link set up dev br2
brctl addif br1 tap5
brctl addif br1 eth3

echo 0 > /proc/sys/net/bridge/bridge-nf-call-iptables


Best regards,
Marek

  reply	other threads:[~2010-09-01  7:14 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-31 11:34 Awkward scenario: 3 interfaces and 3 devices with same ip/subnet Giacomo Bernardi
2010-08-31 13:41 ` Jan Engelhardt
2010-08-31 14:30 ` Grant Taylor
2010-08-31 14:49   ` Giacomo Bernardi
2010-08-31 15:25     ` Grant Taylor
2010-08-31 15:33       ` Giacomo Bernardi
2010-09-01  7:14         ` Marek Kierdelewicz [this message]
2010-09-02 11:28           ` Giacomo Bernardi
2010-09-02 15:56             ` Marek Kierdelewicz
2010-09-02 16:05               ` Giacomo Bernardi
2010-09-02 16:34                 ` Marek Kierdelewicz
     [not found]                   ` <AANLkTi=uKngWrWpxMQJjLP6qTkfsPay9E3+-CKk2+7NO@mail.gmail.com>
2010-09-02 16:54                     ` Giacomo Bernardi
2010-09-02 17:19                       ` Marek Kierdelewicz

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=20100901091426.216b1778@catus \
    --to=marek@piasta.pl \
    --cc=mino@minux.it \
    --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