Home Configuring OpenVPN
Post
Cancel

Configuring OpenVPN

Introduction

OpenVPN is an open source VPN that allows you to run your own VPN server.

Server Configuration

  1. Download The Installation Script

    wget https://git.io/vpn -O openvpn-install.sh

  2. Make it executable

    chmod 755 openvpn-install.sh

  3. Execute the script

    ./openvpn-install.sh

  4. Follow the in terminal prompts

NOTE: Use defualt for what port to use unless you know what you are doing

Client Configuration

Linux

Manualy Connect

  1. On the VPN server run ./openvpn-install.sh again and Select 1 to add new user

  2. Enter a Client Name (IE the hostname of the machine that will be using this profile to connect to the server)

  3. copy the Clientname.ovpn file to the Client Machine

  4. Install openvpn on the Client Machine

    Debian based OS: sudo apt install openvpn

  5. Connect to OpenVPN

    sudo openvpn Clientname.ovpn

NOTE: Do not Close terminal or the connection will be lost

Auto-Connect

  1. On the VPN server run ./openvpn-install.sh again and Select 1 to add new user

  2. Enter a Client Name (IE the hostname of the machine that will be using this profile to connect to the server)

  3. copy the Clientname.ovpn file to the Client Machine

  4. Convert the .ovpn file to .conf

    cp Clientname.ovpn Clientname.conf

  5. Install openvpn on the Client Machine

    Debian based OS: sudo apt install openvpn

  6. copy the .conf file to /etc/openvpn

    sudo mv file.conf /etc/openvpn

  7. start the service

    sudo systemctl start openvpn@.conf file name

  8. enable to service to run at start

    sudo systemctl enable openvpn@.conf file name

Useful Commands

I would reccomend creating alias’s for these in your .bashrc file

Disconnecting from the VPN

sudo systemctl stop openvpn@Clientname.conf

Connecting to VPN if Disconnected

sudo systemctl start openvpn@Clientname.conf

Restart the Connection if for some reason you are connected to the VPN and you loose access to the internet

sudo systemctl restart openvpn@Clientname.conf

Windows

  1. On the VPN server run ./openvpn-install.sh again and Select 1 to add new user

  2. Enter a Client Name (IE the hostname of the machine that will be using this profile to connect to the server)

  3. copy the Clientname.ovpn file to the Client Machine

  4. Navigate to OpenVPN Client and Select Windows under OpenVPN Connect

  5. Install OpenVPN Connect

  6. Launch OpenVPN Connect

  7. Select File

  8. Add the Clientname.ovpn file that you coppied from the openvpn server

  9. Select add

  10. Select the toggle next to the VPN to Connect

This post is licensed under CC BY 4.0 by the author.