Installing NCPA for nagios, I found these instructions

iptables -I INPUT -p tcp --destination-port 5693 -j ACCEPT
apt-get install -y iptables-persistent
Answer yes to saving existing rules

Of course, I cannot save ALL ruleset. Because I am using failban and actually my iptables ruleset is veeeery big.

I'd like to persist only

iptables -I INPUT -p tcp --destination-port 5693 -j ACCEPT

Is it possible?

Is still really needed to use iptables-persistent to keep firewall rules? I have a doubt because I am using port 80 and a few others without any problems after system reboots...

So, When I reboot the system, will normally iptables reset all rules? If yes Why ? If no .. wel...

  • Why is it a problem to have a lot of rules. What problem do you see when you try to persist so many? – Philip Couling Mar 15 '19 at 12:35
  • Your question is right. Having fail2ban on a production and old server we have actually more than 12.000 banned ips. I prefer to recreate the ban list next reboot. But of course is not a technical problem – realtebo Mar 15 '19 at 14:39

Your assumption about this behaviour is correct. Upon reboot, if rules are not made persistent, they are lost.

Here is discussed in details how to make rules persist: https://serverfault.com/questions/626521/centos-7-save-iptables-settings

| improve this answer | |
  • Thanks. What if I install ufw? I noticed on a different vps that with ufw installed the rules ( of ufw not all the single lines ) were not lost – realtebo Mar 15 '19 at 14:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.