I am trying to build a simple stateful firewall with nftables following the Arch Linux nftables guide. I posted this question on the Arch Linux forum and never received an answer.
After completing the guide and rebooting my machine, systemd failed to load the nftables.service. To troubleshoot the error I ran:
systemctl status nftables
Here is the relevant output:
/etc/nftables.conf:7:17-25: Error: conflicting protocols specified: inet-service v. icmp
The error is complaining about a rule that I set for accepting new pings (icmp) in the input chain. Here is the rule and I don’t see anything wrong with it:
icmp type echo-request ct state new accept
If I remove the rule it will work. But I want the rule.
Here is my ruleset in nftables.conf after completing the guide:
table inet filter {
chain input {
type filter hook input priority 0; policy drop;
ct state established,related accept
iif "lo" accept
ct state invalid drop
icmp type echo-request ct state new accept
ip protocol udp ct state new jump UDP
tcp flags & (fin | syn | rst | ack) == syn ct state new jump TCP
ip protocol udp reject
ip protocol tcp reject with tcp reset
meta nfproto ipv4 counter packets 0 bytes 0 reject with icmp type prot-unreachable
}
chain forward {
type filter hook forward priority 0; policy drop;
}
chain output {
type filter hook output priority 0; policy accept;
}
chain TCP {
tcp dport http accept
tcp dport https accept
tcp dport ssh accept
tcp dport domain accept
}
chain UDP {
tcp dport domain accept
}
}
What am I missing? Thank you in advance.