[CentOS] Redirecting port 8080 to port 80 - how to add in /etc/sysconfig/iptables file?

Mon Jun 20 19:10:01 UTC 2016
Todor Petkov <petkovptodor at gmail.com>

On Mon, Jun 20, 2016 at 10:01 PM, Alexander Farber
<alexander.farber at gmail.com> wrote:
 <cut>
>
> However I actually need my Jetty program to run at port 80 - so that users
> behind corporate firewalls can connect too.
>
> The Jetty doc at
> https://www.eclipse.org/jetty/documentation/current/setting-port80-access.html
> suggests to run the command
>
> # iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080
>
> but I can not figure out the corresponding line for the
> /etc/sysconfig/iptables
>
> I have tried running the above command and then "iptables -S" to see the
> added rule, but that didn't really work.
>
> Thank you
> Alex

Hi,

you can add the rule and then run "service iptables save" - it will
save the current rules in /etc/sysconfig/iptables

when you run "iptables" or "iptables -S", it prints only the filter
chain by default. Try "iptables-save" - it prints all rules. The other
option is "iptables -t nat -L -n" or "iptables -t nat -S"

Hope it helps.

Regards,