A maintainable firewall separates stable access policy from dynamic threat lists and avoids global ruleset flushes during routine updates.
Write the default policy first
For internet-facing systems, start with input drop, established/related accept and explicit inbound exceptions. Loopback, ICMP diagnostics and DHCP may need dedicated treatment.
- Document required ports.
- Allow established/related flows.
- Account for IPv6 management.
Separate rule ownership
If a security agent owns its own nftables table, a global flush on reload can remove its rules. Keep separate ownership and apply validated changes atomically.
- Identify the owner of each table.
- Run `nft -c -f` before apply.
- Back up the active baseline.
Verify after a reboot
An in-memory ruleset is not proof of boot persistence. Test a fresh SSH session and inspect the rules before manually triggering any recovery command.
- Review systemd units.
- Check boot ordering.
- Test connectivity after restart.