I can add the route like this:
iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT
--to-port 8080
But after rebooting, it resets. How do I make it permanent? Is the best practice to put it in the rc.local?
|
I can add the route like this:
--to-port 8080 But after rebooting, it resets. How do I make it permanent? Is the best practice to put it in the rc.local?
| ||||
|
feedback
|
|
IPTables rules are loaded from a file when the service starts. (The paths below are based on RHEL/CentOS, but the premise should work on other systems) If you look in /etc/init.d there is an iptables init file, that includes the following lines:
This file will therefore, load the data from Once you know which file is used, you can save your current IPTables ruleset to the file.
Try to restart the service and see if the rules persist:
| |||
|
feedback
|
|
Most distros will have something like "iptables save". Are you running RedHat/CentOS? Ubuntu? | |||
|
feedback
|