Assign Public IPs to Vms on Nested Virtualization [Proxmox on VmWare]

Feb 10, 2022
1
0
6
Hi,
I've a network problem on Proxmox configuration.

I've installed Proxmox on a Cloud VPS (provider uses VmWare VE) with only one NIC and 3 public Ip addressess (same subnet and gateway).
My goal is to assign one public Ip to the Host (Proxmox VE) and others to VMs

I tried to configure a static Public Ip to a Vm (connected on default bridge vmbr0) but doesn't work (vm and host pings each other but vm does not reach gateway and internet).
I think it's due to limitations of Nested Virtualization or main Virtual Environment (VmWare) provider configuration (i.e. public ips - MAC binding)
I tried to configure a NAT (adding a second bridge with ip forward and MASQUERADE) with a virtual local network like this:

Code:
auto vmbr1
iface vmbr1 inet static
        address  192.168.1.1
        netmask  255.255.255.0
        bridge_ports none
        bridge_stp off
        bridge_fd 0

        post-up echo 1 > /proc/sys/net/ipv4/ip_forward
        post-up   iptables -t nat -A POSTROUTING -s '192.168.1.0./24' -o vmbr0 -j MASQUERADE
        post-down iptables -t nat -D POSTROUTING -s '192.168.1.0/24' -o vmbr0 -j MASQUERADE

Assigning 192.168.1.x ip to an Ubuntu Vm (with netplan), it reachs internet, but in this way i'm forced to use a signle ip and then nat single ports to expose vms services (iptables command like this I suppose):

Code:
iptables -t nat -A PREROUTING -i vmbr1 -p tcp --dport 8080 -j DNAT --to 192.168.1.x:80

Is there a clean way to bind 1:1 public ips to internal Vms considering this Nested virtualization scenario with more public IP addresses associated to one NIC by cloud provider?

Since I don't have advanced network administration skills, I would really appreciate it if you provide me with configuration examples

Thank you