WSL: [WSL2] Checkpoint VPN breaks network connectivity
(I’ve searched the open issues, and none that I could find were exactly the same)
Windows 10.0.18922.1000
I just installed Windows Insiders, and updated my Ubuntu distro to WSL2. It can no longer access the Internet.
From the Ubuntu bash prompt: ping github.com doesn’t work (100% packet loss); ping 8.8.8.8 is the same.
/etc/resolv.conf gives nameserver 192.168.115.225. ping 192.168.115.225 doesn’t work.
My Ubuntu distro has IP 192.168.115.230; I can ping that from Ubuntu.
The Windows IP address is 192.168.115.225, and I can ping it from PowerShell. Pinging the Ubuntu distro’s IP (192.168.115.230) also works, from PowerShell.
Inside Ubuntu, route -n reports:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.115.225 0.0.0.0 UG 0 0 0 eth0
192.168.115.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
I’m using a Surface Go, Windows 10 Pro, connected to the Internet over Wifi.
I might have some left-over detritus from when I attempted to get a Hyper-V VM connecting via Wifi. That was prior to upgrading to Windows Insiders. I don’t know how much of that Hyper-V networking infrastructure is shared, and I don’t know how to debug that.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 32
- Comments: 133 (5 by maintainers)
I’m using the Cisco AnyConnect VPN and as soon as I connect, I lose all access to the external network. Anything I can do to help debug this further?
So I just worked with my IT Department on coming up with a fix. Here’s what we found out and how we corrected it.
When you connect to Cisco Anyconnect WSL2 will NAT to the highest priority Ethernet Adapter. A newer version of Cisco Anyconnect from the Windows Store seems to correct this; however, it doesn’t support Dual Factor Authentication. So to correct this we used a script that I saw mentioned elsewhere.
Steps:
I hope this helps, as we spent several days attempting to track down the cause.
Edit: Be sure if you have “Ubunut/WSL” set as your default profile in Windows Terminal, that you run the script prior to starting WSL. So if Ubuntu/WSL is your default, set your default to PowerShell, or switch over to PowerShell, run the command
wsl --shutdown, then execute the above script, then reopen Ubuntu/WSL.@d-ryzhikov solution seem to be working in principle. I have tried the new found WSL boot script support for doing that and it seems to solve the situation as well. All what you need to do is to add
to
/etc/wsl.conf.After a computer restart, WSL seems to be working fine with VPN on.
I have created a script to simplify the solution above for our corporate machines. I have adapted it to be more generic on
https://github.com/AmmarRahman/wsl-vpn
Please feedback if this work for you.
Same problem with Cisco AnyConnect
I don’t have an update here for this specific VPN: Checkpoint. However, in general we are working in improvements to our WSL networking story that should help this area, so please stay tuned. I’ll be sure to post on this thread when I have news on this! 😃 Thank you for your patience.
I installed/used Cisco AnyConnect from Windows Store https://www.microsoft.com/store/productId/9WZDNCRDJ8LH and it started working. Credit goes to https://github.com/microsoft/WSL/issues/4277#issuecomment-561649724
Hi guys I’ve developed a simple script that can help you to deal with conection issue from WSL2: https://gist.github.com/bastaramus/3d5f1326835fe111d5ea9684c41a6675 You need to run this script as an Administrator on your Windows machine each time when you was connected to the CheckPoint VPN. And you don’t need to disable any interfaces or reconnect to VPN. Just launch this script I don’t know is there any way in Windows to automatically launch this script after VPN connection was established. It would be great if somebody can help with this
Hi, I exported an internal troubleshooting document from our company to open-source.
The purpose is to create an ordered checklist to move on and find your right problem easily.
https://github.com/baruchiro/BcsStudent/blob/master/content/posts/wsl-troubleshooting.md
(The document hosted in my Blog repo)
Here is the content, but I can’t promise I will update this comment with future doc updates (but I hope I will and you can remind me if I forgot).
Please add your troubleshooting to there. Thanks.
WSL Troubleshooting
Related Resources
Introduction
This document is written in our company in order to solve the issues with WSL2, CheckPoint VPN and other self-hosted services. You’re welcome to suggest more fixes in this subject to make this document more general.
Network and DNS Troubleshooting
Try each command by their order to better find the correct problem.
Try
ping 8.8.8.8If it failed it means that you don’t have an internet connection at all.
See this video and/or [WSL2] Checkpoint VPN breaks network connectivity (comment) to solve this issue.
Probably the base thing is to connect to the VPN before WSL2 Network Adapter.
netsh interface set interface "vEthernet (WSL)" disableor byGet-NetAdapter -Name "vEthernet (WSL)" | Disable-NetAdapter$(Get-NetAdapter -Name "vEthernet (WSL)").StatusisDisablednetsh interface set interface "vEthernet (WSL)" enableorGet-NetAdapter -Name "vEthernet (WSL)" | Enable-NetAdapterTry
ping google.comIf it failed it means that you have a problem with the DNS. You need to update the
/etc/resolve.confwith your DNS addresses.Run this command in PowerShell:
Get-DnsClientServerAddress -AddressFamily IPv4 | Select-Object -ExpandPropert ServerAddresses, then take the addresses from that command, clear theresolve.conffile and set the first linesearch {your domain}and then the next line will benameserver {ip}.Source: you can use this script (from Networking issues while using VPN (comment)) to auto-update the
resolve.conf.Try
ping {internalIP}If it failed it means that you have a problem with the VPN.
Try
ping {internal hostname}If it failed it means that you have a problem with the internal DNS.
Make sure you configured the DNS by the instructions in 2.
Other connection issues
Clone a git repo by SSH
If you’re trying to clone a private repo, you need your credentials that usually configured in the Windows system.
My suggestion is to use SSH, here is an instruction to configure the SSH keys in TFS:
Create an SSH key in WSL with
ssh-keygen -C your.name@company.com, and paste the~/.ssh/id_rsa.pubin{tfs-host}/tfs/_details/security/keysIf you are getting an error with
diffie-hellman-group1-sha1,diffie-hellman-group14-sha1(I don’t remember the original error), create/edit the~/.ssh/configfile with:Get the SSH repository URL.
Clone.
npm network timeout
If you are getting the next error when you are trying to use
npm, please share the solution with us:You can try this:
Get-NetIPInterfaceon windows to findMTUvalue for VPN network adapter (mine was 1350)sudo ifconfig eth0 mtu 1350orsudo ip link set dev eth0 mtu 1350inside WSL to match eth0MTUvalue with vpn network adapter valueI also have this problem, using Cisco. Logs here: https://aka.ms/AA6fthe
I just came across this https://github.com/sakai135/wsl-vpnkit. It seems to be working perfectly
@barroudjo Yes for a specific additional customer VPN I had to use a similiar setup. But I use the docker magic for that.
Docker Desktop does a very good job to circumvent the WSL2 quirks by some tun/tap magic, so you can just start a squid proxy in docker. So I came up with the following:
Done!
Uninstalling NordVPN does not fix the problem.
The Checkpoint VPN software seems to be responsible for screwing it up. Uninstalling it fixes the problem.
Unfortunately (sigh), I have to have this software installed, so it looks like I’m going to have to uninstall Windows Insiders.
Any chance you could work with Check Point to get this resolved?
The following solution worked for me:
First of all, I want to mantion that my issue was not DNS only related, I had no external connection in WSL2 distribution after connecting to VPN, not even using ips. (no internet connection at all) The error message received on pings was: “temporary failure in name resolution”, but as I said before using, using raw ip instead of hostnames didn’t work as well
Environment:
Solution:
I ran the following 2 lines found in this article https://sysblog.dk/?p=254 but addapted for Checkpoint VPN client:
and rebooted the pc. Those two lines change the Interface Metric so that the WSL interface has a higher priority than the VPN connection. After restart everything started to work as expected (vpn connection, working DNS, internet connection) inside WSL2 without the need to run the mentioned commands again, even though in the article it says that the lines need to be run each time before connecting to VPN. After restart the metric for WSL interface was restored to 5000 (as expected because wsl2 networking is restored to defaults after each restart), but the metric for VPN interface remained as set before to 6000 (5000 still < 6000). I used
Get-NetIPInterfacecommand to check the metrics after restart.Also found almost the same solution explained above: https://github.com/microsoft/WSL/issues/4246#issuecomment-649145305
Edit: added new demo record https://youtu.be/fkXWaVAi6KY
Edit 2: I found out that running docker with windows containers and wsl2 backend broke everything , and couldn’t get it to work as before even if I uninstalled docker. No ideea what happened or how to debug the issue
But I found another solution that works without the need to reboot the PC or shutdown WSL2:
you dont need any prerequisites and as I said before, no reboot required for PC or WSL2 environment
Here is an youtube demonstration I recorded: https://www.youtube.com/watch?v=yR2NsssY7z8
I have a similar problem with Citrix Netscaler VPN at work, which only tunnels some networks. Internet access is fine with wsl2 but connecting to a host inside a VPN tunneled network, the name can be resolved to an IP but then timeouts (wireshark says tcp retransmission). Citrix Netscaler says, that it has tunneled that connection in the “tunneled application” window. Also disabled the firewall completely, but that didn’t work either…
No combination of mirrored mode networking and dns tunnelling is fully helping. Mirrored mode makes the internet work when connected via checkpoint, but WSL2 can’t access the vpn subnets. Dns tunneling doesn’t seem to change anything.
I have stumbled upon a solution on another issue. https://github.com/microsoft/WSL/issues/4698#issuecomment-628682785.
sudo ifconfig eth0 mtu 1350did the trick for me.I am seeing the same behavior using Cisco AnyConnect VPN. Any updates on this issue?
Same issues also with Checkpoint VPN
I had the same issue as above quote. only https not working through VPN. For the changing the MTU to 1350 solved. I also use Checkpoing VPN, so it’s the same MTU value.
On Ubuntu 20.04
Same issus occurs with Cisco OpenConnect VPN. Here are the logs https://aka.ms/AA6jmg1
I know this is closed, but for others who end up here, I’ll post my answer, because for me, it was a combination of things that got this working for me.
Like many of you, my company switched to Checkpoint VPN, and after that, my WSL connectivity was broken. Here’s how I fixed it. Note that I did not need to shutdown WSL, uninstall/reinstall anything. I just needed to update a text file and a NIC configuration. That’s all.
First, I edited the
/etc/resolv.conffile. Now this is a symlink to a file that is automatically generated by WSL. ~Since I just got this to work, I have not yet turned off auto-generation of this file. (I’m waiting to see if this will be necessary before turning off auto-generation.) For now,~ I have now turned off auto-generation of this file because I found that upon restart of the underyling VM, the file is reset and the changes I made below are necessary for me to have internet access from Ubuntu on WSL. YMMV depending on your environment and how your networking staff have configured the VPN. I simply changed the file to have the following contents:The first two lines I snagged from
ipconfig /allfor the adapter associated with the Checkpoint VPN connection. The last one is my home router’s nameserver (or, your preferred nameserver, e.g. Mozilla, Google, Cloudflare, etc.). Originally, I put my home router nameserver first because I wanted to prioritize most requests through my ISP. BUT, apparently, WSL stops querying nameservers at the first “successful” response even if the result is “I couldn’t find what you’re looking for.” So, I switched them around. Oddly enough, when I later did anslookupfor a company resource, the VPN nameservers failed to resolve the company resource, but my home router entry resolved the name 😕 Whatever, it worked.OK, so at that point, I could
pingthe company resource I wanted access to—in this case, an Azure DevOps on-prem server. BUT, when attempting togit fetch origin, I received the following message:Recv failure: Connection reset by peer. Hmm, is this a firewall issue? It doesn’t seem like it—that would usually beConnection forcefully reset by peer… Then I remembered the above references to the MTU size. So I did aip link set eth0 mtu 1350, because that’s what the Checkpoint VPN is configured to use as the MTU (by default?). Once that was done, I was able to access the Azure DevOps server and fetch my repository.So, to summarize the required steps:
/etc/resolv.conf, potentially turning off auto-generation of the fileHope this helps somebody. At least this will help my future self. 😆
Hi folks, we have put out a new update that aims to address networking issues in WSL. In your
.wslconfigfile you can setexperimental.networkingMode=mirrored, as well as some other key settings that should improve your network compatibility! Please try them out and let us know what you think.More info on this release and the changes can be found here in the blog post.
Please note: You need to be on a Windows Insiders version to use the new networking settings (Any channel of Windows Insiders will do, including release preview). If you see the “These are not supported” messages it means that your current Windows version doesn’t have support, and you will need to upgrade. These features will eventually be coming to Windows 11 22H2.
How it worked for me, maybe someone understands whats happening with this infos:
-> at this point i had basic connectivity (can ping VPN internal ips, wget / curl with http, but no https)
set MTU inside WSL to the value of your VPN, (1350 for me) -> now https is working, but still i cannot apt update (“temporary errror in resolving…”)
lookup company nameservers in windows (details of VPN Connection under DNS-Servers)
add those DNS servers to /etc/resolve.conf
I can confirm the comment of @AmmarRahman. After installing Docker Desktop on my Windows machine and switch to the WSL2 backend, I noticed that this docker daemon is able to access resources in the vpn (downloads an image from a docker registry there). I can also confirm it by running a container accessing resources on the vpn
docker run alpine sh -c 'wget -O- https://some-vpn-internal.resource.com'. Eventhough the communication to vpn resources don’t work in wsl2, ex. by running the docker wsl2 “machine” (wsl.exe -d docker-desktop). So I think something is actively preventing this to workThe workaround I have at the moment is to work within a container. Even though Docker uses WSL2 as it’s backend, they seem to have got a better network setup that would work through the VPN.
Similar issue with Citrix VPN. I can ping the server, but can not open tcp port 80 and curl is timeout.
Works like a charm, thank you
Thank you @sakai135 and @AmmarRahman! This is exactly what I’ve been looking for. Thank you vpnkit for showing Microsoft how to fix their product
I can confirm this works with Sonicwall using NetExtender (10.2.309, but I doubt the version matters). I no longer have to use the broken MobileConnect.
Just dropping by to say that with socat and a local proxy you can circumvent altogether this problem, at least for http calls:
set your WSL http_proxy env var to point to a socat TCP listening process:
http_proxy=http://localhost:8118launch socat to listen and forward (through binary communication) to a socat (socat cygwin) in windows the tcp calls:
socat tcp-listen:8118,fork,reuseaddr exec:"/mnt/c/Workspace/socat/socat.exe - tcp\:localhost\:8118"run a proxy server (for example privoxy, or winfoom / px if you need to go through a corporate proxy with cntlm authentification) on your windows host, at the same 8118 port
you also need to configure the http proxy for apt-get to http://localhost:8118 in /etc/apt/apt.conf.d/proxy.conf:
Acquire::http::Proxy "http://127.0.0.1:8118";It’s a workaround, but it’s robust, and it should work for all cases. Doesn’t matter which vpn, if you have connectivity in windows you will have it in WSL. To make it clean obviously you should autostart the socat process. I have a solution but it’s not the cleanest and I’m sure people here more competent than I can propose something better !
The solution provided by @agalbenus worked perfectly for me using
Check Point Endpoint Security VPN. I’ve made a small batch script to automate disabling the network interface, connecting/disconnecting from the VPN and then enabling it again.Here’s the link if anyone is interested: https://gist.github.com/thiagoarruda/7cb0ffb6617f9df9fa7f08b328dfbaf8
For me, nameserver modification is not needed. Only the MTU 1350 is required to make my WSL2 work with https access via AWS Private Endpoints.
@baruchiro I also had problems with TLS while pulling a docker image from VPN network inside WSL2. I fixed it by setting the MTU inside WSL2 to be the same as VPN network MTU on windows host :
so the fix was: -run
Get-NetIPInterfaceon windows to find MTU value for vpn network adapter (mine was 1350) -runsudo ifconfig eth0 mtu 1350inside WSL to match eth0 MTU value with vpn network adapter valueyou should be good to go
That’s strange. From within docker I have full access to internal resources without changing anything in docker network.
I have the same problem, but this did not seem to help in my case.
I lose internet connectivity in WSL2 when using SonicWall VPN in full-tunnel mode. If I switch to partial-tunnel, then WSL2 internet connectivity is fine.
Using also Zscaler proxy running on Windows on http://localhost:9000. and having the same problem than @aderuelle Any idea how to solve this
Hi @wesleymusgrove,
I’m facing the same issue here (win10 20H2 + WSL2 + Zscaler client connector 3.1.0.96)
curl on host through proxy => OK curl on WSL guest =>
Were you able to solve it ?
Many VPN clients have the ability to run a post connection script, https://docs.paloaltonetworks.com/globalprotect/9-1/globalprotect-admin/globalprotect-apps/deploy-app-settings-transparently/customizable-app-settings/script-deployment-options.html, however I’m not sure if that will be able to run with the rights you need (I supposed that depends on how GlobalProtect works)
If your Admins are willing to setup this up for you, they can
SYSTEMuser, and check the “Run with highest privileges”, but they may have another user account designed for this purpose.Now this means you’ll have permission to run an “elevated” task. This is the closest to a “windows sudo” list I know of.
There’s a command. As a user, you can create a shortcut to run
SCHTASKS.EXE /RUN /TN "task name", and now you can run that task that needs admin, as a non-admin any time you want.I used to think this would help, but on second glance, it will not, it’s kind of solves an opposite problem ~https://docs.microsoft.com/en-us/powershell/module/vpnclient/add-vpnconnectiontriggerapplication?view=windowsserver2019-ps~
Actually you need to run every time you connect the VPN. I haven’t been able to find a way to keep the values permanent or without the need of elevated rights
Before I forget: today I restarted my PC and I connected to Cisco VPN before login to Windows (it is possible in the windows logon page). Then, even applying what I decribed in my previous post, it didn’t worked.
Then, what I did to fix it was:
1 - Disconect from VPN 2 - Connect to the VPN again 3 - Change the interface metric (with admin rights):
4 - Run this tool within the WSL.
@idsergiu provided the best and most simpler solution. Nevertheless, I had to use this tool from the comment of @baruchiro about the DNS resolution problem.
Thank you very much guys!
@barroudjo & @smerschjohann many thanks for your proxy ideas!
We (@tkalmar and I) also added a dante socks proxy so that we can SSH to other machines in our corporate network. So we now have a docker-compose setup that starts both dante and tinyproxy in containers. We might share the entire setup later but we want to give it more “baking time” first.
Alright, so I’ve been wanting to use WSL 2 for a while now and the only thing stopping me is the VPN connectivity issue. I found something that I’m not sure if others have because I haven’t found any posts in the issues I’ve been looking through and figured I should throw this in here as a possible reason for the issue with VPN connectivity issues.
I have tried a lot of the workarounds except for the metric modification because I don’t want my system to “disable/ignore” my VPN. From what I understand of the metric value is that it is a priority system and if you increase the metric on a VPN to higher than your outgoing internet nic you are basically routing 0 traffic through the VPN. (If I am misunderstanding this, please let me know).
So, I’ve been looking into the Hyper-V Virtual Switch and while trying to create an external switch /(or modifying the WSL one) the external network interfaces list does not show the VPN interface image. I am using Private Internet Access as my VPN connection and as shown in the image is not in the selection list.
I hope this helps with figuring out if there might be an issue with the Virtual Switch instead of with the WSL networking in general.
Just some extra info showing that DNS resolving is working fine (for some reason)[this is a fresh Ubuntu 20.04 WSL 2 install].
I had the same behavior - connection via https/443 didn’t work on WSL2, giving:
>wget https://github.com/kubeflow/manifests/archive/ebeb4c285a0cf49750c4f07015b58cc27ca4c3a1.tar.gz--2021-03-01 20:24:44-- https://github.com/kubeflow/manifests/archive/ebeb4c285a0cf49750c4f07015b58cc27ca4c3a1.tar.gzResolving github.com (github.com)... 140.82.112.3Connecting to github.com (github.com)|140.82.112.3|:443... failed: Connection timed out.Retrying.However it worked on WSL1. Windows 10 Pro: Version 10.0.19042 Build 19042 (latest till now on my laptop - Dell XPS 17). I have OpenVPN installed as well, however behavior didn’t change whether I have VPN connection established or not. All above methods (including thread in https://github.com/microsoft/WSL/issues/4246, except latest one in this thread - around proxy) didn’t help.
Interestingly enough - for me it turned out to be the Symantec Endpoint Protection antivirus… Not sure yet what exactly it blocks - will try to find. When protection was disabled - things started to work as expected…
@baruchiro
/etc/resolv.confnot/etc/resolve.confI came up with a different solution, as I seem to have a different problem than the other posts here.
In my situation the endpoint firewall was in the way, For virtualbox etc. the company excluded some ip addresses from these rules exactly for such internal purposes. So I had to use one of these ip addresses to allow internet access.
I do that with the following scripts (e.g.
192.168.123.100/32is your excluded IP address)Windows / Powershell
A small powershell script which adds a route to the vSwitch to route traffic to the ip range/single IP excluded in the checkpoint firewall.
Linux / WSL2
A script that switches the activate IP address of the system, it turned out that I didn’t need to change the /etc/resolv.conf (DNS resolution) that may vary in your setup.
Until a proper fix arrives from microsoft, here is a workaround that I use, to change the mtu size on startup.
sudo visudoand add the following line:shell:startup, in the open directory create a short cut with the following command:To find path to your distro:
Inspired by https://adrianstoll.com/tips-and-tricks/running-services-at-startup-windows-subsystem-for-linux.html
@drewtech https://github.com/microsoft/WSL/issues/4246#issuecomment-705925065
Didn’t work for me! 😦
WSL2 - Ubuntu 20.04, Citrix Gateway 13.0.64.35 on Win10 64 bit, Build 18363
@craigloewen-msft, any update on vpn issues? Is there something on the way to make it work? What it makes a strange problem is that Docker Desktop with WSL2 engine works perfectly while we are on a VPN, but not WSL2 itself!
Can someone smarter than myself confirm if this issue is the same as the recently resolved WSL vEthernet issue, fixed in Windows 10 preview build 20231?
https://github.com/microsoft/WSL/issues/5821#issuecomment-705075529
I think this info might help understanding the Problem better:
I compared the Windows routing tables of a working network in wsl with a non working.
There are some additional entries generated for the WSL Network Adapter, after Connecting via Checkpoing VPN, where especially one is responsible for the failing network inside WSL. (Not able to ping), at least it seems so
When192.168.243.241 is the IP of vEthernet (WSL) Adapter in Windows:
Then i did in CMD:
After that i can ping the nameserver from inside wsl. (after setting MTU)
–
The MTU and resolv.conf still need modifying…
–
that aligns with @daveomcd and @Irenaud s post, because changing the Adapter Metrics will priorize the working route, that has metric 5001 by default, before the route that i deleted
Hey Glenn @testworksau , just enable the
Local LAN accesscan fix this issue.But still, you can not access the internal network
I haven’t changed anything on the host configuration. However, I did run
netsh.exe interface ipv4 show interfacesto verify that 1350 is the mtu that my VPN is operating at.@AmmarRahman, I can observe the same behavior here. I’m using a VPN and a proxy and it works perfect only in a docker container (using Docker Desktop with WSL2).
I tried @andyneff workaround but didn’t work unfortunately…
For now, my workaround will be using a container in WSL2 to be able to connect to network.
same issue using Cisco AnyConnect (connected)
FWIW I’ve experienced what sounds like a similar issue, and I don’t use Checkpoint VPN. I notice that when this happens, seemingly all socket-level operations seem to fail in Windows. Even my Android emulator becomes inaccessible to Android Studio, and all Chrome tabs indicate no internet connectivity. Closing all Ubuntu windows resolved the issue for me today, and this consistently happens when I leave a local server running in Ubuntu overnight and come back to my workstation 24 hours later.