First, categorize the old rules into router input, forwarding, and router output. Move rules that can be expressed using existing UCI configurations, forwarding, and rule syntax to UCI. When nftables is required, write the smallest possible snippet based on fw4's include type and insertion position.
Generate offline first, then apply
Access via wired management and backup /etc/config/firewall and additional snippets. On the router, use fw4 print to view generated rules. Use fw4 check or nft's check mode to validate syntax by version. After applying, compare the actual tables, chains, and counters using nft list ruleset.
Verify fw4 changes loaded via rule counting
Add only one easily verifiable rule in the backup configuration, and verify its actual placement using fw4 check, fw4 print, and cross-checking against the active rules. Send one request that matches the rule and one that does not match.
Traffic from a trusted zone should be allowed; traffic from a specified isolated zone should be blocked. Test for IPv4, IPv6, and reconnection scenarios. If router administration is affected, recover via serial port or reserved port, and reload the saved firmware version.
policy, rule syntax, and actual behavior must be consistent. On exception, remove the new include and reload the old rules via the wired interface.
Check the terminal output

Comments