Firewall and private LAN for VM in PVE 4.2

2cadz

Active Member
Mar 22, 2016
16
0
41
54
Hi,

I configured a private network for communication and inter VM as indicated on the wiki 'https://pve.proxmox.com/wiki/Network_Model#Masquerading_.28NAT.29_with_iptables' I added a POSTROUTING rule to allow a my VMs to go on internet. .
Everything works fine until I enable the firewall on VMs. In this case the inter VM communication works but it is not possible to go on the internet, it is as if the address translation rule was not working

vmbr0 -> external network
Code:
iface vmbr0 inet static
    address  <external_ip>
    netmask  255.255.255.0
    gateway  <external_gw>
    bridge_ports eth2
    bridge_stp off
    bridge_fd 0

vmbr2 -> private network
Code:
iface vmbr2 inet static
    address  172.16.61.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 '172.16.61.0/24' -o vmbr0 -j MASQUERADE
    post-down iptables -t nat -D POSTROUTING -s '172.16.61.0/24' -o vmbr0 -j MASQUERADE

Bridges when VM (vmid: 100) is started (without firewall)
Code:
brctl show vmbr0 vmbr2
bridge name     bridge id               STP enabled     interfaces
vmbr0           8000.0cc47ac2a5f8       no              eth2
vmbr2           8000.fe6ced22655d       no              veth100i0
....

Bridges when VM (vmid: 100) is started (with firewall)
Code:
brctl show vmbr0 vmbr2 fwbr100i0
bridge name     bridge id               STP enabled     interfaces
vmbr0           8000.0cc47ac2a5f8       no              eth2
vmbr2           8000.fe6ced22655d       no              fwpr100p0
fwbr100i0      8000.cedd1cc87828       no               fwln100i0
                                                        veth100i0

I do not know how to fix this postrouting rule to make it to work again, does anyone have an idea.

Best regards
 

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!