Introduction
OpenVPN is an open source VPN that allows you to run your own VPN server.
Server Configuration
- Download The Installation Script
wget https://git.io/vpn -O openvpn-install.sh - Make it executable
chmod 755 openvpn-install.sh - Execute the script
./openvpn-install.sh - 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
-
On the VPN server run
./openvpn-install.shagain and Select 1 to add new user -
Enter a Client Name (IE the hostname of the machine that will be using this profile to connect to the server)
-
copy the Clientname.ovpn file to the Client Machine
- Install openvpn on the Client Machine
Debian based OS:
sudo apt install openvpn - Connect to OpenVPN
sudo openvpn Clientname.ovpn
NOTE: Do not Close terminal or the connection will be lost
Auto-Connect
-
On the VPN server run
./openvpn-install.shagain and Select 1 to add new user -
Enter a Client Name (IE the hostname of the machine that will be using this profile to connect to the server)
-
copy the Clientname.ovpn file to the Client Machine
- Convert the .ovpn file to .conf
cp Clientname.ovpn Clientname.conf - Install openvpn on the Client Machine
Debian based OS:
sudo apt install openvpn - copy the .conf file to /etc/openvpn
sudo mv file.conf /etc/openvpn - start the service
sudo systemctl start openvpn@.conf file name - 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
-
On the VPN server run
./openvpn-install.shagain and Select 1 to add new user -
Enter a Client Name (IE the hostname of the machine that will be using this profile to connect to the server)
-
copy the Clientname.ovpn file to the Client Machine
-
Navigate to OpenVPN Client and Select Windows under OpenVPN Connect
-
Install OpenVPN Connect
-
Launch OpenVPN Connect
-
Select File
-
Add the Clientname.ovpn file that you coppied from the openvpn server
-
Select add
-
Select the toggle next to the VPN to Connect