[SOLVED] Public IP(s) Masquerade, VM can't reach gateway after install

wldlkx

New Member
Jun 17, 2024
4
0
1
Hello,

I really need help to understand what is the best network configuration I shall make.
I have 3 Public IPs that share the same /24 netmask, thus they have the same gateway.
At first, I tried using only one of them and route all my VMs traffic through it using Masquerading (my VMs have to connect to the internet) like so :
/etc/network/interfaces
Code:
auto lo
iface lo inet loopback

auto enp4s0
iface enp4s0 inet static
        address REDACTED.7/24
        gateway REDACTED.1
        dns-nameservers REDACTED.14 REDACTED.REDACTED.11


auto vmbr0
iface vmbr0 inet static
        address 172.16.0.1/24
        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 '172.16.0.0/24' -o enp4s0 -j MASQUERADE
        post-down iptables -t nat -D POSTROUTING -s '172.16.0.0/24' -o enp4s0 -j MASQUERADE

After having found this configuration satisfying, I went on to creating a debian VM.
I assigned 172.16.0.100 to it and 172.16.0.1 as a gateway.
Everything works, I get to the VM

Then, for a reason I can't fathom, after downloading some things (nodejs environment) and restarting networking service, I can't ping my VM gateway 172.16.0.1 anymore.
I also notice inconsistency between VM /etc/network/interfaces and ip show output, ens18 not present in file but present in ip show output.
IP route seems fine on both ends. Host and guest can't ping each other anymore, they could before.

I tried using a setup with 2 Bridges, one with the public IP, one with the private net, like in this video but I ended up cutting my SSH connection, I thought I'd done it properly. Got it back, now I'm writing this post b4 trying anything, no ideas.

Can someone recommend me a better way to get this working ?
In the optimal setup I have in mind, a Public IP will reach Host Proxmox, and another Public IP would serve as VMs' Internet access, but I don't know how to do that as they have the same gateway it confuses me on how to set it up.

I'd be eternally grateful for any help. I can offer some coffee if you want.

Thanks in advance !
 

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!