Steve McCarthy wrote:
Recently tried out Kubuntu after years on Fedora.

I'm running Tomcat web server on port 8080.  Since it's Java, I don't want
to run it as root on port 80.  So the solution would be to make an iptables
rule or two to redirect all port 80 traffic to the unprivileged port 8080
that Tomcat is listening on.

So I've Googled a bit and looked around, and the common wisdom is that you
can use a simple prerouting rule on the nat table to cause all traffic to
    iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT
--to-port 8080

On a Debian system and a Suse system I had access to, the command works
correctly.  But on the Kubuntu system, I just get connection refused.  Is
Kubuntu doing something under the covers that I am not aware of?

$ iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT
--to-port 8080
$ telnet localhost 80
Trying ::1...
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused
Do you have a rule that allows traffic on Port 80? Something like:

iptables -A INPUT -i eth0 -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -i eth0 -p tcp --dport 8080 -j ACCEPT
iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080

Reply via email to