Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

There are two computers at my work - one which has a public IP address and another computer which has an Apache server running a browser-based application on port 80. Port 80 of the computer with the public IP address receives traffic with the DNS Port 80 of the computer with the Apache server is not public, but can be accessed on the local network through

I want to create a local SSH tunnel from the public computer's port 80 to the computer with the Apache server implemented. So far, I have tried this command from the computer with the public IP address:

    sudo ssh -L  

When I run this particular command, I can access the web application on by running a browser on and typing "localhost" in the address bar. However, when I type in's IP address in the address bar, it does not tunnel to's application but instead says that the URL could not be found. Moreover, when I type the DNS lookup for on the address bar, it still does not work.

How do I fix the SSH tunnel it so that, when I type (or its IP address) on the address bar, I access's web application?

share|improve this question
up vote 1 down vote accepted

Try sudo ssh -g -L As the man page notes:

-g Allows remote hosts to connect to local forwarded ports.

Note, though, that this probably isn't the best way of accomplishing what you're trying to do. If you want to enable access to an internal web application from outside, but just for yourself, a VPN of some kind would be less subject to abuse; if you want to enable it for all, talk to your local network admin and get a port punched through the firewall.

share|improve this answer
That works. Thanks. What if I switched the IP addresses on the machines? Would that work without the potential for serious abuse? – user174898 Jul 31 '13 at 7:33
Switched how? Repatched and reconfigured the network so that the one running the web app had the public address, and the other didn't? – MadHatter Jul 31 '13 at 7:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.