Saving Iptables Firewall Rules Permanent

This paste is a reply to OSMC Forums Saving Iptables Firewall Rules Perman from Emerald Teal - view diff
By: Speedy Baboon | 1 Year | Syntax: Plain Text | Views: 1'095
URL http://paste.itunix.eu/view/f7d7fa27

  1. run as root
  2.  
  3.     sudo -s
  4.  
  5. Save current firewall rules to file
  6.  
  7.     iptables-save > /etc/firewall.conf
  8.  
  9. INCLUDE ON BOOT
  10.  
  11.     echo '#!/bin/sh' > /etc/network/if-up.d/iptables
  12.     echo "iptables-restore < /etc/firewall.conf" >> /etc/network/if-up.d/iptables
  13.     chmod +x /etc/network/if-up.d/iptables
  14.  
  15. SAVE ON SHUTDOWN/REBOOT
  16.  
  17.     echo '#!/bin/sh' > /etc/network/if-down.d/iptables
  18.     echo "iptables-save > /etc/firewall.conf" >> /etc/network/if-down.d/iptables
  19.     chmod +x /etc/network/if-down.d/iptables
  20.  
  21. is working for me
  22.  
  23. if you what to save your iptables rules after an change to iptables just run below.. but it will run the same command on reboot or shutdown.
  24.  
  25.     iptables-save > /etc/firewall.conf

Reply to " Saving Iptables Firewall Rules Permanent"

Here you can reply to the paste above