/advanced-iptables-and-ip6tables-persistent-firewall

Advanced iptables and ip6tables persistent firewall configurations

Primary LanguageShellBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

Advanced iptables and ip6tables persistent firewall configuration

Configuration files for Linux kernel iptables firewall. Read this article for more information.

Make iptables configuration persistent on start-up:

$ chmod +x /sbin/scripts/4iptables.sh 
$ chmod +x /sbin/scripts/6iptables.sh

$ bash /sbin/scripts/4iptables.sh 
$ bash /sbin/scripts/6iptables.sh

$ chmod +x /sbin/scripts/iptables4.rules
$ chmod +x /sbin/scripts/iptables6.rules

Make iptables configuration persistent on start-up:

$ vi /etc/network/if-pre-up.d/iptables
#!/bin/bash
/sbin/iptables-restore < /sbin/scripts/iptables4.rules
/sbin/ip6tables-restore < /sbin/scripts/iptables6.rules

Make iptables pre-up file executable for startup:

$ chmod +x /etc/network/if-pre-up.d/iptables
$ vi /etc/nftables.conf

Verify and troubelshoot configuration: Make nftables persistant on boot:

$ iptables -vL
$ systemctl enable nftables
$ systemctl start nftables
$ systemctl status nftables

License

Berkeley Software Distribution (BSD)

Author

Jeroen van Kessel | cryptsus.com - we craft cyber security solutions