GitHunt
KR

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

Advanced iptables and ip6tables persistent firewall configurations

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

Languages

Shell100.0%

Contributors

BSD 3-Clause "New" or "Revised" License
Created July 10, 2019
Updated August 25, 2024