I'm having an issue which I find hard to debug. I researched different SU and Reddit topics, but none seem to match the issue that I am facing. I'll outline the issue that I'm facing and the steps that I tried to resolve the issue. Hopefully someone has some insight as to what is going on.
Setup
In run WSL2 Ubuntu (22.04.4 LTS) on Windows version 23H2 build 22631.3737. I require VPN access to certain company resources. The VPN is configured using the Microsoft Azure VPN client on Windows. I have set it up so that my computer automatically connects to the VPN whenever I boot my device - I used Network & internet -> VPN to set this up.
The situation
Whenever I freshly boot the computer, the VPN is working as expected. On the host I can access all company resources. From within WSL2 I can also access all company resources. When I ping google.com in Ubuntu, I get a successful response. When I ping some_server (our Git server) I also get a successful response. Everything is working as expected.
After some type - typically after being AFK for a while, e.g. lunch or dinner - I can no longer access company resources inside WSL2. A ping some_server does not return any packages. However, when I ping google.com I still get a successful response, i.e. network connectivity is still there. This makes it different from what I read e.g. here, here and a myriad other resources I could find. Moreover, the VPN still works as expected on the host. I can still access company resources from the Windows side, just not the WSL2/Ubuntu side.
Both WiFi and Ethernet connections work the same, and they have the same behavior described above.
What I tried
- I tried disabling and reconnecting the VPN when this occurs, but that does not work.
- I tried going into airplane mode and then reconnecting to the VPN, but that does not work.
- I tried various DNS settings in
etc/resolv.confas suggested in similar topics, but none of those seem to work consistently. - I tried shutting down WSL
wsl --shutdownand re-booting the Ubuntu distro, but that also does not work: the VPN resources are not available, but networking is. - The only thing that I have found consistently works is rebooting the computer, which obviously is less than ideal.
Details
# etc/resolv.conf - I made this file immutable with `chattr +i`
nameserver 10.10.5.4
nameserver 8.8.8.8
nameserver 192.XXX.X.XXX <- this is the (masked) default gateway for my router, which I added to no avail based on another thread
# wsl.conf
[boot]
systemd=true
[network]
generateResolvConf=false
# hosts on Windows (C:\Windows\system32\drivers\etc)
...
10.0.0.4 some_server # this is the domain of our Git server
...
Both my Ethernet and WiFi adapters are set up to configure DNS automatically on the Windows side.
I hope someone has a clue what may be going on here, as I'm out of my depth. Please let me know if any other information is needed.