Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 public.domain.edu. Port 80 of the computer with the Apache server is not public, but can be accessed on the local network through private.domain.edu.

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 admin1@private.domain.edu -L 80:private.domain.edu:80  

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

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

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Try sudo ssh admin1@private.domain.edu -g -L 80:private.domain.edu:80. 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.