0

First: This is not a duplicate --> I have read and tried about a thousand different answers to similar problems today, but none of them seem to work in my particular case.

Also: I originally posed this on Stackoverflow and was redirected here, thought it's weird cos I found all other related answers on the same site... and those weren't closed. ¯\(ツ)

See:

Context: I'm trying to get an internet connection on WSL2. My setup is a bit weird (more on that in section "I cannot try: ..."), because I'm on a company PC. When I'm at my workstation, I hook up via ethernet cable. However, when I'm mobile or at home, I need to connect to our VPN, in order to gain access to everything internal. We use Cisco Anyconnect as VPN. So far I have been unable to get any connection on WSL2, neither while connected via ethernet, nor while connected via Wifi + VPN.

I have tried (so many things...):

  • Disconnecting the VPN, restarting WSL and reconnecting to VPN
  • I have tried several different versions of /etc/resolv.conf, notably (but not limited to):
    • Adding nameservers 1.1.1.1, 8.8.8.8, 8.8.4.4. and the <Cisco Annyconnect Interface DNS servers>
    • Adding the proper search spaces to the file.
  • Doing all of the above via the .bashrc on boot.
  • Making the /etc/resolv.conf file immutable
  • Making the /etc/resolv.conf file mutable
  • Making the /etc/wsl.conf file not rewrite the /etc/resolv.conf file on reboot.
  • Automating a script that gets the dns servers everytime the wsl client is started and fills the /etc/resolv.conf file.
  • Changing a bunch of settings in the "WSL Settings" app, amongst others the network mode, to no avail.
  • Changing the Adapter interface metric to something really high.
  • Disabling and reenabling WSL Subsystem for Linux
  • Uninstalling WSL completely and reinstalling it with a single new clean Ubuntu distro, to make sure it's not something in the machine settings.
  • and others I'm probably forgetting... I have been at this for eons!

I cannot try:

Uninstalling Cisco Anyconnect and reinstalling it from store. I'm on a company laptop and I don't have the rights to uninstall it. The Windows store has been completely removed I believe and we use something like a self-built store.

Edit after brief stackexchange discussion: I also can't ask the IT-Department of the company for help, as I'm in the IT department and the only person who could know is sitting opposite me and has no idea either. He's even submitted an official bug-report with Cisco, but hasn't gotten any response (afaik).

Temporary fix:

I have managed to get it running through a mixture of writing a custom /etc/resolv.conf file (with the proper DNS servers and such), and downgrading WSL to version 1. For some reason this works, though it is SOOOO slow. Even sudo apt update takes about 20 seconds to even establish a connection to the mirrors. Additionally this only works on the ethernet connection and not on Wifi with VPN.

In short:

I've tried everything I could find on the internet and I've had no results. I've found an inelegant solution that I'm not happy with and I want to find a proper fix.

Basically I'm this close to throwing my coffee-cup through the screen and I need help.

10
  • 1
    It's not weird that it's off-topic on StackOverflow: It's only for programming questions, and this is simply not a programming question. (Older questions that got tolerated don't change the rules. For every of these you find there's hundreds of closed ones that you don't find.) Commented Nov 26 at 15:51
  • Hm, this sounds like a networking issue with the HyperV hypervisor that's the technical basis atop of which the Linux runs in WSL2. (WSL1 is different, it's emulating Linux syscalls, which is arguably the "less abstraction" way to do that, but also much harder to implement, which is why Microsoft decided to just go for a proper VM approach in WSL2, seeing that they already had a hypervisor.) Commented Nov 26 at 15:54
  • I gotta admit, I hadn't looked at the dates on the questions :D Commented Nov 26 at 15:55
  • So the problem might be with HyperV and not with WSL itself? Commented Nov 26 at 15:56
  • So, all of this points to the problem being on the Windows side of things. I hope you find someone who's got an answer here; but in case you don't, you might want to actually migrate this to superuser, because they have the windows experts (sadly this particular site's rules are very strict about cross-posting, so you couldn't have it open both here and there) Commented Nov 26 at 15:57

1 Answer 1

0

I wonder if this might be related to a known problem that was first reported in 2019 that still seems to be attracting comments from people with similar problems.


From https://gist.github.com/balmeida-nokia/122adf625c11c916902950e3255bd104

WSL 2 uses a Hyper-V Virtual Network adapter. Network connectivity works without any issue when a VPN is not in use. However when a Cisco AnyConnect VPN session is established Firewall Rules and Routes are added which breaks connectivity within the WSL 2 VM. This issue is tracked WSL/issues/4277


From https://github.com/microsoft/WSL/issues/4277

wsl 2 ubuntu 18.04 unable to connect to IP resources with Cisco Annyconnect active #4277

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.