I need to use a local webbrowser on a ubuntu PC to connect to my internet router via an internal firewall ubuntu server. So I'd need to tunnel via the firewall machine in order to access the router:

[ PC ] <-- --> [ FW ] <-- --> [router] --> WAN

I don't want to tunnel any other traffic other than the router's port 80

Q. Can this be done in a single ssh command ?


You have two options.

ssh -D1080 firewall

which creates a local SOCKS5 server you can configure your browser to use. Then it is for all practical purposes running on the firewall.

ssh -L8080:router:80 firewall

which forwards the local port 8080 to port 80 on router (which sees it coming from firewall).

Also you may be able to use "ssh -Y firewall" to run a shell on the firewall where you can run a browser which then displays on your computer. If not, you may be able to run links or similar.

Note that if what you want to do is intentionally hard, you may want to check with the local network administrator that what you want to do is allowed. Breaching network security without permission is usually not a good idea.

  • Thanks a lot Thorbjorn. Both worked but I preferred to leave browser settings as they are so just used the "ssh -L8080:router:80 firewall" just fine. – Mark Simmons Apr 7 '17 at 13:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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