Given the move by many Linux distros from iptables to nftables as default, I am looking to migrate my iptables rules.
I have a Ubuntu server that has two bridges (mainly to accommodate VMs and LXD containers that I run on the server). Both are created in netplan.
The physical NIC eth0 (untagged VLAN10) is bridged in br0. br0 gets an IP in VLAN10. eth0 gets no IP.
VLAN66 (tagged) has separately been configured on eth0, and bridged in br66. No IP is configured on br66 (or VLAN66).
At the moment (being lazy) I have the br_netfilter module loaded so that all filtering is done in iptables, in the standard input, forward, and output chains in the filter table. This is so I can avoid having to separately configure ebtables.
Looking at nftables, I understand this lazy approach won’t work, because bridge filtering happens through a separate family.
My question is: given the interfaces on the server are all bridged, should the main focus of my nftables rules be in the bridge family? So all the rules that are currently configured in the filter table in iptables should be replicated in the bridge family, rather than in the ip/ip6/inet families? Or does there need to be a mix, and if so how is that divided?
Sorry if this is a dumb question.
Edit: Config information added. The veth
interfaces are for LXD containers.
netplan:
network:
version: 2
renderer: networkd
ethernets:
eth0:
dhcp4: false
dhcp6: false
bridges:
br0:
interfaces: [ eth0 ]
macaddress: xx:xx:xx:xx:xx:94
dhcp4: true
dhcp6: true
parameters:
forward-delay: 0
stp: false
br66:
interfaces: [ vlan66 ]
macaddress: xx:xx:xx:xx:xx:8d
dhcp4: false
dhcp6: false
link-local: [ ]
accept-ra: false
parameters:
forward-delay: 0
stp: false
vlans:
vlan66:
id: 66
link: eth0
dhcp4: false
dhcp6: false
ip a:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master br0 state UP group default qlen 1000
link/ether xx:xx:xx:xx:xx:ee brd ff:ff:ff:ff:ff:ff
3: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether xx:xx:xx:xx:xx:94 brd ff:ff:ff:ff:ff:ff
inet 10.10.10.10/24 brd 10.10.10.255 scope global dynamic br0
valid_lft 5022sec preferred_lft 5022sec
inet6 fdfd:2553:8868:10:xxxx:xxxx:xxxx:xx94/64 scope global dynamic mngtmpaddr noprefixroute
valid_lft 86361sec preferred_lft 14361sec
inet6 2403:xxxx:xxxx:xx10:xxxx:xxxx:xxxx:xx94/64 scope global dynamic mngtmpaddr noprefixroute
valid_lft 86361sec preferred_lft 14361sec
inet6 fe80::xxxx:xxxx:xxxx:xx94/64 scope link
valid_lft forever preferred_lft forever
4: br66: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether xx:xx:xx:xx:xx:8d brd ff:ff:ff:ff:ff:ff
5: vlan66@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br66 state UP group default qlen 1000
link/ether 2c:4d:54:d2:84:ee brd ff:ff:ff:ff:ff:ff
7: veth940fee62@if6: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br66 state UP group default qlen 1000
link/ether e6:40:d8:1f:7b:93 brd ff:ff:ff:ff:ff:ff link-netnsid 0
9: vethff4da3d7@if8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br66 state UP group default qlen 1000
link/ether 3a:ba:7e:c8:49:20 brd ff:ff:ff:ff:ff:ff link-netnsid 1
11: veth0d67113a@if10: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br66 state UP group default qlen 1000
link/ether 86:65:7f:bc:a0:c6 brd ff:ff:ff:ff:ff:ff link-netnsid 2
13: veth22f981e6@if12: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br66 state UP group default qlen 1000
link/ether 92:93:15:f6:ed:09 brd ff:ff:ff:ff:ff:ff link-netnsid 3
15: veth1d23d0ca@if14: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br66 state UP group default qlen 1000
link/ether 6e:8a:7d:48:0a:08 brd ff:ff:ff:ff:ff:ff link-netnsid 4
brctl show:
bridge name bridge id STP enabled interfaces
br0 8000.xxxxxxxxxx94 no eth0
br66 8000.xxxxxxxxxx8d no veth0d67113a
veth1d23d0ca
veth22f981e6
veth940fee62
vethff4da3d7
vlan66