persist port routing from 80 to 8080
You can add this command in /etc/rc.local
, so it will be executed automatically after reboot .
Use the iptables-save
command instead.
Firewall rules should never go into rc.local
script. rc.local
is the last thing to be executed. If a block rule has been placed into rc.local
there is a small time frame where an attacker can exploit a rule not being in place.
While it probably doesn't matter with this situation, it is still best to not get into a bad habit that may bite you later.
Here is how the official iptables' documentation teaches us. See here
Add these two lines in /etc/network/interfaces
:
pre-up iptables-restore < /etc/iptables.rules
post-down iptables-save > /etc/iptables.rules
The line post-down iptables-save > /etc/iptables.rules
will save the rules to be used on the next boot.