How to set up command Line VPN on Linux

You can now manually set up the VPN command line in Linux through PureVPN. Check out the following steps to learn how you can do it in a few minutes.

Written By Fahad Ahmed

Updated at January 1st, 2024

Find your VPN credentials for manual configuration

To find your VPN credentials log into the PureVPN member area. Click 👉 here to visit Member Area.

  • Login to the Member Area using your PureVPN registered email address and password.

  • On Subscription tab scroll down to be able to view your VPN credentials.

  • You will be able to see and copy your VPN credentials.
  • Note down your PureVPN username and click the Eye icon to make your password visible and use it in the manual configuration.

Delete

How to set up PureVPN PPTP via command line on Linux Debian/CentOS

  • First check if the ppp-generic module exists. If it doesn't, the connection will not work. Open your terminal and type:
    modprobe ppp-generic
  • Next, install the PPTP daemon by typing the following in your terminal:
    sudo apt-get install pptp-linux pptpd ppp curl
  • Press “y” and then enter to download and install the packages.
  • Run the command to open Editor and type the following details as mentioned:
    sudo nano /etc/ppp/chap-secrets.
  • Now enter the chap-secrets file as shown below:
    vpnusernamePPTPvpnpassword
  • Press Tab button to give space in place of <tab>
  • Press CTRL+O to save the file, and CTRL+X to exit the editor.
  • Run the following command to create a PureVPN file:
    sudo nano/etc/ppp/peers/purevpn
  • Enter the following information:
    • pty “pptp usca1.pointtoserver.com --nolaunchpppd”
    • name yourVPNusername
    • remotename PPTP
    • require-mppe-128
    • file /etc/ppp/options.pptp
    • ipparam purevpn
  • To save the file, press CTRL+O.  To exit the editor, press CTRL+X.
  • Please note: that we have currently usca1.pointtoserver.com as the server address. You can, however, choose any server of your choice from the servers mentioned in above notes.
  • Now run the command:
    sudo nano /etc/ppp/options.pptp

(Please make sure there is space after sudo and nano)

  • Edit the file as follows and make sure there is no ‘#’ sign before these lines:
  • lock
  • noauth
  • refuse-pap
  • refuse-eap
  • refuse-chap
  • nobsdcomp
  • nodeflate
  • require-mppe-128
  • Once this is done, press CTRL+O to save and CTRL+X to exit.
  • Now run the command below and add the following line in it.
    sudo nano /etc/ppp/ip-up.local
    /sbin/route add default ppp0
  • Once done, Save and Exit the file.
  • In order to execute the file, run the following command:
    sudo chmod 755 /etc/ppp/ip-up.local
  • Connect to the VPN by running:
    sudo pppd call purevpn
  • Use the following command to check the accuracy of your VPN IP and location:
    curl ipinfo.io
  • To disconnect the VPN, type the following command:
    sudo pkill pppd
Delete

Note: If you are unable to connect, please check your connection logs by running the following command:

sudo cat /var/log/messages | grep pppd
Delete

How to set up OpenVPN manually on Command-Line

You can now manually set up the OpenVPN command line in Linux through PureVPN. Check out the following steps to learn how you can do it in a few minutes.

  • The following tutorial works for Linux based OS’ alone, including Mint, Ubuntu, Debian.
  • Press CTRL+ALT+T to access the terminal.

Run command:

sudo apt-get install openvpn


Run command: 

wget

https://d11a57lttb2ffq.cloudfront.net/heartbleed/router/Recommended-CA2.zip


Run command:

unzip New+OVPN+Files.zip


  • Rename the folder by right clicking folder New OVPN Files and change it to Open.


Run command:

cd Open


Run command: 

sudo cp ca.crt TCP/* UDP/* Wdc.key /etc/openvpn/


Run command:

cd /etc/openvpn/

Run command: 

sudo openvpn Sweden-tcp.ovpn 
Delete

Note: In this case the Sweden-tcp server is used to connect to the VPN as an example. You are free to choose any server that best fits your requirements. In order to view all available servers and their names, press the Tab key twice immediately after sudo openvpn.



  • After Enter Auth Username, enter your VPN's username.
  • After Enter Auth Password, enter your VPN's password.


  • An initialization sequence will commence, and upon completion will present connection logs.


  • To disconnect: It is as simple as closing the terminal or pressing CTRL+C in order to terminate the VPN connection.

Delete