2 added port-forwarding tag
| link
1
source | link

Unable to access an http sevice forwarded using ssh

I forwarded a port from a remote server (which has Tomcat running on it) to a local port on my machine.

Say, if the remote server address is http://myremoteserver.com:8080, I forwarded the port to localhost this way:

ssh -L 8080:myremoteserver.com:8080 -N watson

Note: Access to myremoteserver is possible only through watson.

After forwarding, if I run localhost:8080 on my browser, I can see the output. But if I try to access this localhost from any other machine on my network (DNS of localhost is server1) through browser, say server1:8080, it does not load at all.

Strangely, if I run tomcat on localhost (instead of port forwarding through ssh), and access it through browser from another machine on network, server1:8080, it works.

Please help. I thought it has to do something with iptables; but it doesn't work even after turning it off.