WSL: Fix the Internet Connection while on VPN
Based on this comment, the following instructions worked for me on Ubuntu Linux:
In your WSL Linux instance, create or edit /etc/wsl.conf to look like this:
[network]
generateResolvConf = falseBack in Windows, restart WSL using PowerShell:
wsl --shutdown
wslIn your WSL Linux, create or edit /etc/resolv.conf to use Google Public DNS by creating the following entry (you may or may not have to delete other entries to get it working):
nameserver 8.8.8.8Restart WSL again in PowerShell:
wsl --shutdown
wslFinally, once connected to the VPN, run the following command in Windows PowerShell, substituting <vpn name> with your VPN's name:
Get-NetAdapter | Where-Object {$_.InterfaceDescription -Match "<vpn name>"} | Set-NetIPInterface -InterfaceMetric 6000For example, if your VPN's name is Cisco AnyConnect, the command would look like this:
Get-NetAdapter | Where-Object {$_.InterfaceDescription -Match "Cisco AnyConnect"} | Set-NetIPInterface -InterfaceMetric 6000Broader Topics Related to Fix the Windows Subsystem for Linux internet connection while on VPN

Windows Subsystem for Linux (WSL)
Tips and tricks for using Windows Subsystem for Linux (WSL)