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

Alexander Farber alexander.farber at gmail.com
Tue Jun 21 09:30:38 UTC 2016


Hello again,

unfortunately the following /etc/sysconfig/iptables file does not work:

*nat
:INPUT ACCEPT
:OUTPUT ACCEPT
:PREROUTING ACCEPT
:POSTROUTING ACCEPT
#-A PREROUTING -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080
-A PREROUTING -p tcp -m tcp -d 144.76.184.154/32 --dport 80 -j REDIRECT
--to-ports 8080
COMMIT

*filter
:INPUT DROP
:OUTPUT ACCEPT
:FORWARD DROP
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type any -j ACCEPT
-A INPUT -p tcp -m tcp -m state --state NEW -m multiport --dports
25,80,443,8080 -j ACCEPT
-A INPUT -p tcp -m tcp -m state --state NEW --dport 22 --tcp-flags
FIN,SYN,RST,ACK SYN -m limit --limit 2/min --limit-burst 1 -j ACCEPT
COMMIT

I need incoming HTTP-connections to 144.76.184.154:80
to be redirected to 144.76.184.154:8080 (where Jetty is listening
as user "nobody"), but for some reason this does not happen.

When I browse to http://144.76.184.154:8080 then I see Jetty response.

But when I browse to http://144.76.184.154 nothing is returned.

Can anybody please spot the error for me?

Thank you
Alex



More information about the CentOS mailing list