How to Setup OpenVPN Command Line on Linux

This guide describes the command line setup of OpenVPN connection type on various most popular Linux distributions. OpenVPN is strongly recommended for Linux since the support of open source technologies (like OpenVPN) on Linux is much better than proprietary technologies such as PPTP. The guide uses Ubuntu 17 for demonstration purposes.

To set up OpenVPN on Linux, you will need:

Follow the steps below to configure OpenVPN on Linux devices via CLI :

1. Login as a root user. If you are not a root user, run the following command and click the Enter key.

sudo -i

Example of the Command Line screen in Linux

2. Type your root password and press Enter.

3. Now it is necessary to install the OpenVPN package on your Linux system. For this, type the command below and press Enter.

For Debian, Ubuntu, Mint:

sudo apt-get install openvpn

OpenVPN commands are shown as entered into Linux

For Fedora, CentOS:

sudo yum install openvpn

or

sudo dnf install openvpn

For Arch, Manjaro:

sudo pacman -S openvpn

For openSUSE:

zypper install openvpn

4. Enter the following command to change a directory for FastVPN config files:

cd /tmp

Command text used to unzip Document files in Linux

5. Run the command below to save the FastVPN OpenVPN configs zip file from our repository. Press the Enter key and proceed to the next step.

wget https://vpn.ncapi.io/groupedServerList.zip


6. Unzip the configs files into your Documents directory by using the following command and press Enter:

unzip groupedServerList.zip


7.  After all the required configuration files are unzipped, they will be shown in the terminal window:


8. Use the command below to create an openvpn directory and move ovpn config files there:

mkdir -p /etc/openvpn && mv tcp /etc/openvpn && mv udp /etc/openvpn && rm -f groupedServerList.zip



9. Depending on which protocol is preferable for you, you can connect to FVPN running the following commands:
               
For UDP:  
             
sudo openvpn --config /etc/openvpn/udp/NCVPN-AU-Melbourne-UDP.ovpn --daemon

For TCP:  
             
sudo openvpn --config /etc/openvpn/tcp/NCVPN-AU-Melbourne-TCP.ovpn --daemon

 NOTE: "NCVPN-AU-Melbourne-TCP.ovpn" and "NCVPN-AU-Melbourne-TCP.ovpn" can be changed to any preferred location from groupedServerList.zip


10. Enter your FastVPN Auth Username and Auth Password available from the FastVPN Account Panel:


Congratulations! The setup of FastVPN connection has been completed.

11. To verify that your VPN connection is successful, wait for about a minute and enter the command below:

curl https://ipinfo.io/ip

You will see your new public IP address:


NOTE: You can check what VPN connection is currently running by entering: ps aux|grep openvpn


12. In order to change your VPN connection, you need to stop all active VPN connections first. For this, run the command:

sudo killall openvpn


After that, please follow the Steps 9-10 to connect to any other preferred location.

13. To disconnect from VPN, use the following command:

sudo killall openvpn


That's it! Now FastVPN is successfully configured on your Linux.

If you need any further assistance, please contact our Support Team.
Updated
Viewed
19919 times

Need help? We're always here for you.

notmyip