I have a server with a Public IPv4 but I am unable to configure NAT

bstgmr02

Member
Oct 18, 2020
3
0
6
25
Hi there,

I own a server which has a Public IPv4, usually my Proxmox set-up's run out of the box and I am able to configure NAT/bridged networks automatically. But this time it doesn't seem to want to work.

I have the following inside /etc/network/interfaces:
Code:
auto lo
iface lo inet loopback

iface enp67s0f3 inet manual

iface enp67s0f0 inet manual

iface enp67s0f1 inet manual

iface enp67s0f2 inet manual

auto vmbr0
iface vmbr0 inet static
        address 109.xx.xxx.xx/29
        gateway 109.xx.xxx.xx
        bridge-ports enp67s0f3
        bridge-stp off
        bridge-fd 0
       
auto vmbr1
iface vmbr1 inet static
        address 10.0.0.1/16
        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 '10.0.0.0/16' -o vmbr0 -j MASQUERADE
        post-down iptables -t nat -D POSTROUTING -s '10.0.0.0/16' -o vmbr0 -j MASQUERADE

        post-up   iptables -t raw -I PREROUTING -i fwbr+ -j CT --zone 1
        post-down iptables -t raw -D PREROUTING -i fwbr+ -j CT --zone 1

I have created vmbr1, but whenever I try to spin up a Ubuntu VM, it never is able to pick up an IP through the interface of vmbr1. Any help would highly be appreciated so I can create this NAT setup :)
 
Last edited:
Hi,
it never is able to pick up an IP through the interface of vmbr1
what do you mean by that? Unless you spin up some kind of DHCP server, you would need to assign it an address from the 10.0.0.0/16 range yourself. Can you maybe share the network config of the VM and maybe also the output of iptable-save?
 
I was able to resolve that issue, the new issue I have is after making changes to /etc/network/interfaces after port-forwarding some ports for my NAT VM, I run ifdown vmbr1 && ifup vmbr1 but the network just dies on the NAT VM. The only way I can make it work is if I restart the whole Proxmox Server which I want to avoid. How exactly can I restart the network for the VM?

I tried the following to try to get the network to work:
  1. systemctl restart networking.service
  2. ifdown vmbr1 && ifup vmbr1
  3. Restart the VM
None of the following work above. Is there some special command? Seems like the bridge network just dies or something after trying to port-forward within /etc/network/interfaces

---
Edit:

Code:
service networking restart

grep -FH bridge= /etc/pve/nodes/*/qemu-server/*.conf \ | perl -nle 'print "fwpr$1p$2 master $3" if /\/(\d+).conf:net(\d+):.*?bridge=(vmbr\d+)/' \ | xargs -l1 ip link set
 
Last edited: