PDA

View Full Version : Guide to setup SSH Tunnel on DD-WRT



moskivb
03-07-2015, 12:37 PM
This is for people who own a router with DD-WRT firmware and are looking forward to have this type of configuration:

PC/tvbox <--> Router <--> SSH Tunnel <--> SSH Server <--> Internet

This way you do not have to run Bitvise Tunnelier or any other SSH client with Socks5 proxy on each computer/tvbox which wants to use the tunnel. Essentially what we are going to do is install and run an SSH client on the router and setup a tunnel on the router itself. This would allow any computer/tvbox connected to the router to use the tunnel and avoid throttles from ISPs.

Requirement/Prerequisite:
- DD-WRT-flashed router (with OpenSSH installed)
- Remote SSH server (shell access to Linux server)

Getting Started:
1. Install Optware (how-to:)
http://www.dd-wrt.com/wiki/index.php/Optware
2. Install/Run OpenSSH
a. Install OpenSSH
Code:
/opt/bin/ipkg-opt install openssh

b. Start OpenSSH
Code:
/opt/etc/init.d/S40sshd

c. Create an SSH tunnel using OpenSSH
Code:
openssh-ssh [user]@[host] -D[PORT]

Note: Using the DD-WRT web GUI, you can set the OpenSSH start and tunnel-creating commands to run upon router start up by simply going to Administration -> Commands and typing the commands (one per line) in the text field and clicking on "Save Startup".

So Far:
Now you have successfully installed Optware and OpenSSH package and is able to connect to the remote SSH server created a tunnel.

Final Step:
As of right now when you setup Bitvise Tunelier or Putty on your local computer the ip address you use for the SOCKS5 proxy in your intended P2P application is 127.0.0.1. This is because the proxy is setup on your local computer. However now we have it setup on the router making it accessible to all computers on the router. So the ip for the SOCKS5 proxy you should enter in your P2P applications would be your router's ip (e.g 192.168.1.1). The port would be the [PORT] you specified in the command on the router.

Hope this helps and makes it convenient for owners of routers capable of handling DD-WRT. DD-WRT is an amazing piece of work and opens up so many possibilities with such a little router.

Montreal
03-08-2015, 11:24 PM
Hi Thanks for this beautful tutorial, It will come in great use for many.

It's unfortunate i don't currently own any router compatible for DD WRT

@moskivb
Although would you happen to know or have any links to tutorials if there is any, in how to do this method with the SR505N VDSL/DSL modem/router?

Right now im paying for the Elite Hotspot-shield VPN, so I would be greatly appreciated if you could help me?