nftables on Alpine Linux vs. Archlinux
By chimo on (updated on )One thing I forgot about regarding the Archlinux “nftables”
systemd unit file, is that stopping the nftables
service
doesn’t flush the ruleset. If you want the rules gone, you need to
run “nft flush ruleset”.
This is different than Alpine Linux, where stopping the service does flush the nftables ruleset.
You can see the difference in behaviour by running “nft list ruleset” after stopping the service.
# Stop the service
chimo@arch:~$ sudo systemctl stop nftables # List the ruleset
chimo@arch:~$ nft list ruleset chain input { type filter hook input priority filter; policy drop; ct state invalid drop comment "early drop of invalid connections" ct state { established, related } accept comment "allow tracked connections" iif "lo" accept comment "allow from loopback" ip protocol icmp accept comment "allow icmp" meta l4proto ipv6-icmp accept comment "allow icmp v6" tcp dport 22 accept comment "allow sshd" meta pkttype host limit rate 5/second burst 5 packets counter packets 0 bytes 0 reject with icmpx admin-prohibited counter packets 0 bytes 0 } chain forward { type filter hook forward priority filter; policy drop; }
# Stop the service
chimo@alpine:~$ doas service nftables stop # List the ruleset
chimo@alpine:~$ nft list ruleset chimo@alpine:~$ █
We can see that the
Alpine Linux init script does the flush for you at the end of the
stop()
function (line 14):
|
|