How to Install and Configure an Anonymous VPN on Ubuntu Using OpenVPN and WireGuard

Using a VPN (Virtual Private Network) ensures your online activities remain private and secure. This guide covers installing and configuring an anonymous VPN on Ubuntu using OpenVPN and WireGuard


Step 1: Choose a VPS Provider

Before proceeding, select a reliable VPS plan for your VPS:

Ensure the provider offers OpenVPN/WireGuard configuration files.


Installing and Configuring OpenVPN

Step 2: Install OpenVPN

To use OpenVPN, install the necessary packages:

sudo apt update
sudo apt install openvpn network-manager-openvpn network-manager-openvpn-gnome

Step 3: Download OpenVPN Configuration Files

  1. Log in to your VPN provider’s website.
  2. Download the OpenVPN configuration files (.ovpn) for your desired server locations.

Step 4: Add OpenVPN to Network Manager

  1. Open Settings > Network > VPN.
  2. Click + to add a new VPN.
  3. Select Import from file.
  4. Choose the downloaded .ovpn file.
  5. Enter your VPN credentials (username and password).
  6. Save the configuration.

Step 5: Connect to the VPN

  1. Go to Settings > Network > VPN.
  2. Toggle the VPN connection ON to connect.
  3. Verify the connection by checking your IP address: curl ifconfig.me

Installing and Configuring WireGuard

Step 6: Install WireGuard

WireGuard is a lightweight and fast VPN protocol. To install it, run:

sudo apt update
sudo apt install wireguard

Step 7: Download WireGuard Configuration Files

  1. Log in to your VPN provider’s website.
  2. Download the WireGuard configuration files (.conf) for your desired server locations.

Step 8: Configure WireGuard

  1. Move the downloaded .conf file to the /etc/wireguard/ directory: sudo mv /path/to/your-config.conf /etc/wireguard/wg0.conf
  2. Set the appropriate file permissions: sudo chmod 600 /etc/wireguard/wg0.conf

Step 9: Start WireGuard

Activate the WireGuard VPN connection:

sudo wg-quick up wg0

To disconnect:

sudo wg-quick down wg0

Step 10: Enable WireGuard on Boot

To ensure WireGuard starts automatically on boot:

sudo systemctl enable wg-quick@wg0

Step 11: Test Your VPN Connection

  1. Check IP Address: Ensure your public IP address has changed: curl ifconfig.me
  2. DNS Leak Test: Visit https://dnsleaktest.com to confirm your DNS requests are routed through the VPN.
  3. WebRTC Leak Test: Check for WebRTC leaks on https://browserleaks.com/webrtc.

Troubleshooting

  1. OpenVPN Issues: Ensure credentials and .ovpn files are correct.
  2. WireGuard Conflicts: Verify file permissions and configuration settings.
  3. Firewall Problems: Ensure your firewall is configured to allow VPN traffic.

Conclusion

By following these steps, you’ve installed and configured an anonymous VPN on Ubuntu using both OpenVPN and WireGuard. A VPN enhances your online privacy, protects your data, and keeps your connection secure. Keep your VPN software and configuration files updated for optimal security.

Scroll to Top