Want your VPN to start automatically when your Wi-Fi connects on Arch Linux with KDE Plasma? You can do this with nmcli
or directly in KDE’s NetworkManager settings. This setup ensures your VPN is always active, keeping your connection secure from the moment you go online.
Step 1: Show all saved connections
Run this to see your Wi-Fi and VPN profiles:
nmcli connection show
Note the names of your Wi-Fi (e.g., The Promised LAN) and VPN connection.
Step 2: Enable Wi-Fi auto-connect
Make sure your Wi-Fi always connects first:
nmcli connection modify "The Promised LAN" connection.autoconnect yes
nmcli connection modify "The Promised LAN" connection.autoconnect-priority 10
Step 3: Configure VPN auto-connect
Option A: WireGuard/OpenVPN as VPN profile
If your VPN was imported as a proper VPN type:
nmcli connection modify "The Promised LAN" connection.secondaries "mega-us"
Replace "mega-us"
with your VPN’s name.
If you get an error like:
'mega-us' is not a VPN connection profile
…it means your VPN wasn’t recognized as a VPN type by NetworkManager.
Option B: Any VPN type (recommended via KDE GUI)
-
Open System Settings in KDE.
-
Go to Connections → select your Wi-Fi.
-
Click Edit → General Configuration.
-
Check Automatically connect to VPN when using this connection.
-
Select your VPN profile from the dropdown.
This works with WireGuard, OpenVPN, L2TP, and all supported VPNs.