WSL icon indicating copy to clipboard operation
WSL copied to clipboard

no network any more

Open klkr1 opened this issue 3 years ago • 12 comments

Windows Version

Microsoft Windows [Version 10.0.22621.2715]

WSL Version

2.0.9.0

Are you using WSL 1 or WSL 2?

  • [X] WSL 2
  • [ ] WSL 1

Kernel Version

5.15.133.1-microsoft-standard-WSL2

Distro Version

Ubuntu 22.04

Other Software

No response

Repro Steps

Start WSL

Expected Behavior

network access available

Actual Behavior

no network access (presumably since update KB5032007 or KB5032190) Before network access worked .wslconfig in user folder not present Now I first got error message "Fehler beim Konfigurieren des Netzwerks (networkingmode NAT)". wsl2 did not reach command prompt at all Then I tried different settings in .wslconfig for wsl2.networkingMode: NAT and mirrored With these settings in .wslconfig wsl2 reaches command prompt but there is no network connection command 'ip link show' shows only lo but no eth

Diagnostic Logs

No response

klkr1 avatar Nov 16 '23 17:11 klkr1

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Closed similar issues:

You can give me feedback by thumbs upping or thumbs downing this comment.

github-actions[bot] avatar Nov 16 '23 17:11 github-actions[bot]

/logs

OneBlue avatar Nov 17 '23 01:11 OneBlue

Same, my computer auto-updated last night and apparently installed WSL 2.0.9.0. I receive this error this morning:

Failed to configure network (networkingMode Nat). To disable networking, set `wsl2.networkingMode=None` in C:\Users\gregz\.wslconfig
Error code: Wsl/Service/CreateInstance/CreateVm/ConfigureNetworking/HNS/0x80070424

ProTip avatar Nov 17 '23 18:11 ProTip

Apparently, the latest update messed up something with Hyper-V (edit: see edit at the end) to the point where it's no longer compatible with WSL, at least for quite a few people. There are diverse errors people have opened issues for here, but the common denominator is latest update + Hyper-V.

Unfortunately, there is a choice to be made here because uninstalling Hyper-V solves the issue completely. I don't use Hyper-V a lot, so it was an easy choice for me.

Specifically:

  1. I went to Control Panel -> Turn Windows features on or off. From there I unchecked/uninstalled Hyper-V stuff completely, i.e. its whole tree (Hyper-V, Hyper-V Management Tools, Hyper-V Platform).
  2. I left everything else related to virtualization checked (I had them already installed so I didn't touch them). This includes Containers, Virtual Machine Platform, Windows Hypervisor Platform, Windows Sandbox and, of course, Windows Subsystem for Linux.
  3. Rebooted the PC when it asked for it, and now everything seems to work again, at least in regard to networking. If stuff starts malfunctioning again, I'll try uninstalling even the other virtualization components above (though not Windows Sandbox, I'm not willing to give it up so that's where I draw the line 😅).

Hope it solves the issue for other people too, at least until it's bugfixed (though then something else will most probably break, but that's a story for another time).

Edit: I now read the following in the WSL networking documentation (https://learn.microsoft.com/en-us/windows/wsl/networking):

On machines running Windows 11 22H2 and higher, with WSL 2.0.9 and higher, the Hyper-V firewall feature will be turned on by default.

Clicking the link about Hyper-V firewall default settings (https://learn.microsoft.com/en-us/windows/security/operating-system-security/network-security/windows-firewall/hyper-v-firewall) and running the command suggested there, those are the default values for me:

C:\Get-NetFirewallHyperVVMSetting -PolicyStore ActiveStore -Name '{40E0AC32-46A5-438A-A0B2-2B479E8F2E90}'

Name                  : {40E0AC32-46A5-438A-A0B2-2B479E8F2E90}
Enabled               : True
DefaultInboundAction  : Block
DefaultOutboundAction : Block
LoopbackEnabled       : True
AllowHostPolicyMerge  : True

I can't stop my WSL distro atm, but when I can, I will try changing the DefaultInboundAction and DefaultOutboundAction settings, in case it makes any difference when having Hyper-V installed too.

jtabox avatar Nov 17 '23 23:11 jtabox

Logs attached WslLogs-2023-11-18_11-59-10.zip

I also checked HyperV Firewall settings as suggested by jtabox. My settings were: Enabled : True DefaultInboundAction : Block DefaultOutboundAction : Allow LoopbackEnabled : True AllowHostPolicyMerge : True

Changing it to this did not resolve the issue (no reboot done, is reboot required?) Enabled : True DefaultInboundAction : Allow DefaultOutboundAction : Allow LoopbackEnabled : True AllowHostPolicyMerge : True

Also this setting does not work Enabled : False DefaultInboundAction : Allow DefaultOutboundAction : Allow LoopbackEnabled : True AllowHostPolicyMerge : True

klkr1 avatar Nov 18 '23 11:11 klkr1

I didn't have to reboot anything when changing those default rules, they seem to work directly. And they indeed were the issue, setting those to Allow gets WSL's networking functioning again. Have you tested by disabling the firewall? I'm running Avast Free Antivirus, and it has a firewall function. It was this function that controlled Windows (and Hyper-V) firewall, maybe there's a firewall in your case too?

This is how the rules are in my case: Command:

C:\Get-NetFirewallHyperVProfile -PolicyStore ActiveStore

Result:

Name                    : {40E0AC32-46A5-438A-A0B2-2B479E8F2E90}
Profile                 : Public
Enabled                 : True
DefaultInboundAction    : Allow
DefaultOutboundAction   : Allow
AllowLocalFirewallRules : True

Name                    : {40E0AC32-46A5-438A-A0B2-2B479E8F2E90}
Profile                 : Private
Enabled                 : True
DefaultInboundAction    : Allow
DefaultOutboundAction   : Allow
AllowLocalFirewallRules : True

Name                    : {40E0AC32-46A5-438A-A0B2-2B479E8F2E90}
Profile                 : Domain
Enabled                 : True
DefaultInboundAction    : Allow
DefaultOutboundAction   : Allow
AllowLocalFirewallRules : True

The two powershell commands that solved the issue for me were:

Set-NetFirewallHyperVVMSetting -Name '{40E0AC32-46A5-438A-A0B2-2B479E8F2E90}' -DefaultInboundAction Allow
Set-NetFirewallHyperVVMSetting -Name '{40E0AC32-46A5-438A-A0B2-2B479E8F2E90}' -DefaultOutboundAction Allow

Make sure you use your own machine's name (the UUID above):

Command:

C:\Get-NetFirewallHyperVVMCreator

Result:

VMCreatorId  : {40E0AC32-46A5-438A-A0B2-2B479E8F2E90}
FriendlyName : WSL

jtabox avatar Nov 18 '23 11:11 jtabox

Reinstalling VM Platform as described in the link below solved this issue. https://github.com/microsoft/WSL/issues/10755#issuecomment-1813569202 Reconfiguring HyperV Firewall was not necessary, WSL2 works for me with initial Firewall settings after reinstalling VM Platfrom

klkr1 avatar Nov 18 '23 13:11 klkr1

Could you please follow the steps below and attach the diagnostic logs? This is new script to scrape better logs. https://github.com/microsoft/WSL/blob/master/CONTRIBUTING.md#collect-wsl-logs-for-networking-issues

chanpreetdhanjal avatar Dec 04 '23 23:12 chanpreetdhanjal

Reinstalling VM Platform as described in the link below solved this issue. https://github.com/microsoft/WSL/issues/10755#issuecomment-1813569202 Reconfiguring HyperV Firewall was not necessary, WSL2 works for me with initial Firewall settings after reinstalling VM Platfrom

Can you share another link @klkr1? Seems like it can no longer be found at the previous link.

RonnieDsouza avatar Dec 08 '23 16:12 RonnieDsouza

I have this issue after windows updates today. I have uninstalled Hyper-V completely and still cannot launch WSL.

KieranFoot avatar Jan 10 '24 13:01 KieranFoot

Strangely enough, I fixed this issue by stopping a service that was running on port 53. At no time did Docker or WSL complain about port 53 already being in use, however, this was the issue for me and having uninstalled the local DNS server I was running, I now have docker desktop working again...

Having followed many peoples suggestions, I decided to unregister and re-install the Ubuntu image, this failed and then led me to discover the common issue of port 53 already being in use. Possibly MS could put some effort into extracting inner issues to provide more context to users so they may resolve these common issues easier.

KieranFoot avatar Jan 10 '24 13:01 KieranFoot

This issue has been automatically closed since it has not had any activity for the past year. If you're still experiencing this issue please re-file this as a new issue or feature request.

Thank you!