Static bidirectional static NAT for duplicate IP devices using iptables

Alon Bar-Lev <[email protected]>
Newsgroups gmane.comp.security.firewalls.netfilter.general
Message-ID <CAOazyz1wYSHCYt+nk7hu2fmiW+GRRMMX0sejAa-31xH_VeWvXA@mail.gmail.com>
Hello,

I am sure this was addressed before, I tried to find relevant
information but could not. I appreciate any assistance.

Constraints

* Two devices with the same IP, this cannot be changed.
* Devices do not have a default router, they must communicate with
applications on the same IP network.
* Host applications should access the two devices using UDP and TCP
based protocols.

Network Solution

* To avoid address conflict, each device resides on a different VLAN.

APPLICATION -->
Kernel -->
* v10@eth0 - interface on VLAN=10
* v11@eth0 - interface on VLAN=11

Switch -->
* Port1 VLAN=10
  * DEVICE1 [10.0.0.10]
* Port2 VLAN=11
  * DEVICE2 [10.0.0.10]

Diagram [In fixed width font]:
---
,-----------+--------.       ,----------+-+--------.
|           |v10@eth0|.......|          |1|VLAN=10 |---DEVICE1 [10.0.0.10]
|APPLICATION|    eth0|-------|   Switch +-+--------+
|           |v11@eth0|.......|          |2|VLAN=11 |---DEVICE2 [10.0.0.10]
`-----------+--------'       `----------+-+--------'
---

I would like to have a bidirectional static NAT so that per
application point of view:
* DEVICE1 will be 192.168.110.10
* DEVICE2 will be 192.168.111.10
And per device point of view:
* APPLICATION will be 10.0.0.11

I thought of having v10@eth0 address 192.168.110.1 and v11@eth0
address 192.168.111.0, however, I am unsure how to set up the
bidirectional translation to the device virtual address using SNAT
without creating duplicate addresses.

Any assistance will be appreciated.

Regards,
Alon Bar-Lev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.