Switch public IP between VMs

Sep 5, 2016
4
0
21
60
Hey,

I've done my first steps with Proxmox. The Host is running and I set up two VMs.

Host has IP1
VM1 has IP2
VM2 has IP3 (mirror of VM1)
All VMs are routed setup

IP4 is also a public IP and I'm using IPTABLES Prerouting on the Host to Switch between VM1 and VM2.
Is there a better way to manage this? Can I assing IP4 directly to VM1 or 2 via Proxmox.
There is only 1 NIC at the Host.
 
Hi
If you have only one public IP and want to access your proxmox host, and the two VMs at the same time, the right configuration is what you've done, ( pre routing with DNAT)
like

iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 201 -j DNAT --to IP2:22
iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 202 -j DNAT --to IP3:22

would allow you so connect over ssh via you public IP and port 201 and 202 to your VM1 and VM2