How to Stop Ubuntu Linux from Automatically Connecting to VPNs

The Silent Reroute

If you configure a Virtual Private Network (VPN) on Ubuntu Linux—perhaps for a corporate intranet or for privacy on public Wi-Fi—the Network Manager has a feature that allows it to automatically connect to that VPN whenever you join a specific Wi-Fi network. While convenient, it can cause massive headaches. If the VPN server goes offline, or if you intentionally want to use your raw, local network connection to access a local printer, Ubuntu might violently reroute your traffic back through the VPN the moment you connect to the Wi-Fi, breaking your local access without you realizing it.

How to Disable Automatic VPN Connections (GUI)

You can manage this setting directly through the standard GNOME Network Settings, detaching the VPN from your primary internet connection.

1. Open the main Ubuntu Settings application.

2. In the left-hand sidebar, click on Network (or Wi-Fi if the trigger is tied to a wireless connection).

3. Find the specific network connection (your home Wi-Fi or Ethernet) that is triggering the VPN.

4. Click the small gear icon next to that specific network name.

5. A dialog box will appear. Click on the General tab at the top.

6. Look for the checkbox labelled Automatically connect to VPN.

7. Untick the checkbox.

8. Click the Apply button in the top right corner.

How to Remove the Trigger via NMCLI

If you are working on a headless server or prefer the terminal, you can sever the automatic connection using the Network Manager Command Line Interface (`nmcli`).

1. Open your terminal.

2. Run the command nmcli connection show to list your networks.

3. Note the exact name of your primary Wi-Fi or Ethernet connection (e.g., “HomeWiFi”).

4. Run the following command to remove the secondary VPN requirement (replace “HomeWiFi” with your connection name):

nmcli connection modify "HomeWiFi" connection.secondaries ""

5. Restart the network manager to apply the changes: sudo systemctl restart NetworkManager

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.