How to Import and Export a WireGuard VPN Using Network Manager (Manjaro, Ubuntu, etc.)

This tutorial walks you through importing and exporting WireGuard VPN configurations using Network Manager on Linux (Manjaro, Ubuntu, etc.). Includes GUI and CLI instructions.

TL;DR

  • Install network-manager-wireguard.
  • Import/export configs easily via GUI or nmcli.
  • Transfer VPN profiles between machines in seconds.
  • Works on Manjaro, Ubuntu, Fedora, and others.

Introduction

WireGuard is a fast, secure VPN that's incredibly simple to use. While most guides focus on importing configs, what if you want to export a VPN configuration from one machine and import it to another? 🛫 ➔ 🛬

In this tutorial, you'll learn:

  • How to import a WireGuard VPN config using Network Manager.
  • How to export your VPN config using nmcli.
  • How to transfer configs between machines smoothly.

Prerequisites

  • Linux system (tested on Manjaro, Ubuntu, Fedora)
  • WireGuard VPN profile (or an existing connection to export)
  • vim editor for tweaks (optional but useful)
  • SSH/USB for file transfer between machines

Step 1️⃣: Install Network Manager WireGuard Plugin

Manjaro / Arch:

sudo pacman -Syu networkmanager wireguard-tools networkmanager-wireguard

Ubuntu / Debian:

sudo apt update
sudo apt install network-manager wireguard wireguard-tools network-manager-wireguard-gnome

Fedora:

sudo dnf install NetworkManager-wireguard wireguard-tools

Check it's working:

nmcli connection show --active | grep wireguard

Step 2️⃣: Import WireGuard Config (GUI & CLI)

(Same as before—see earlier sections for full instructions on GUI and nmcli import.)

Example CLI:

nmcli connection import type wireguard file ~/vpn-configs/myvpn.conf

🆕 Step 3️⃣: Export WireGuard VPN Config Using nmcli

1️⃣ List your connections:

nmcli connection show

Locate your VPN connection name (e.g., myvpn).

2️⃣ Export the VPN config to a file:

nmcli connection export myvpn > ~/vpn-configs/myvpn-exported.conf

Example:

nmcli connection export myvpn > ~/vpn-configs/myvpn-exported.conf

3️⃣ Transfer the file to another machine:

  • Use SCP:
scp ~/vpn-configs/myvpn-exported.conf user@remote-host:~/vpn-configs/
  • Or use a USB drive / cloud sync.

Step 4️⃣: Import on Another Machine

On your second machine:

1️⃣ Install the required Network Manager plugins (Step 1).

2️⃣ Import the exported config:

nmcli connection import type wireguard file ~/vpn-configs/myvpn-exported.conf

3️⃣ Connect:

nmcli connection up myvpn

✅ Done! Your VPN is now fully transferred and operational on the new system.


Bonus: Edit Config via vim

After importing, you can tweak your settings:

vim /etc/NetworkManager/system-connections/myvpn.nmconnection

Reload:

nmcli connection reload

Troubleshooting

(Same as before—plus one extra)

  • Issue: Error "export not supported for this connection type"
    Fix: Make sure your VPN was originally imported or created via Network Manager. Manually added configs outside NM might need to be copied directly from /etc/NetworkManager/system-connections/.

Conclusion

With these steps, you can import and export WireGuard VPN configurations seamlessly using Network Manager—whether you're setting up a new laptop, migrating between machines, or backing up your VPN settings.

No more re-typing keys or recreating configs from scratch—nmcli makes it simple.

References