We have a cluster on which I would like to implement per VM firewalling. We enabled firewalling on the datacentre, node and guest basis and finally set the VM's network interface to also use the function.
Reviewing iptables shows packets matching the guest's IN chain but nothing in that chain is being matched.
Herewith applicable chains:
All chains have packet matches, except for the last one that should apply to the VM.
Network structure on this cluster is the standard Linux bridge with two bonds for VM traffic (bond0) and Ceph (bond1):
VM definition:
pveversion -v:
Reviewing iptables shows packets matching the guest's IN chain but nothing in that chain is being matched.
Herewith applicable chains:
Code:
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
5387M 629G PVEFW-FORWARD all -- * * 0.0.0.0/0 0.0.0.0/0
Chain PVEFW-FORWARD (1 references)
pkts bytes target prot opt in out source destination
26726 1086K DROP all -- * * 0.0.0.0/0 0.0.0.0/0 ctstate INVALID
5282M 622G ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 ctstate RELATED,ESTABLISHED
27M 1884M PVEFW-FWBR-IN all -- * * 0.0.0.0/0 0.0.0.0/0 PHYSDEV match --physdev-in fwln+ --physdev-is-bridged
26M 1717M PVEFW-FWBR-OUT all -- * * 0.0.0.0/0 0.0.0.0/0 PHYSDEV match --physdev-out fwln+ --physdev-is-bridged
77M 4964M all -- * * 0.0.0.0/0 0.0.0.0/0 /* PVESIG:qnNexOcGa+y+jebd4dAUqFSp5nw */
Chain PVEFW-FWBR-IN (1 references)
pkts bytes target prot opt in out source destination
27M 1884M PVEFW-smurfs all -- * * 0.0.0.0/0 0.0.0.0/0 ctstate INVALID,NEW
22409 2413K tap105i0-IN all -- * * 0.0.0.0/0 0.0.0.0/0 PHYSDEV match --physdev-out tap105i0 --physdev-is-bridged
27M 1882M tap110i0-IN all -- * * 0.0.0.0/0 0.0.0.0/0 PHYSDEV match --physdev-out tap110i0 --physdev-is-bridged
0 0 all -- * * 0.0.0.0/0 0.0.0.0/0 /* PVESIG:lVmvmHpRKBUJookpkACTKl3FM0g */
Chain tap105i0-IN (1 references)
pkts bytes target prot opt in out source destination
0 0 ACCEPT udp -- * * 0.0.0.0/0 0.0.0.0/0 udp spt:67 dpt:68
0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:22
0 0 GROUP-default-IN all -- * * 0.0.0.0/0 0.0.0.0/0
0 0 ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 mark match 0x80000000/0x80000000
0 0 GROUP-sip_linux-IN all -- * * 0.0.0.0/0 0.0.0.0/0
0 0 ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 mark match 0x80000000/0x80000000
0 0 PVEFW-Drop all -- * * 0.0.0.0/0 0.0.0.0/0
0 0 DROP all -- * * 0.0.0.0/0 0.0.0.0/0
0 0 all -- * * 0.0.0.0/0 0.0.0.0/0 /* PVESIG:p4ISMTQ5LnVj2VO4g3x70gL9ezc */
All chains have packet matches, except for the last one that should apply to the VM.
Network structure on this cluster is the standard Linux bridge with two bonds for VM traffic (bond0) and Ceph (bond1):
Code:
auto lo
iface lo inet loopback
auto bond0
iface bond0 inet manual
slaves eth0,eth1
bond_miimon 100
bond_mode active-backup
mtu 9216
auto bond1
iface bond1 inet static
address 10.254.1.4
netmask 255.255.255.0
slaves eth2,eth3
bond_miimon 100
bond_mode active-backup
mtu 9216
auto eth0
iface eth0 inet manual
bond-master bond0
bond-primary eth0
mtu 9216
auto eth1
iface eth1 inet manual
bond-master bond0
mtu 9216
auto eth2
iface eth2 inet manual
bond-master bond1
mtu 9216
auto eth3
iface eth3 inet manual
bond-master bond1
bond-primary eth3
mtu 9216
auto eth4
iface eth4 inet manual
auto eth5
iface eth5 inet manual
auto vmbr0
iface vmbr0 inet static
address 192.168.241.4
netmask 255.255.255.0
gateway 192.168.241.1
bridge_ports bond0
bridge_stp off
bridge_fd 0
mtu 9216
VM definition:
Code:
agent: 1
boot: cdn
bootdisk: scsi0
cores: 2
cpu: SandyBridge,flags=+pcid
ide2: none,media=cdrom
localtime: 1
memory: 4096
name: 211-FreePBX
net0: virtio=5E:D8:F3:62:C5:90,bridge=vmbr0,firewall=1,tag=12
numa: 1
onboot: 1
ostype: l26
protection: 1
scsi0: rbd_hdd:vm-105-disk-1,cache=writeback,discard=on,size=100G
scsihw: virtio-scsi-pci
smbios1: uuid=cb38b843-e241-48f8-b681-8299a56bc8ac
sockets: 1
vga: cirrus
pveversion -v:
Code:
proxmox-ve: 5.2-2 (running kernel: 4.15.18-1-pve)
pve-manager: 5.2-5 (running version: 5.2-5/eb24855a)
pve-kernel-4.15: 5.2-4
pve-kernel-4.15.18-1-pve: 4.15.18-15
ceph: 12.2.7-pve1
corosync: 2.4.2-pve5
criu: 2.11.1-1~bpo90
glusterfs-client: 3.8.8-1
ksm-control-daemon: 1.2-2
libjs-extjs: 6.0.1-2
libpve-access-control: 5.0-8
libpve-apiclient-perl: 2.0-5
libpve-common-perl: 5.0-35
libpve-guest-common-perl: 2.0-17
libpve-http-server-perl: 2.0-9
libpve-storage-perl: 5.0-24
libqb0: 1.0.1-1
lvm2: 2.02.168-pve6
lxc-pve: 3.0.0-3
lxcfs: 3.0.0-1
novnc-pve: 1.0.0-1
proxmox-widget-toolkit: 1.0-19
pve-cluster: 5.0-28
pve-container: 2.0-24
pve-docs: 5.2-4
pve-firewall: 3.0-13
pve-firmware: 2.0-5
pve-ha-manager: 2.0-5
pve-i18n: 1.0-6
pve-libspice-server1: 0.12.8-3
pve-qemu-kvm: 2.11.2-1
pve-xtermjs: 1.0-5
qemu-server: 5.0-29
smartmontools: 6.5+svn4324-1
spiceterm: 3.0-5
vncterm: 1.5-3
zfsutils-linux: 0.7.9-pve1~bpo9