How to Auto-Connect VPN After Wi-Fi on KDE with Arch Linux
5:21 PMWant 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:
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:
Step 3: Configure VPN auto-connect
Option A: WireGuard/OpenVPN as VPN profile
If your VPN was imported as a proper VPN type:
Replace "mega-us"
with your VPN’s name.
If you get an error like:
…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.
Step 4: Test your setup
Reconnect Wi-Fi to confirm the VPN starts:
Your VPN should activate immediately after Wi-Fi connects.
Troubleshooting VPN Auto-Connect in KDE
If your VPN doesn’t auto-connect after Wi-Fi, try these fixes:
-
VPN not starting at all
Open KDE System Settings → Connections → Wi-Fi → General Configuration. Make sure “Automatically connect to VPN when using this connection” is checked. -
Wrong VPN profile selected
Double-check you picked the correct VPN name in the dropdown. Profiles often have similar names. -
WireGuard imported as “Ethernet”
If your WireGuard profile was imported incorrectly, remove and re-import it as a VPN type: -
Check logs for errors
Run:Reconnect Wi-Fi and watch for VPN-related errors.
-
Prevent DNS leaks
Some VPNs don’t enforce DNS by default. In KDE’s VPN settings, enable Use custom DNS servers (e.g.,1.1.1.1
or your VPN provider’s DNS).
0 comments