Prevent Windows from auto-disconnecting Wi-fi when a VPN session is established
Perhaps this is the most irritating issue for VPN users on Windows. You connect to a Wi-fi network, establish a VPN session to your office and happily start using it when suddenly Internet connection is lost and the VPN session is dropped. What is the cause and how to fix this issue? This article will summarize my findings and provide some suggestions.
Identifying the exact symptoms
The first step is to identify the exact problem causing Internet connection to be lost. There are three possible scenarios:
- The connection to the wireless network is dropped and you have to re-connect to the network by selecting it from the list of available networks
- The wireless card is turned off and you have to turn it on, either via software or by pressing some button on the keyboards
- The connection to the wireless network is maintained and the VPN session is still active, just that you cannot surf the Internet
If you issue resembles (3), most likely because the “Use default gateway on remote network” property for the VPN connection is enabled, and Windows automatically routes all Internet traffic through the VPN connection, which may not have Internet access, as is the case for VPNs to many organizations. Refer to my previous article for more information on how to fix this issue.
If your issue is (2), most likely you are on a laptop and some intelligent power management scheme of the laptop has decided that there should only be one active connection at any time. The power management algorithm therefore decides to turn off the wireless card in order to save power. If this is the case, try the following suggestions:
- Check the BIOS for any option called ‘LAN/WLAN switching’ or similar, and disable it.
- Try to connect to an AC outlet, which may disable any power saving scheme and allows the wireless card to function normally
- If you must use battery, switch the active power plan on Windows to “Maximum Performance”
- Failing all of the above, uninstall any OEM power management software on the machine. In my experience, these applications do not serve much purpose and just waste system resources.
Root cause: VPN connection appears as Ethernet to Windows
The root cause of all the above issues, (1), (2) and (3), is that the VPN connection, most likely created by some third party companies such as OpenVPN, works by creating an emulated Ethernet connection, causing the machine to think that the computer is now on Ethernet, which it assumes to be more reliable than Wi-fi, and disables the Wi-fi connection to save power. You can confirm this by checking the network adapter list on Windows to see if there are any Ethernet connections not corresponding to physical adapters on your machine that gets connected when the VPN session is established:
In the above screenshot, Ethernet 3 on TAP-Windows Adapter V9 is actually the emulated Ethernet connection created by my VPN software.
Fixing the issue
So how to fix the issue? The first step is to give the Wi-fi connection higher priority then the rest of the connections. This can be done by opening the list of network connections in Control Panel, press the ALT key to show the menu if necessary, select Adavanced > Advanced Settings, choose the Adapters and Bindings tab, and move the Wi-fi connection to the top of the list:
If this does not work, the next step is to turn off the relevant Group Policy setting. Run gpedit.msc, browse to Computer Configuration > Administrative Templates > Network > Windows Connection Manager, and disable the “Minimize the number of simultaneous connections to the Internet or a Windows domain” policy. Reboot your computer for changes to take effect.
If this still does not help, the next thing to try is to turn off the Network Location Awareness service. This is a Microsoft service that allows Windows to detect whether or not your current connection allows you to browse the Internet, and whether a login is necessary (for example, on public wireless networks). It also disables wireless connections whenever it thinks they are not necessary, causing the issue. You can safely turn off this service and will still be able to use the Internet normally by opening Control Panel > Administrative Tools > Services, select the Network Location Awareness service from the list, and disable it in the Properties windows:
Also, some wireless network cards have a property called “Minimum Power Consumption” and “Disabled Upon Wired Connection” which may interfere with Ethernet connections. Disable it by opening the property page for the wireless network card in Device Manager, and choosing the Advanced tab:
If you have tried all of these and still cannot get it to work, uninstall all OEM power/wireless management software and revert to using standard Windows interface such as the Wireless Zero Configuration service for wireless management. Check your startup list for any unknown/unidentified process and disable them. On laptops made by Acer and Lenovo, there might be well-hidden OEM Visual Basic Scripts to disable the wireless connection when an Ethernet connection is detected. On one of my machines which still liked to disconnect the wireless connection even after trying all of the above suggestions, it was the iPass connection application for Windows which caused the issue. iPass is a paid Wi-fi service and its application probably has decided that user no longer needs to use their Wi-fi connection if they are on Ethernet, hence disconnecting my wireless connection even though I was actually on a VPN.
Thanks but these did not fix it for me, on a HP laptop, but this did:
https://forums.openvpn.net/viewtopic.php?t=26538
“Disabling the LanWlanSwitchingService solved the issue.”
Fixed the Bitdefender VPN that disconnect right away.
Disabled the capacity to power off periferal when wifi is not connected.
Now VPN connect and still connected.
Thanks