debian 8 iptables-persistent
debian 8.5 iptables
To persist any changes you make to your iptables rules, do the following.
Install iptables-persistent:
sudo apt-get install -y iptables-persistent
Make any changes you want to your iptables rules, eg
sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8080
Then run
sudo dpkg-reconfigure -y iptables-persistent
The rules should persist after a reboot now.
Extra Info
The dpkg-reconfigure just causes iptables-persistent to do again what it does at install, which is to save the current iptables into a file using a command just like:
iptables-save >/etc/iptables/rules.v4
ip6tables-save >/etc/iptables/rules.v6
The iptables-persistent package causes the os to run something like the following on reboot.
iptables-restore < /etc/iptables/rules.v4
ip6tables-restore < /etc/iptables/rules.v6
Nenhum comentário:
Postar um comentário