microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.34k stars 814 forks source link

How to use 'mirrored' mode since 'bridged' networking mode stopped working with 23H2 (WSL 2.1.5) #11291

Open Boilerplate4u opened 7 months ago

Boilerplate4u commented 7 months ago

Windows Version

Microsoft Windows [Version 10.0.22631.3155]

WSL Version

2.1.5.0

Are you using WSL 1 or WSL 2?

Kernel Version

6.2.7

Distro Version

Alpine Linux 3.17.3

Other Software

No response

Repro Steps

Config file .wslconfig

networkingMode = bridged
vmSwitch = WSL-Switch

Expected Behavior

The "bridged" networking mode as in the config below ceased to function with the 23H2 update, likely due to the introduction of the new "mirrored" mode.

networkingMode = bridged
vmSwitch = WSL-Switch

However, regarding the "mirrored" mode, the documentation only states that "Enabling this changes WSL to an entirely new networking architecture which aims to 'mirror' the network interfaces you have on Windows into Linux, to add new networking features and improve compatibility." Unfortunately, there are no manuals available explaining the technical details of how to use "mirrored" mode!

Question: 1) How can I re-enable functionality using "networkingMode = bridged" and "vmSwitch = WSL-Switch" ? 2) Or how to achieve the same effect using "networkingMode = mirrored"? 3) If possibe, please provide en example and where to find tech docs regarding how to use "mirrored" mode

Thanks in advance!

Actual Behavior

Config file .wslconfig

networkingMode = bridged
vmSwitch = WSL-Switch

Doesn't work anymore and eth0 is not available in bridge mode.

Diagnostic Logs

No response

### Tasks
github-actions[bot] commented 7 months ago

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!

Open similar issues:

Closed similar issues:

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

OneBlue commented 7 months ago

/logs

Boilerplate4u commented 6 months ago

Basic environment info

PS C:\> $PSVersionTable                                                                                                                                                                                                        Name                           Value                                                                                    ----                           -----
PSVersion                      5.1.22621.2506
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.22621.2506
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

PS C:\> wsl --version
WSL version: 2.1.5.0
Kernel version: 5.15.146.1-2
WSLg version: 1.0.60
MSRDC version: 1.2.5105
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22631.3296
Boilerplate4u commented 6 months ago

Test #1 is failing after the recent WSL update when using the original bridged/vmSwitch options. Please see the attached Test-run-1-2024-03-16-1535.zip with configuration file and logs.

[wsl2]
processors=2
debugConsole=true
# networkingMode = mirrored
networkingMode = bridged
vmSwitch = WSL-external
ipv6 = false
dhcp = true
Boilerplate4u commented 6 months ago

Test #2 also fails when using mirrorednetwork mode. WSL neither automatically assigns an IP address using DHCP nor establishes LAN contact when a static IP address is manually assigned to the Linux interface. While I'm familiar with troubleshooting network issues using tools like Wireshark and tcpdump, the lack of in-depth WSL documentation makes this a challenging 'black box' scenario.

Please see the attached Test-run-2-2024-03-16-1540.zip with configuration file and logs.

[wsl2]
processors=2
debugConsole=true
networkingMode = mirrored
# networkingMode = bridged
# vmSwitch = WSL-external
ipv6 = false
dhcp = true
Boilerplate4u commented 6 months ago

An interesting observation worth mentioning is that, since I've enabled debugConsole=true, I've noticed that WSL sometimes activates and then stops automatically when I for example launch File Explorer. I've also seen this behavior intermittently when using the pipe command, like "dir xxxx | less" but also on other occasions. However, it's quite difficult to pinpoint exactly when or why it occurs.

Any ideas why this might happen?

Boilerplate4u commented 6 months ago

Is there any in-depth documentation explaining the internal workings of mirrored networking mode for WSL and Linux?

Specifically, I'm interested in how the network interfaces are mapped between the two systems and the available control capabilities like broadcasting etc. How can I make the Windows network interface completely transparent (i.e., without impact of the Windows firewall). How and where (ie in Windows or Linux) should IP addresses be assigned using DHCP or statically?

Thanks in advance!

chanpreetdhanjal commented 6 months ago

Please follow the networking diagnostic script. https://github.com/microsoft/WSL/blob/master/CONTRIBUTING.md#collect-wsl-logs-for-networking-issues

It should create a folder like [WslNetworkingLogs-date_ver.zip]

jcrben commented 4 months ago

I'm interested in this because I'd like to use mirrored instead of bridged asbridged` isn't officially supported, but @Boilerplate4u bridged is working for me fyi

Snippet of output from fastfetch:

OS: Windows 11 (Pro) x86_64
Host: 82V2 (Slim 7 ProX 14ARH7)
Kernel: 10.0.22631.3593 (23H2)

wsl --version:

WSL version: 2.1.5.0
Kernel version: 5.15.146.1-2
4-FLOSS-Free-Libre-Open-Source-Software commented 4 months ago

bridged networking mode is working

wsl --version
WSL-Version: 2.2.4.0
Kernelversion: 5.15.153.1-2

Doesn't work anymore and eth0 is not available in bridge mode.

Also, eth0 is available in bridge mode.

jcrben commented 2 months ago

Following up on this - I'm now getting flakiness in my dns resolution. I tried hardcoding the nameserver to 1.1.1.1 or 8.8.8.8 or whatnot which seems like it helped a bit. I seem to get about a minute of good resolution before it starts getting flakey. See https://github.com/microsoft/WSL/discussions/11326#discussioncomment-10197496

dns resolution issues go away if I switch to normal from bridged.

ben@lenovo-legion ~$ wsl --version
WSL version: 2.2.4.0
Kernel version: 5.15.153.1-2
WSLg version: 1.0.61
MSRDC version: 1.2.5326
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.26091.1-240325-1447.ge-release
Windows version: 10.0.22631.3880
ben@lenovo-legion ~$ cat ~/.wslconfig
[wsl2]
networkingMode=bridged
vmSwitch=myswitch1
dnsTunneling=false