Restarting the iptables-persistent "service" does not capture the current state of the iptables and save it; all it does is reinstate the iptables rules that were saved when the package was last configured.. To configure iptables-persistent, you need to tell it about your current iptables ruleset.. One way to accomplish that is as follows: Once you are done, save the file. Sometimes after a reboot, iptables rules are not available as they are not saved to be persistent. 1. How can they survive in Photon OS? On newly shined CentOS 7 / Red Hat 7 , with systemctl command we can control the service status. on CentOS/RHEL-based distributions. To save the rules in Red-Hat based systems, enter: sudo /sbin/service iptables save Run the below command. Take a look at the following example to understand the syntax of the command. Iptables does not keep the rules you created when the system reboots. Verify that all the rules are present using the command “iptables … 5.3. iptables-save. This gives us an easy way to export the firewall rules to file, by redirecting stdout to a file. Whenever you configure iptables in Linux, all the changes you make apply only until the first restart. This command is quite simple really, and takes only two arguments. iptables-persistent does not work that way. This is important part.After setting rule,we will save the IPTABLES in /etc/iptables/rules.v4 file. Important. In previous CentOS versions, we used to stop iptables service by using the command service iptables stop or /etc/init.d/iptables stop. Add rules to the iptables according to your requirment. I would suggest to add at least the following rule, in order to validate our concept. 2. To save the rules in Debian-based systems, enter: sudo /sbin/iptables–save.

Additional iptables settings (e.g. On the journey of exploring the newly releaed CentOS 7 . Now you can start building your iptables on this file, one per line, just before the COMMIT command. The iptables-save command writes the current iptables rules to stdout (standard out).
I found another interesting thing. This is related to iptables. The post below describes steps to save iptables persistently.
To save your iptables rules, type the following command as root: [root@myServer ~]# iptables-save > where is a user-defined name for your ruleset. The iptables-save command is, as we have already explained, a tool to save the current rule-set into a file that iptables-restore can use. Connect to the server via SSH and do the following: Method 1: # service iptables-save > iptables_save.txt. Once you are done, save the file. linux-w2mu # iptables -A INPUT -p tcp –dport 22 -j LOG –log-prefix "Someone knocked on port 22" linux-w2mu # iptables -A INPUT -s 192.168.2.1 -p tcp --dport 22 -j DROP Figure 2.1: Correct order. sudo apt install iptables-persistent netfilter-persistent netfilter-persistent save netfilter-persistent start iptables-save > /etc/iptables/rules.v4 ip6tables-save > /etc/iptables/rules.v6 iptables-restore < /etc/iptables/rules.v4 ip6tables-restore < /etc/iptables/rules.v6 systemctl stop netfilter-persistent systemctl start netfilter-persistent systemctl restart netfilter-persistent In order to avoid losing rules after iptables restart, it is required to save the rules. iptables -I INPUT -p tcp -d 192.168.0.123) are gone after a reboot. iptables-save > /etc/iptables/rules.v4 Alternatively, rather than using the iptables-save command.You can also edit the /etc/iptables/rules.v4 file . To save the rules so that they are loaded when the iptables service is started, use the following command: [root@myServer ~ ] # service iptables save The rules are stored in the file /etc/sysconfig/iptables and are applied whenever the service is started or the machine is rebooted. If distributing the /etc/sysconfig/iptables file to other machines, type /sbin/service iptables restart … Making iptable rules persistent.