Tutorial to Connect to a VPN Connection Using the SSH Tunnel on CentOS/RedHat Linux

In a Linux based system, there are many ways that can be used to set up a VPN connection, where a privileged access is required over all the hosts involved (if you wish to create a virtual network interface through TUN/TAP devices). Along with this, additional VPN ports need to be opened up on an existing firewall in the system, which is considered to be an administrative overhead. However, if a VPN is successfully created over an SSH tunnel, available commonly, the VPN provisioning overhead will be reduced. A step by step guide is provided below to help you set up a VPN connection over the SSH tunnel on a CentOS/RedHat Linux based platform.

 

This tutorial is based on the use of sshuttle, a command line tool for the creation and configuration of the VPN connection. Sshuttle is a tool that was developed to be used as a transparent proxy server initially, but this can also be used for the establishment of an anonymous VPN connection over the SSH tunnel.

Prerequisites

Before beginning with the set up of a VPN connection over the SSH using sshuttle, this tool needs to be installed on the local host only. There is no need to install this tool on a remote host, nor its root access is required. For the connection to work on the remote host without a root access, the python code of the sshuttle is automatically uploaded to it from the local host, after the creation of the VPN connection. The only requirements for the remote host are that the SSH server must be in running state and the python interpreter should be installed.

Steps for the VPN Setup

  • At first, you need to install the sshuttle tool on your CentOS/RHEL OS. For this, you need to download the python code for the tool from the official repository, along with the inclusion of the downloaded file in the PATH environment variable using the following script:
    “$ sudo yum git”
    $ git clone git://github.com/apenwarr/sshuttle”
  • Now, you need to start the VPN connection using the sshuttle, for which, you need to input the following command:
    “$ sudo sshuttle -r user@remote_host 0.0.0.0/0 –dns”
    In this, “0.0.0.0/0” is used to forward and route all the traffic through the remote SSH host. The “—dns” is used to make the local DNS requests to be forwarded to the remote host.
  • After starting the connection, you will be prompted for the password of the VPN connection as:
    “user@remote_host’s password:”
  • Enter the password and hit ‘enter’ button to proceed, where you will be displayed the connected message, if the VPN connection is successfully established. The message will be displayed as:
    “user@remote_host’s password: ####”
    “Connected.”
  • With this step, you are successfully connected to the VPN server through an SSH tunnel on CentOS/RedHat Linux based system. Here, you have the privilege to access any of the external hosts through the remote host of the SSH.

Raptor VPN

 

Thus, this guide explains you the process of VPN connection on Linux through SSH, while to terminate the connection, you need to press the ‘Ctrl+C’ combination on your keyboard on the sshuttle running terminal.

Rank Provider Name Starting Price Money Back Guarantee
Visit Provider Site
1 express VPN $8.32/ Month 30 Days visit expressvpn
2 $11.52/ Month 30 Days visit expressvpn
3 $14.95/Month 7 Days visit vyprvpn
4 IpVanish VPN $10.00/ Month 7 Days visit ipvanish
5 $21/ 3 Months 7 Days visit strongvpn
VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)
Filed in: Tutorials

Get Updates

Share This Post

Recent Posts

Leave a Reply

Submit Comment

© 2017 Get Best VPN Service in Europe. All rights reserved.