Connect to OpenVPN server over SSH Tunnel (using Putty on Windows)

In this article, we'll explain how to connect to your private OpenVPN server over SSH Tunnel to encapsulate the transmitted data for added security to your connection.

 

Requirements:

  1. Linux VPS or Dedicated Server running CentOS / RHEL / Almalinux.
  2. OpenVPN Server installed on your VPS/Dedicated server.
    For more about OpenVPN server installation on CentOS / RHEL / Almalinux, follow this article.
    OpenVPN server must run on TCP protocol and port 443 is recommended.
  3. Windows PC
  4. Putty SSH Client installed on Windows PC.
  5. OpenVPN Connect installed on your Windows PC.

 

Prepare the VPN profile

After you've installed OpenVPN server using the installation script mentioned above, the installation script will create the .ovpn profile on the server. Copy this profile to your PC (the profile must have ".ovpn" extension).

(Assuming that the VPN server IP is 40.40.40.40 and OpenVPN Server is listening to TCP port 443)
  1. Open the OpenVPN profile on your PC with a text editor
  2. Replace the line remote 40.40.40.40 443 with remote 127.0.0.1 8585 
    (127.0.0.1 is the localhost IP, and 8585 is the port to which the traffic will be forwarded from the PC to the server over the tunnel "you can use any available port number").
  3. Save the profile

 

Import Profile to OpenVPN Connect App

  1. Open OpenVPN Connect App
  2. Import the edited .ovpn profile
  3. Proceed to the next step

 

Open SSH connection with Port forwarding configured

We're going to open a normal SSH connection to the VPN server using Putty but with a small modification to Putty settings to configure the Port forwarding.

(Assuming that the VPN server IP is 40.40.40.40 and OpenVPN Server is listening to TCP port 443)
  1. Open Putty and follow the screenshots: 



    A: Enter the server IP address
    B: Enter the SSH Port
    C: Click on Tunnels to configure port forwarding

  2. From Tunnels, Configure port forwarding as follows:



    A: Enter the VPN Server IP address followed by colon : followed by OpenVPN Server port number which in our case should look like 40.40.40.40:443
    B: Enter the port number added to the VPN profile, which in our case is 8585
    C: Click Add button
    D: This is how it looks when the forwarded port is added successfully

  3. Back to Session tab to save this SSH session so you don't have to do all this again:



    A: Click on Session
    B: Give this session a name
    C: Click Save
    D: This is how it looks when the session is saved
    E: Click Open to Connect

  4. You're now connected to the server over SSH! (Keep the SSH Session active, minimize Putty, and proceed to the next step)

 

Securely connect to VPN over SSH Tunnel

Now you've SSH Connection open on Putty, leave it open all the time while you're using the VPN.

  1. Back to OpenVPN Connect App
  2. Click the Toggle button beside the VPN profile to connect to the VPN server over SSH tunnel
  3. You're connected!

 

Video Tutorial

The above steps are all demonstrated in the following video.

 

 

  • openvpn, ssh tunnel
  • 660 Users Found This Useful
Was this answer helpful?

Related Articles

I receive HostRound emails in my SPAM box, how to fix this?

We do our best to improve email deliverability, however, some of our emails may land in your...

What is a Ransomware?

Ransomware is a type of malicious software, or malware, designed to deny access to a computer...

How to clear Google Chrome DNS cache

To clear Google Chrome DNS Cache Type this in the address bar  chrome://net-internals/#dns...

How to connect to FTP server using FileZilla

We're going to explain how to connect to FTP server using FileZilla FTP Client. Before you start...

Chrome is showing weird font/ hand writing font/ script font on some websites

If you visit some websites and see weird font displayed on the website instead of the original...