How to Connect Linux to a VPN

With OpenVPN or WireGuard, including a real limitation of NetworkManager when importing WireGuard configs via the graphical interface.

Intermediate 1 min read Published on 2026 By Equipo SolucionaPC

How you connect depends on the protocol your VPN provider uses — OpenVPN and WireGuard are the two most common, and they're managed somewhat differently.

OpenVPN (the simplest route, with a graphical interface)

  1. Download the configuration file (.ovpn) from your VPN provider.
  2. Network Settings → VPN section → "+" → "Import from file".
  3. Select the downloaded .ovpn file.
  4. Add your username and password on the authentication tab if it asks for them.
  5. Turn on the switch next to the newly created connection.

If your distribution doesn't support OpenVPN out of the box in NetworkManager, install the plugin: sudo apt install network-manager-openvpn (Debian/Ubuntu) and log out and back in for it to take effect.

WireGuard (faster, but with a real caveat)

Graphical import of WireGuard configurations fails often — NetworkManager's "Import from file" button is designed mainly for OpenVPN (and Cisco-type configs), not WireGuard, even though the file may look compatible. If you get an error importing it, you haven't done anything wrong — it's a known interface limitation.

The reliable alternative is entering the details manually, or using the terminal:

nmcli connection import type wireguard file your-config.conf

This command correctly imports what the graphical interface sometimes rejects — and the connection created this way also shows up afterwards in the graphical panel to turn it on or off normally.

Checking the VPN is genuinely working

curl ifconfig.me

Compare the IP it returns with your normal IP (without VPN) — if they're different, the connection is working and routing your traffic correctly.

Frequently asked questions

Why does importing my WireGuard configuration fail from the graphical interface?

It's a known NetworkManager limitation — its import button is designed mainly for OpenVPN. Use the 'nmcli connection import' command from the terminal, which does correctly import WireGuard configurations.

How do I check that my VPN is genuinely working?

Run 'curl ifconfig.me' before and after connecting the VPN — if the IP address shown changes, the connection is routing your traffic correctly.

Is WireGuard better than OpenVPN?

WireGuard tends to be faster and with simpler code (smaller attack surface), though OpenVPN remains more mature and with better graphical support built into many distributions.

Share: