The WSL2 issue with Cisco VPN connections, specifically related to network connectivity and DNS resolution,
has not been completely solved, but there are workarounds and solutions available.
While some users report that the mirrored networking mode (a feature introduced in recent WSL versions)
resolves the problem, others continue to experience issues and require specific configurations or scripts
to ensure proper functionality.
When a Cisco VPN (like Cisco AnyConnect) is connected, it can interfere with WSL2's network connectivity and DNS resolution.
The VPN often changes the network configuration (e.g., DNS servers, routing metrics) which WSL2 doesn't
automatically pick up.
This can lead to WSL2 instances being unable to resolve domain names or even access the internet.
This is a feature in recent WSL versions that aims to improve network connectivity in various scenarios,
including VPN usage. It can be enabled in the .wslconfig
file using [experimental] networkingMode=mirrored
.
Scripts can be created to automatically update the WSL2's resolv.conf
file with the correct DNS server information
when the VPN connects or disconnects. These scripts typically use PowerShell to retrieve the DNS settings from
the Windows system and apply them to WSL2.
Adjusting the network interface metrics for the VPN adapter can help prioritize the VPN's network traffic.
This can be done using PowerShell or the Task Scheduler.
Some users have found that starting WSL2 before connecting to the VPN helps avoid some connectivity issues.
In some cases, rebooting the computer can resolve temporary network issues.
In some instances, switching to a different version of the Cisco VPN client (e.g., the one from the Microsoft Store)
has been reported to help.