Sorry, bad example. Here is a more complete example that illustrates what I am seeing.
*Tomcat's listening on 8080:* $ netstat -napt|grep 8080 tcp6 0 0 :::8080 :::* LISTEN 1683/java *Prerouting rule is in effect...* $ iptables -nL -t nat Chain PREROUTING (policy ACCEPT) target prot opt source destination REDIRECT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:80 redir ports 8080 Chain POSTROUTING (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination *No other rules in effect...* $ iptables -nL Chain INPUT (policy ACCEPT) target prot opt source destination Chain FORWARD (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination *But accessing via the eth0 interface fails...* $ telnet 192.168.0.10 80 Trying 192.168.0.10... telnet: Unable to connect to remote host: Connection refused Just to be complete, if I telnet to port 8080, connection is successful. $ telnet 192.168.0.10 8080 Trying 192.168.0.10... Connected to 192.168.0.10. Escape character is '^]'. On Sun, Jan 24, 2010 at 5:35 PM, Jarod Wilson <[email protected]> wrote: > On Jan 24, 2010, at 8:25 PM, Steve McCarthy <[email protected]> wrote: > > > $ 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 > > That rule says "take traffic to port 80 on interface eth0 and redirect > it to port 8080". You're not connecting through eth0, you are > connecting via loopback. > > -- > Jarod Wilson > [email protected] > -- Steve McCarthy [email protected] [email protected]
