0

I'm running Wireguard to manage my VPN. I need to be able to use a VPN to access our staging server periodically. Most of the time, by default, I don't want to use the VPN.

Even if I disable the VPN (by toggling the button in the "Network" box), if my machine goes to sleep, when I wake it the VPN is re-enabled.

Is there any way to store the settings, so they're there when I want to turn on my VPN, but not default to keeping the VPN always on.

screenshot of the network panel.

I don't see any settings options that look like they would let you manage auto connecting.

screenshot of the vpn settings


What seemed like it worked was to check the "Use this connection only for routes on its network." box in the IPv6 settings (that toggled it for IPv4 as well).

That stopped working after a few days.

Screenshot showing a checkbox and "Use this connection only for routes on its network."

Thomas Ward
  • 80,112
Amanda
  • 9,753
  • anything of use https://superuser.com/questions/9586/how-do-i-setup-ubuntu-linuxs-network-manager-to-selectively-route-network-traff – graham Jun 11 '25 at 16:59
  • 1
    Can you show us the settings for your VPN? It might be set to autoconnect automatically, which you'll need to shut off on the VPN itself. Hit the gear next to the VPN to check its settings. – Thomas Ward Jun 11 '25 at 17:14
  • What is in the "General" tab? Because that is usually where you control autoconnect settings. – Thomas Ward Jul 08 '25 at 15:58
  • sudo systemctl enable wg-quick@wg0 to enable it, or sudo systemctl disable wg-quick@wg0 to disable it, see docs: https://documentation.ubuntu.com/server/how-to/wireguard-vpn/common-tasks/index.html – Luuk Jul 08 '25 at 16:00
  • 1
    @Luuk that only works if you use the base Wireguard config, not Network Manager's plugins. – Thomas Ward Jul 08 '25 at 16:06

1 Answers1

0

Here's what actually worked: Run nmcli connection show <TAB> and select my connection name --connection.autoconnect was definitely set to "yes"

Using nmcli connection edit {myconnection} and the help option I was able to set it to "no" and save. That does seem to have worked.

Amanda
  • 9,753