WSL2 fails to make HTTPS connection if Windows is using VPN
-
Your Windows build number: Microsoft Windows [Version 10.0.19013.1122]
-
What you're doing and what's happening:
- Open WSL 2 terminal (Ubuntu) and type:
wget --timeout=30 http://packages.microsoft.com/ubuntu/18.04/prod, which succeeds. - In WSL 2, type:
wget --timeout=30 https://packages.microsoft.com/ubuntu/18.04/prod, which also succeeds. - Connect through a VPN on Windows using the built-in VPN client.
- In WSL 2, type:
wget --timeout=30 http://packages.microsoft.com/ubuntu/18.04/prod, which still succeeds. - In WSL 2, type:
wget --timeout=30 https://packages.microsoft.com/ubuntu/18.04/prod, which fails with message "Unable to establish SSL connection". - (control) In Powershell, type
wget -TimeoutSec 30 https://packages.microsoft.com/ubuntu/18.04/prod, which still succeeds.
-
What's wrong / what should be happening instead: The 5th step should also have been succeeded.
-
Notes:
- To be sure that it's not a firewall issue, I've included all network connections, including the VPN connection to the Private group
- The
datecommand in WSL shows correct date-time. - I've also tried with
--no-hstsand--no-check-certificateoptions, but result is the same - I've also tested from
firefox(in WSL) and it also waited for "Performing a TSL handshake to packages.microsoft.com", couldn't finish connection and gave "The connection has timed out" error after a while. - To be sure that it's not an network adapter issue, I've tested it by using both Wireless and Ethernet connections, which also connects to different ISPs.
Unable to reproduce on 19025.1 with OpenVPN GUI. (am aware it was explicitly mentioned using the built-in VPN client, but just providing this for reference)
Unable to reproduce on 19025.1 with OpenVPN GUI. (am aware it was explicitly mentioned using the built-in VPN client, but just providing this for reference)
Thank you for your attention. However, the VPN server I'm using do not support OpenVPN. It supports IPSec IKEv2 (which built-in VPN uses) and Wireguard. I've also tested the issue with Wireguard (running on Windows, not WSL) but unfortunately the result was the same.
For what it's worth- I'm having a similar issue with VPN functionality and current insider builds. I'm using Viscosity (1.8.2) and once I connect the VPN, my vEthernet connection for WSL somehow becomes 'unplugged' until I reboot the machine. Shutting down the VM doesn't resolve the issue. My current insider build is 19028.vb_release.191115-1325
I'm having a similar issue using Pritunl client. Even if I don't activate it, if my computer sleeps, any connectivity is lost in WSL2. like @Einlanzerous, shutting down the VM doesn't help, logging out doesn't help. I have to restart it. 🤷🏻♂️
After uninstalling the Pritunl client, it seems I don't get the intermittent any connection on WSL2.
Same. Using Windows10's built-in VPN with type L2TP/IPsec. WSL 2 unable to connect to the internet.
Example: apt update fails with:
Temporary failure resolving 'deb.debian.org'
What works:
- Turning off VPN
- Switching back to WSL 1
Thank you for the support. It still fails with the newest Windows build (19041.1). I did some tests using Wireshark and it looks like, the TLS Handshake fails in the beginning. The ClientHello packet looks intact, while the ClientServer packet looks broken.
I'm having this same issue using Wireguard / Firefox Private Network, both of which use Mullvad over the Wireguard protocol.
I'm using Windows insider build 19041.1.
I'm not sure if this is relevant, but it looks like Wireguard is changing the route table in WSL. It looks like Wireguard replaces all routes that point to the IP address in /etc/resolv.conf with the Wireguard address:
# no Wireguard:
cat /etc/resolv.conf
# This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/wsl.conf:
# [network]
# generateResolvConf = false
nameserver 172.22.0.1
netstat.exe -rn
...
IPv4 Route Table
===========================================================================
Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 192.168.0.1 192.168.0.3 35
127.0.0.0 255.0.0.0 On-link 127.0.0.1 331
127.0.0.1 255.255.255.255 On-link 127.0.0.1 331
127.255.255.255 255.255.255.255 On-link 127.0.0.1 331
172.22.0.0 255.255.240.0 On-link 172.22.0.1 5256
172.22.0.1 255.255.255.255 On-link 172.22.0.1 5256
172.22.15.255 255.255.255.255 On-link 172.22.0.1 5256
172.27.192.0 255.255.240.0 On-link 172.27.192.1 5256
172.27.192.1 255.255.255.255 On-link 172.27.192.1 5256
...
# with wireguard (10.99.72.157)
IPv4 Route Table
===========================================================================
Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 192.168.0.1 192.168.0.3 35
0.0.0.0 128.0.0.0 On-link 10.99.72.157 5
10.99.72.157 255.255.255.255 On-link 10.99.72.157 261
127.0.0.0 255.0.0.0 On-link 127.0.0.1 331
127.0.0.1 255.255.255.255 On-link 127.0.0.1 331
127.255.255.255 255.255.255.255 On-link 127.0.0.1 331
127.255.255.255 255.255.255.255 On-link 10.99.72.157 261
I also have issue that when Pritunl is connected, I have no connectivity from WSL2. It's important to note that if the VPN profile only forwards private traffic, WSL2 is blocked only for private IPs, but if the profile is forwarding everything, WSL2 can't reach anything.
I have the same issue that as @thisguychris mentioned that WSL2 completely loses connectivity after my laptop sleeps.
Today, (coincidentally) I've tested to install an Ubuntu Server VM using the Hyper-V. Then, I thought that might be the Hyper-V and it's networking that's causing trouble. I made it use the Default Hyper-V switch to make it more distinctive (WSL uses it's own Hyper-V switch).
It turned out that when the VPN is up, the https connections from the VM also ceased. So, that's most likely about how Windows' networking works and it's the one that's causing problem. When I look at the Network adapters page, the VPN is setup as a WAN Miniport, and the Hyper-V adapters are setup as virtual ethernet adapters:

When I look at the properties page of the VPN, one thing I've noticed is that the Security is maintained by using machine certificates, which might be a case, because the VM doesn't have those certificates (Just thinking :) ):

I'll investigate further, but I'll be grateful if some of you can also check both the VPN configuration (if it's similar to mine) and the connectivity from a VM. Thanks.
I can reproduce the VPN issue with Cisco AnyConnect 4.5.04029, impossible to ping or get data from any domain or IP when active, but works again the moment the VPN connection is disabled.
same issue, and the workaround is switch back to WSL1.
I would be cool is we don't have to switch back to wsl 1
I am having the same issue with Cisco AnyConnect and windows build 19564
Any updates to this? I've found WSL1's filesystem increasingly unstable, so am trying to switch to WSL2, but the network does not work with Pulse Secure, either. Same behaviour as described here and elsewhere - the network completely fails to connect, and after activating the VPN, a full shutdown and restart of WSL is required to restore network access.
This issue was finally fixed for me a week ago. Not sure what did it but my combination of usage was as follows:
- Windows inside slow ring (now off) after 19041.xxx
- WSL 2 using Pengwin (Wlinux)
- Windows terminal
- Cyberghost VPN
@blaine, unfortunately, no updates on the problem. But I'm getting the impression that the problem might be about the VPN protocol (i.e. IKEv2) and the authentication method (machine certificates).
@numbfall, I think your problem is solved, because Cyberghost is using a different VPN protocol. It says Cyberghost is supporting "OpenVPN, L2TP-IPsec and PPTP protocols" on their webpage. @numbfall, can you check your VPN settings and tell which type of protocol (OpenVPN, PPTP, etc.) and authentication method (username/password or machine certificate) is used?
Thank you.
@blaine @emrahkaya It's set to use OpenVPN. I have never been able to get IKEv2 to work with my Windows, using the windows built-in VPN settings or Cyberghost client.
However, note that I had the issue described in the title with same VPN protocols (OpenVPN) since WSL 2 came out last year on the slow ring. I had to turn off VPN every time I needed to run apt update or yarn upgrade etc. This was only solved a week ago.
This could very well be a solution from the distro side, maybe... I skimmed the release notes of Pengwin but didn't see anything relevant. So I really don't have a clue what really solved the issue.
@emrahkaya I'm using Pulse Secure. Type of VPN is SSTP. In the Authentication section, PAP, CHAP, and MS-CHAPv2 are ticked.
Also having this problem with a Cisco Meraki VPN (L2TP with PAP). Its weird because "most" of the network traffic works fine (SSHing for example), but accessing https://google.com does NOT work, while https://duckduckgo.com DOES work.
I just ran a test.. if the TLS connection is made from inside WSL2 before making it on the host, it does work. But if the host then hits the same site, the connection doesnt work.
Example, in WSL I can hit https://xkcd.com, until I go to https://xkcd.com in a windows browser. Then WSL fails to hit xkcd.com
I just found #416 and tried a few of the suggestions, but was unable to fix this issue.