I'm setting up a test lab situation where multiple computers will have the same IP addresses, so they need vlan separation. For example, a group of virtual machines will have IPs 192.168.1.200, 192.168.1.201, etc. And another group of virtual machines will also have the same IPs.
I want to provide NAT mappings to each of the virtual machines so that each of them can be publicly accessible. I'm using Ubuntu 11.04 with iptables.
Note: I'm normally a Windows admin, but Linux was the better solution here.
So basically I want the iptables NAT mapping to point to a specific interface and allow multiple duplicate IPs to co-exist.
Is this possible with a single Ubuntu device? I'm using virtual networking fabric so I don't have a physical network device in-between all of these.
Here's a diagram to represent it:
My NAT rules may be something like this:
iptables -t nat -I PREROUTING -d 188.8.131.52 -j DNAT --to-destination 192.168.1.200 -o eth1.5 iptables -t nat -I POSTROUTING -s 192.168.1.200 -j SNAT --to-source 184.108.40.206 -i eth1.5
It's the -i and -o that seem to only work with the public NIC so that's the part that I couldn't quite get working. For example, using -i in the POSTROUTING (SNAT) gives this error: Can't use -i with POSTROUTING. -o does the same with DNAT.
Any suggestions on which way to go to achieve this?