I've got iptables running, as I can use the following command…
sudo /sbin/iptables sudo /sbin/iptables -t nat -I PREROUTING -p tcp –dport 80 -j REDIRECT –to-port 8080
but I cant do….
service iptables save
iptables: unrecognized service
How do I actually save these changes as the mapping stops when I restart the server?
Thank you.
Best Answer
As far as I know Ubuntu uses UFW in the latest version, so most likely it doesn't have a SysV init script for iptables. If you don't feel comfortable with UFW, you may use
sudo iptables-save > /etc/iptables.rules
to store your current rules and then invokesudo iptables-restore < /etc/iptables.rules
from rc.local (for example) to restore the rules on startup.Or, you can add your own init script for iptables as specified here: