Overview
RHEL 9 uses
nftables as the default backend for the firewall. The iptables commands in RHEL 9 are actually wrappers around nftables (iptables-nft) or the legacy backend (iptables-legacy), depending on installation.Key Points
- RHEL 9 uses
nftablesas the default backend iptablescommands are wrappers aroundnftables(iptables-nft) or legacy (iptables-legacy)- Direct migration preserves existing firewall rules
- Modern, unified syntax for better management
Step-by-Step Migration
Check Current iptables Setup
Export all IPv4/IPv6 rules to backup files:Check which iptables version your system uses:You should see something like:
Inspect these files for custom chains or scripts you need to port manually.
Install nftables
Install and enable nftables service:
Rules are stored in
/etc/nftables/ or /etc/sysconfig/nftables.conf depending on RHEL version.Test nftables Rules (Optional)
Before applying permanently, test the rules:Check current nftables state:
Disable iptables Service
To avoid conflicts, disable the iptables service:Confirm nftables is handling firewall rules:
Key Tips
Backup
Always backup original iptables rules before migration
Test First
Test rule-by-rule on a staging host if possible
Verify
Use
nft list ruleset frequently to verify rule loadingAvoid Mixing
Avoid mixing
iptables-legacy and nftables — choose one backend to prevent conflicts