Difference between revisions of "Use SSH as a VPN"

From CSLabsWiki
Jump to: navigation, search
m (Created page with "This page summarizes how to utilize ssh to create a "poor man's" VPN. This can typically be done using any default install of ssh on a Linux system but this tutorial was written...")
 
m
Line 1: Line 1:
This page summarizes how to utilize ssh to create a "poor man's" VPN.  This can typically be done using any default install of ssh on a Linux system but this tutorial was written using a default install of CentOS 5 and utilizes Windows 7 as the client.  This example creates a SOCKS proxy, which isn't a full VPN connection like [[Install OpenVPN on CentOS 5|OpenVPN]].   
+
This page summarizes how to utilize ssh to create a "poor man's" VPN.  This can typically be done using any default install of ssh on a Linux system but this tutorial was written using a default install of CentOS 5 and utilizes Windows 7 as the client (Notes for Linux mentioned).  This example creates a SOCKS proxy, which isn't a full VPN connection like [[Install OpenVPN on CentOS 5|OpenVPN]].   
  
 
This tutorial is geared more towards home users.  A [http://www.perturb.org/display/entry/770/ full VPN tunnel is possible with sshd] but it cannot be accomplished easily in Windows and therefore isn't easily used on multiple OSs.
 
This tutorial is geared more towards home users.  A [http://www.perturb.org/display/entry/770/ full VPN tunnel is possible with sshd] but it cannot be accomplished easily in Windows and therefore isn't easily used on multiple OSs.
Line 8: Line 8:
 
Linux server with sshd installed
 
Linux server with sshd installed
  
[http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY]
+
[http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY] installed (if Windows)
  
 
==Create the SOCKS Proxy==
 
==Create the SOCKS Proxy==
 +
If you are using Linux, this is very easy.  Just connect to your ssh server with the <code>-D</code> flag and a high port.
 +
*<code>ssh -D PORT server.address.com</code>
 +
 +
If you are using Windows, it is still fairly easy but requires a bit more work.
 +
 
Open up putty and enter in your server address
 
Open up putty and enter in your server address
 +
 
[[Image:socks1.jpg]]
 
[[Image:socks1.jpg]]
 +
 +
Choose Connection -> SSH in the Category menu.
 +
It isn't necessary but choosing to enable compression can be beneficial.
 +
 +
[[Image:socks2.jpg]]
 +
 +
Choose Connection -> SSH -> Tunnels in the Category menu.
 +
Enter in a high source port (such as 50000), choose Dynamic, choose Auto, and click Add.
 +
 +
[[Image:socks3.jpg]]
 +
 +
Finally, click Open and login to the server.
  
  
  
 
[[Category:How-Tos]]
 
[[Category:How-Tos]]

Revision as of 07:16, 29 April 2011

This page summarizes how to utilize ssh to create a "poor man's" VPN. This can typically be done using any default install of ssh on a Linux system but this tutorial was written using a default install of CentOS 5 and utilizes Windows 7 as the client (Notes for Linux mentioned). This example creates a SOCKS proxy, which isn't a full VPN connection like OpenVPN.

This tutorial is geared more towards home users. A full VPN tunnel is possible with sshd but it cannot be accomplished easily in Windows and therefore isn't easily used on multiple OSs.

If you notice a problem with this How-To or would like to provide feedback, please email Matt.

Prerequisets

Linux server with sshd installed

PuTTY installed (if Windows)

Create the SOCKS Proxy

If you are using Linux, this is very easy. Just connect to your ssh server with the -D flag and a high port.

  • ssh -D PORT server.address.com

If you are using Windows, it is still fairly easy but requires a bit more work.

Open up putty and enter in your server address

Socks1.jpg

Choose Connection -> SSH in the Category menu. It isn't necessary but choosing to enable compression can be beneficial.

Socks2.jpg

Choose Connection -> SSH -> Tunnels in the Category menu. Enter in a high source port (such as 50000), choose Dynamic, choose Auto, and click Add.

Socks3.jpg

Finally, click Open and login to the server.