How to Configure a VPN on Ubuntu Desktop?
Configuring a Virtual Private Network (VPN) on an Ubuntu desktop enhances your online privacy and allows secure access to remote networks. This guide provides a straightforward walkthrough for setting up a VPN using the built-in Network Manager, covering the preparation steps, the step-by-step configuration process, and how to verify that your connection is secure.
Prerequisites Before Configuration
Before starting the setup, ensure you have the necessary information from your VPN provider or network administrator. You will typically need:
- The VPN server address (IP or domain name).
- Your login credentials (username and password).
- Any required security certificates or pre-shared keys.
- The VPN protocol type (such as OpenVPN, L2TP, or WireGuard).
Step-by-Step VPN Setup on Ubuntu
Ubuntu’s native network management tools make it easy to add a VPN connection without needing third-party software for standard protocols.
1. Install Required VPN Packages
While Ubuntu supports VPNs out of the box, you may need to install specific plugins depending on your protocol. Open your terminal and run the appropriate command:
- For OpenVPN:
sudo apt install network-manager-openvpn-gnome - For L2TP:
sudo apt install network-manager-l2tp-gnome - For StrongSwan/IKEv2:
sudo apt install network-manager-strongswan
Restart the network manager after installation by running
sudo systemctl restart NetworkManager.
2. Open Network Settings
Click on the network icon (Wi-Fi or Ethernet) in the top-right corner of your desktop screen and select Settings. In the left sidebar of the settings window, click on Network.
3. Add a New VPN Connection
In the Network menu, locate the VPN section and click the + (plus) button. A window will appear asking you to choose a VPN connection type.
If your provider gave you a configuration file (like a
.ovpn file), select Import from file… and
open that file to automatically fill in the settings. Otherwise, select
the specific protocol type you intend to configure manually.
4. Enter Your Connection Details
In the configuration window, fill in the required fields:
- Name: Give your VPN connection a recognizable name.
- Gateway: Enter the VPN server address.
- Authentication: Input your username and password, or select the provided certificate files.
Click Add in the top right corner to save your settings.
Connecting and Verifying the VPN
Once configured, you can quickly turn the VPN on or off.
How to Connect
Click the network icon in the top-right corner of your screen, click on VPN, and select Connect. The toggle switch will turn green, and a small padlock or VPN icon will appear in your top status bar, indicating an active connection.
How to Verify the Connection
To ensure your traffic is successfully routing through the VPN, open a web browser and search “What is my IP”. Compare the result to your actual location; if it displays the location of the VPN server, your connection is secure and operational.