iptables with vlans and duplicate IPs
I'm a Linux newbie, but a long term Windows admin, so please go easy on me as I come over to this side. :)
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.
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:
(being new to these forums I can't show an image from another site with a larger version, so here's a larger image that you'll need to manually navigate to: weblogs.asp.net/blogs/owscott/iptables_routing.PNG)
My NAT rules may be something like this:
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.
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
Any suggestions on which way to go to achieve this?