I feel like this should be simple but I can't find anything relevant after many hours searching online.
I simply want to NAT a private IP range to a public IP on a VLAN aware bridge but it just doesn't work.
Creating untagged container/VM and they can reach internet just fine, but tag them with VLAN ID then they can't, they can only reach other guests within the same VLAN...
I simply want to NAT a private IP range to a public IP on a VLAN aware bridge but it just doesn't work.
Creating untagged container/VM and they can reach internet just fine, but tag them with VLAN ID then they can't, they can only reach other guests within the same VLAN...
Code:
auto lo
iface lo inet loopback
iface enp0s31f6 inet manual
auto vmbr0
iface vmbr0 inet static
address xx.xx.xx.xx/26
gateway xx.xx.xx.xx
bridge-ports enp0s31f6
bridge-stp off
bridge-fd 0
bridge-vlan-aware yes
bridge-vids 2-4094
auto vmbr0
iface vmbr0 inet static
address xx.xx.xx.xx/26
#2nd IP address alias
auto ct1
iface ct1 inet static
address 10.0.0.1/24
bridge-ports none
bridge-stp off
bridge-fd 0
bridge-vlan-aware yes
bridge-vids 2-4094
post-up echo 1 > /proc/sys/net/ipv4/ip_forward
post-up iptables -t nat -A POSTROUTING -s '10.0.0.0/24' -o vmbr0 -j SNAT --to-source xx.xx.xx.xx
post-down iptables -t nat -D POSTROUTING -s '10.0.0.0/24' -o vmbr0 -j SNAT --to-source xx.xx.xx.xx
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
#NAT to 2nd IP address
Last edited: