How can I make iptables rules survive a reboot?
How can I make iptables rules persistent?
On Ubuntu I could install the
iptables-persistent package, set up my iptables rules, and then run:
sudo iptables-save | sudo tee /etc/iptables/rules.v4 > /dev/null
What is the Fedora equivalent?
I think it is the same command on Fedora Linux. The path to the config file is different though. It is
/etc/sysconfig/iptables as can be seen in
/usr/lib/systemd/system/iptables.service (you may need to install the
iptables-services package if you don’t have the aforementioned files).
Beware that Fedora Linux is deprecating iptables in favor of nftables. The main nftables config file is
It’s best avoid using raw iptables/nftables rules, specifically for newbies.
Otherwise subsystems like virtualization may not work properly.
The recommended firewall solution is firewalld:
Using firewalld :: Fedora Docs