Powered by Drupal

Saving iptables in Fedora 15 or Greater

In older versions of Fedora (14 or less) you could save your current iptables with the following command:

service iptables save

This would take the tables you currently have in places and save them to the following file:

/etc/sysconfig/iptables

So you could added/delete/change any tables you want then save them so they would be correctly re-applied on the next boot.

Starting with Fedora 15 up to the current version, the service command has been replaced with systemctl. There is a service wrapper in place for most of the old service commands to still work. However it doesn't work with the "save" option:

[root@djkev ~]# service iptables save
Redirecting to /bin/systemctl  save iptables.service
Unknown operation save
[root@djkev ~]# 

The newer way of saving your iptables is the following command:

[root@djkev ~]# /usr/libexec/iptables.init save
iptables: Saving firewall rules to /etc/sysconfig/iptables:[  OK  ]
[root@djkev ~]# 

If you really wanted to write out the iptables save file your self you could also do the following:

iptables-save > /etc/sysconfig/iptables
Category: