Using a VPN, I am connected through SSH on a distant Ubuntu Computer. From this computer, I can browse using telnet through a local server (192.168.x.x).

Is there any way, from the terminal or Firefox, to configure my browser to create a king of SSH tunnel so then I would be able to browse the 182.168.X.X directly in a GUI browser?



From my home (, using a VPN, I connect myself through SSH computer: [email protected] -p 5555. It's ip is

Once connected, I can browse to an intranet server as:

telnet 80
GET /index.html HTTP/1.0

What I do, is to configure something in my Firefox GUI, so that I would be able to browse directly to

edit 2:

For a strange reason, The problem has been fixed when I used SOCKS v4 instead of v5.

1 Answer 1


You can use DynamicForward ssh option, like this:

ssh -o DynamicForward=localhost:6661 yourserver

This way ssh client will listen on 6661 port on localhost for incoming connections. It implements SOCKS protocol so you can configure your Firefox or any other web browser to use this as a HTTP proxy server by using localhost:6661 address. This way all the HTTP requests made by Firefox will be actually made from your remote server so you an use 192.168.X.X addresses.

The shorer version of this is -D option which does the same:

ssh -D localhost:6661 yourserver

Saving yourself typing

You can also configure this option in .ssh/config file to save yourself typing if you want to enable this each time you connect to this host. Here's example:

host myhost
Hostname <yourvpnaddress>
DynamicForward localhost:6661
user <someuser>

Now, all you have to do is to run:

ssh myhost

and it will be equivalent to:

ssh -o DynamicForward=localhost:6661 -l <someuser> <yourvpnaddress>

Using proxy only for 192.168.X.X

If you want to only connect through this proxy when using 192.168.X.X addresses, you may use FoxyProxy Firefox extension (or something similar). It let you specify the list of proxy addresses associated only to specified URLs.

Using this proxy for other application

Some applications does not support SOCKS protocol so they can not be configured to use this method. Fortunately, there is solutions for this and it's called tsocks. It works as a wrapper converting all normal socket operations that application uses to the SOCKS request on the fly using LD_PRELOAD technique. It won't work for all the applications but it should for most. An alternative to tsocks is dante's socksify wrapper which also allows resolution of hostnames on the remote side.

  • I edited my previous post. So I test something like ssh -o DynamicForward=localhost:6661 [email protected] -p 1151. My FF configuration use as SOCKS v5 proxy. Still does not work.. Oct 5, 2012 at 19:54
  • @Pier-alexandreBouchard: After you connect to the server using ssh, please check on your localhost (in another terminal, without leaving ssh session) if your ssh client is listening on 6661 port with nestat -tlp. Also, can you confirm that after closing ssh session, your FF can't connect to any site? If it can, your proxy settings are not working. Also ensure that 192.168.X.X is not excluded from using proxy in your FF settings. Oct 5, 2012 at 19:56
  • netstat -l returns nothing... Oct 5, 2012 at 20:07
  • @Pier-alexandreBouchard: By nothing you mean that there is no metion about ssh listening on port 6661, right? If so, then for some reason you ssh is not creating this tunel, does it complain when starting (like Could not request local forwarding.) ? Oct 5, 2012 at 20:13
  • @Pier-alexandreBouchard: You can also add -v to your ssh command. You should get messages like: debug1: Local connections to localhost:6661 forwarded to remote address socks:0, debug1: Local forwarding listening on port 6661. or similar. Oct 5, 2012 at 20:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .