I wanted to clarify how to make changes persistent for iptables. So far I have seen several approaches and not sure which one is correct.
- sudo iptables-save
- sudo service iptables save
- sudo iptables-save > /etc/sysconfig/iptables
Personally following has been experience
This works when iptables is enabled, otherwise after iptables restart, the changes revert.
Also here, it explains that
sudo iptables-save should work if the
iptables-services pacage is installed.
sudo iptables-save > /etc/sysconfig/iptables
I received a permission issue, do not remember exactly (nor I have more details to share)
sudo service iptables save
Yet to use it.
It will be great, if someone can explain which one works in which circumstances?