Switch public IP between VMs

Sep 5, 2016
4
0
21
59
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
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!