The simplest way to set up PrivateVPN on your Linux machine is through the Network Manager Integration (TUN) method. You can also switch to your preferred PrivateVPN open-source protocol and activate the Kill Switch feature.
The only drawback is the absence of a GUI app, but if you don’t mind manual configurations, then it’s a go.
Keep reading to learn the steps to set up and use PrivateVPN on your Linux system.
How to Set Up PrivateVPN on Linux via Network Manager Integration (TUN)? (Recommended)
Best for beginners and users seeking a simplified setup due to its user-friendly interface and straightforward configuration.
The Network Manager Integration (TUN) method is the recommended setup for PrivateVPN on Linux since it’s more efficient than the TAP and OpenVPN CLI methods for creating a secure point-to-point connection.
To kick things off, ensure you have a stable internet connection and a PrivateVPN subscription.
- Choose a preferred PrivateVPN server location and download it here. I’ll download the Norway – Oslo server.
- Launch the terminal in your Linux system. I’ll use Ubuntu for this guide.
- In the terminal, type the command sudo apt-get install network-manager-openvpn network-manager-openvpn-gnome resolvconf and hit enter.
- Type in the password for your Linux system to activate the installation process.
- Once the download is complete, open System Preferences > Network in your Linux. Click + to add PrivateVPN to your network list.
- Select “Import from file” to import the configuration file for the previously downloaded server location.
- Click “Open” to access the configuration file.
- Enter the following information to set up your PrivateVPN server.
- Name: (preferred name)
- Username: (PrivateVPN registered email address)
- Password: (PrivateVPN password)
- Click “Add” to add the VPN.
- Toggle the button to start the connection process.
- There you go! PrivateVPN is set up on your Linux device. You can now take control of the overall security of your Linux system, including streaming live TV and sports events on platforms such as BBC iPlayer.
How to Set Up PrivateVPN on Linux via OpenVPN Network Manager Integration (TAP)?
Best for proficient to expert users comfortable with command-line tools.
Although the Network Manager Integration (TUN) method is best for setting up PrivateVPN on Linux, you can also try the Network Manager (TAP).
But only use this method if you can’t use the TUN method since this isn’t as modern or straightforward and doesn’t offer the high level of security that TUN does.
It’s better suited for networking scenarios that require bridged connections, and its nature as a bridging tool might expose more information than necessary for typical VPN connections, potentially compromising security.
Follow these stepwise processes to set up PrivateVPN manually on Linux.
- Buy a PrivateVPN subscription. To save more, choose the multiyear plan.
- Download the PrivateVPN certificate here.
- Launch your Linux system. I’ll use Ubuntu 22.04.3 LTS for this guide.
- Open “Files” on your Linux machine to access the PrivateVPN certificate you downloaded.
- Click “Downloads” from the menu bar on the left.
- Right-click the file you downloaded, and select “Extract here” to extract the file.
- Open the Terminal on your Linux system.
- Enter the command sudo apt-get install -y network-manager-openvpn and press enter.
- Enter your system user password to initiate installation.
- Once the installation process is complete, go to Settings > Network. Click + to add the PrivateVPN profile.
- Click “OpenVPN.”
- Enter the following information
- Connection name: PrivateVPN
- Gateway: Depends on your preferred country or server. I connected to the Netherlands server. Here’s a list of servers to help you choose.
- Type: Password
- User name: PrivateVPN user name
- Password: PrivateVPN password
- Click the icon on the right of the “CA certificate” to access the extracted file.
- Locate the extracted file and click Select.
- Click “Advanced” at the bottom of the pop-up box.
- Check the “Use custom gateway port” box. Enter the port number from the Server List. I chose the Netherlands server with port number 21000.
- Check the “Data compression” box and select “LZO” from the dropdown menu.
- Check the “Set virtual device type” and select “TAP” from the dropdown menu.
- Click Apply to save network settings.
- Click Add to add PrivateVPN to your network list.
- Toggle by PrivateVPN to start the connection.
- To disconnect from PrivateVPN, toggle the button again to turn it off.
How to Set Up PrivateVPN for Linux via OpenVPN CLI?
Best for all user levels.
Another way to manually set up PrivateVPN on Linux is to use the OpenVPN CLI method.
This is the best alternative to the TUN method because it operates at the network layer and is great for point-to-point connections. It’s also suitable for most VPN use cases.
Here’s how to set it up:
- Get a PrivateVPN subscription and launch your Linux system. I’ll use Ubuntu 22.04.3 LTS.
- Choose your preferred PrivateVPN server location and download it here. For this guide, I’ll use the US-New Jersey server.
- Launch the terminal on your Linux machine.
- In your terminal, type the command sudo apt-get install openvpn curl and press enter.
- Enter your system password.
- Once the OpenVPN installation is complete, enter Y to continue.
- Enter the command sudo openvpn [path of the server configuration file]. The path should look like: /home/vpnuser/Downloads/PrivateVPN-US-NewJersey-TUN-1194.ovpn.
- Enter your PrivateVPN registered email address and password in Auth username and Auth password to establish the connection.
- Once you get “Initialization Sequence Completed,” you’re connected and can now use PrivateVPN on your Linux system.
How to Set Up PrivateVPN Kill Switch on Linux?
With PrivateVPN’s kill switch, you can add an extra layer of security to your Linux connection.
This way, if you’re working remotely on a confidential project using your Linux machine and your VPN connection drops, the kill switch will immediately cut off your internet, ensuring no one else sees your sensitive work.
Here’s how to set up the PrivateVPN kill switch on Linux:
- Obtain the IP address of the VPN gateway you wish to set up for the kill switch. To do this, choose your preferred server location from this list. For this guide, I’ll use US – New Jersey.
- Take note of the hostname of the VPN gateway under the “Server address.” Since I chose US – New Jersey, the hostname will be us-jer.pvdata.host. I’ll use this alongside PrivateVPN’s OpenVPN-TUN-UDP protocol.
- Launch the terminal in your Linux system. I’ll use Ubuntu for this guide.
- In your terminal, type the host command followed by the hostname of the server location: “host [hostname of the VPN gateway from step 1]” and press Enter. In this case, “host us-jer.pvdata.host.” This will display the IP address of the VPN gateway.
- Next, type the command “route” to find out the name of your Internet Facing Network Interface. You’ll find the name under “Use Iface.”
- Enter the command “cd /etc/openvpn/client” to make changes in the client “.ovpn configuration.”
- Type the command “ls -al” to verify if there is an existing configuration file.
- You’ll get this output if no configuration file exists.
- Copy the sample client.conf file using the command “sudo cp /usr/share/doc/openvpn/examples/sample-config-files/client.conf .”
- Type “sudo nano client.conf” to edit the client.conf file.
- Locate the default remote option.
- Use # to comment out the default remote option.
- Enter the IP address you got in step 4. In this case, 193.37.253.2 2100 udp.
- Click Ctrl + X to display save options and Y to save changes.
To finish setting up the PrivateVPN Kill switch on your Linux machine, you can use iptables or ufw. Let’s explore both:
How to Set Up PrivateVPN Kill Switch Using Iptables?
First, here are the steps to set up PrivateVPN kill switch with Iptables:
- In your Linux terminal, enter the command “nano iptables-ks.sh” to create iptables-ks.sh.
- In the nano editor, paste the content below. Replace the IP address with the IP specific to the server location you selected in step 4. Click Ctrl + X to continue.
The iptable rule set below expunges and removes every pre-existing rule set in iptables. It outrightly drops every outgoing connection other than the one to PrivateVPN server IP in US New Jersey to port 21000 using the UDP protocol. Also, all incoming and outgoing connections are allowed over the virtual network interface TUN0 exclusively.
#!/bin/bash iptables --flush iptables --delete-chain iptables -t nat --flush iptables -t nat --delete-chain iptables -P OUTPUT DROP iptables -A INPUT -j ACCEPT -i lo iptables -A OUTPUT -j ACCEPT -o lo iptables -A OUTPUT -j ACCEPT -d 193.37.253.2/32 -o enp0s3 -p udp -m udp --dport 21000 iptables -A INPUT -j ACCEPT -s 193.37.253.2/32 -i enp0s3 -p udp -m udp --sport 21000 iptables -A INPUT -j ACCEPT -i tun0 iptables -A OUTPUT -j ACCEPT -o tun0
- Click “Y” to select Yes and save changes in the nano editor.
- Run the command “sudo chmod +x iptables-ks.sh # ./iptables-ks.sh” to activate the iptables ruleset for deploying a Kill Switch.
- Enter your system password to continue.
How to Set Up PrivateVPN Kill Switch Using “ufw.”?
And here are the steps to set up PrivateVPN kill switch with ufw.:
- In your Linux terminal, enter the command “nano ufw-ks.sh” to create ufw-ks.sh.
- In the nano editor, paste the content below. Replace the IP address “193.37.253.2” with the IP for your chosen server location. Also, replace the name “enp0s3” with the name you found under “Use Iface.”
ufw --force reset ufw default deny incoming ufw default deny outgoing ufw allow in on tun0 ufw allow out on tun0 ufw allow out on enp0s3 to 193.37.253.2 port 21000 proto udp ufw allow in on enp0s3 from 193.37.253.2 port 21000 proto udp ufw enable
- Press Ctrl + X to access options and press Y to save changes.
- Run the command “# chmod +x ufw-ks.sh # ./ufw-ks.sh.” Then, enter the system password and press enter to activate your kill switch.
There you go!
FAQs
Does PrivateVPN's Linux Set-up Support IPv6?
PrivateVPN’s Linux setup doesn’t support IPv6. For Linux users, you need to disable IPv6 for the service to work properly, as PrivateVPN does not have a native app for Linux.
How to Connect PrivateVPN Dedicated IPs on Linux?
Obtain dedicated IP details from your account to connect to PrivateVPN Dedicated IPs on Linux. Install PrivateVPN CLI, download dedicated IP configuration files, and use the terminal to navigate to the files’ directory. Initiate the connection using the PrivateVPN CLI command with the dedicated IP configuration, enter credentials, and verify the connection matches the assigned dedicated IP.
Ready to Use PrivateVPN for Linux?
Whether streaming content on VLC, browsing through Chromium, or connecting via SSH, PrivateVPN encapsulates your data with Linux-like precision.
Plus, it’s easy to set up!
Ready to get started? Grab these PrivateVPN deals and protect your data!