The following steps will enable your system to run a script everytime the cisco anyclient is connected to the vpn. The script will alter the priority of the vpn interface to enable wsl2 to use it, and it will configure the wsl instance to use the dns servers configured in the vpn interface.
- Copy the wsl2workaround.ps1 script to C:\dev
- Open scheduled tasks and import wsl2workaround-start.xml and wsl2workaround-stop.xml
- Disable creation of resolv.conf in your WSL2 instance by creating the
/etc/wsl.conf
with the following contents
[network]
generateResolvConf = false
- Remove (if present) the /etc/resolv.conf file
- Create a new symlink with
ln -s /mnt/c/dev/wsl2workaround-resolv.conf /etc/resolv.conf
- You need to launch your wsl instance prior to connecting to VPN for this to work.