Using the VPN with Windows Subsystem for Linux (WSL)

Environment

Windows Subsystem for Linux (WSL)

Issue

How do I use the VPN with Windows Subsystem for Linux (WSL)? Note that this is not a supported use of the VPN.

Resolution

Windows Subsystem for Linux (WSL) allows Windows 10 devices to run Linux binary within Windows. WSL2, announced in 2019 now uses a full Linux kernel.

Note: using the VPN with WSL is not a supported use.

When using the VPN on a Windows when running WSL1, the Linux subsystem maintained all network connectivity and there are generally no problems. However, with the move to WSL2, all network connectivity is lost in the virtualized Linux system when using the VPN on the Windows system. 

Following are the options that may help solve the issue.

  • Downgrade to WSL1 - If this is possible you will be able to use linux while running the Windows VPN
  • Do not use the Windows VPN, but install the client for Linux onto your Linux subsystem 
  • Modify settings allowing the virtualized Linux machine to maintain network connectivity
    • These changes are listed below:
  1. Create (or edit) /etc/wsl.conf to include the following
[network]
generateResolvConf = false
  1. Remove resolv.conf
sudo rm /etc/resolv.con
  1. Create a new resolv.conf
sudo touch /etc/resolv.con

  1. Edit the new resolv.conf to include the University DNS servers
nameserver 141.211.0.36 
nameserver 141.211.0.37​
  1. To prevent the resolve.conf file from being overwritten when you restart the shell run the following command.
sudo chattr +i /etc/resolv.conf

*If you have to re-edit the file you can unlock it by running this command

sudo chattr -i /etc/resolv.conf
  1. Back in Windows, open a powershell window and run the following command.
Get-NetAdapter | Where-Object {$_.InterfaceDescription -Match "Cisco AnyConnect"} | Set-NetIPInterface -InterfaceMetric 6000

This will remain until you reboot your machine.  After you reboot you should only need to re-run step 6

Additional Information

For a supported Linux-native VPN, see: Download the Linux VPN Profile.

Need information or assistance on other technical issues? Contact the ITS Service Center.

Details

Article ID: 4097
Created
Wed 12/9/20 2:15 PM
Modified
Tue 7/18/23 3:23 PM