I'm using WSL2 (Ubuntu 22.04) and Windows 11 Education 24H2.
I've checked my BIOS settings, and virtualization is enabled. Hyper-V is turned on, and I've tried disabling and enabled it and restarting my computer in between. I've tried turning off my firewall, and it doesn't make a difference. I checked my %temp%, and it doesn't appear to have been compressed.
I have a laptop on the same network with the same (automatically generated) /etc/resolv.conf that can ping Google in WSL2 and run sudo apt-get update, so I don't think the generated config is the issue, but I did try changing my wsl.conf and resolv.conf (although I'm open to trying again).
I've tried setting swap=0, networkingMode=mirrored, dnsProxy=false, localhostforwarding=true, dnsTunneling=true, bestEffortDnsParsing=true, firewall=false, autoProxy=true, and they've all been whatever the default is as well. I also looked at https://github.com/microsoft/WSL/issues/4150 this post and attempted it, but I'm not sure I was able to complete the steps successfully as it said:
Remove-NetFireWallRule : No MSFT_NetFirewallRule objects found with property 'DisplayName' equal to 'WSL 2 Firewall
Unlock'. Verify the value of the property and retry.
At line:1 char:1
+ Remove-NetFireWallRule -DisplayName 'WSL 2 Firewall Unlock'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (WSL 2 Firewall Unlock:String) [Remove-NetFirewallRule], CimJobException
+ FullyQualifiedErrorId : CmdletizationQuery_NotFound_DisplayName,Remove-NetFirewallRule
and The system cannot find the file specified.
I do think it might be a firewall problem as opposed to a wsl.conf problem though because when I try to ping www.google.com it says PING www.google.com (172.217.1.100) 56(84) bytes of data. So it can resolve www.google.com to an address, right? And the problem is just that no packets make it through.
Also, if I do an ipconfig in Powershell, I can see that there are IPv4 addresses for Wireless LAN adapter Wi-Fi, Ethernet adapter vEthernet (Default Switch), and Ethernet adapter vEthernet (WSL (Hyper-V firewall)), and I can ping all of those from PowerShell, but I can only successfully ping the Ethernet adapter vEthernet (WSL (Hyper-V firewall)) address in WSL2.
Finally, if I restart my computer and then open WSL and ping www.google.com, about 2-6 pings will make it through before it stops... and sometimes another 2-6 will make it through a few seconds later before packets completely stop being returned/delivered.
But again, I've tried disabling my Windows firewall, and it didn't make a difference in terms of pinging. I've been working on this for three days and have no idea what's wrong TT I tried switching to WSL1 earlier, and that worked, but I had trouble doing an npx install (because I think it got confused with Windows paths) :'( Also, I'd just like to be able to use WSL2 because it should work and I have no idea why it doesn't.