What i Try
I try t setup a nftable firewall for incus. I use Debian.
The firewall shut block all traffic that is not ssh.
Incus create by it self rules to allow the network Traffic what are createt by Incus network forward ...
. Without the firewall my setup works.
The firewall is:
/etc/nftables.conf
#!/usr/sbin/nft -f
# flush ruleset
table inet filter
delete table inet filter
table inet filter {
chain input {
type filter hook input priority filter; policy drop;
iif lo accept
ct state established, related accept
tcp dport 6312 ct state new accept
ct state invalid drop
}
chain forward {
type filter hook forward priority filter; policy drop;
ct state established,related accept
iif incusbr0 oif incusbr0 accept
iif enp0s31f6 oif incusbr0 accept
iif "incusbr0" oif "enp0s31f6" accept
ct state invalid drop
}
chain output {
type filter hook output priority filter; policy accept;
}
}
i use
table inet filter
delete table inet filter
and not the default Rekommandation
flush ruleset
because it flush all rules also the incus rules.
Problem
nft fail do start
`
nftables.service - nftables
Loaded: loaded (/lib/systemd/system/nftables.service; enabled; preset: enabled)
Active: failed (Result: exit-code) since Mon 2025-06-16 01:06:00 CEST; 1min 25s ago
Docs: man:nft(8)
http://wiki.nftables.org
Process: 257 ExecStart=/usr/sbin/nft -f /etc/nftables.conf (code=exited, status=1/FAILURE)
Main PID: 257 (code=exited, status=1/FAILURE)
CPU: 11ms
Jun 16 01:06:00 hades nft[257]: ^^^^^^^^
Jun 16 01:06:00 hades nft[257]: /etc/nftables.conf:26:21-28: Error: Interface does not exist
Jun 16 01:06:00 hades nft[257]: iif enp0s31f6 oif incusbr0 accept
Jun 16 01:06:00 hades nft[257]: ^^^^^^^^
Jun 16 01:06:00 hades nft[257]: /etc/nftables.conf:27:7-16: Error: Interface does not exist
Jun 16 01:06:00 hades nft[257]: iif “incusbr0” oif “enp0s31f6” accept
`
nft dont found the incusbr0 and failed.
Attempt
if i run
sudo systemctl restart nftables.service
it don’t fail.
Everything works how it shut be.
After a restart of the system nftable failed and nothing works.
My guess it that nftable starts and loade the table before incus starts and create its brige ans rulesets.
Questions
How can i setup the nftable that it detects the incusbr0 brige?
or
How can i setup nftable on another way that it blocks all traffic?
Any recomandatons for the firewall setup?