microsoft / microsoft/WSL

Mirrored mode - WSL chooses to mirror the disconnected host wifi adapter instead of the connected host ethernet adapter

Open
#10,884 13 comments 2 reactions 0 assignees View on GitHub
network
Dominant language
C++
Stars
33.7k
Forks
1.8k
Avg merge
3d 17h
Merged PRs (30d)
116

Description

### Windows Version

Microsoft Windows [Version 10.0.22631.2792]

### 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-1

### Distro Version

Ubuntu 22.04

### Other Software

_No response_

### Repro Steps

Windows host has two network adapters:
* Wired (connected)
* Wifi (disconnected from AP)

Launch WSL2 with mirrored mode on

I expect eth0 to be mapped to the host's ethernet adapter. However, eth0 is down.
Alternatively, eth1 might be mapped to the host's ethernet adapter, however, eth1 is also down.
There's no network connectivity from the WSL2 instance.

When I connect wifi to the AP on the host (keep in mind that ethernet was connected all along), I get:

```
1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: mtu 1500 qdisc mq state DOWN group default qlen 1000
link/ether f0:2f:74:17:fb:9b brd ff:ff:ff:ff:ff:ff
3: loopback0: mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:15:5d:94:14:45 brd ff:ff:ff:ff:ff:ff
4: eth1: mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 3c:9c:0f:8c:67:e3 brd ff:ff:ff:ff:ff:ff
inet 192.168.86.244/24 brd 192.168.86.255 scope global noprefixroute eth1
valid_lft forever preferred_lft forever
inet6 fde2:e410:ef31:ba1b:918f:4cbd:b0aa:e961/64 scope global nodad deprecated noprefixroute
valid_lft forever preferred_lft 0sec
inet6 fde2:e410:ef31:ba1b:ed0d:5578:aa63:9ee5/128 scope global nodad noprefixroute
valid_lft forever preferred_lft forever
inet6 fe80::9a4e:1657:ce6e:4077/64 scope link nodad noprefixroute
valid_lft forever preferred_lft forever
```

Notice that eth1 is now mapped to the now connected wifi adapter (fine, I guess), but the connected ethernet adapter is not mapped within the WSL instance (eth0 is down).

### Expected Behavior

I expect the ethernet adapter to be always connected in WSL2 as eth0. This is the behavior I get if I change networking back to NAT.

### Actual Behavior

❯ ip a
1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: mtu 1500 qdisc mq state DOWN group default qlen 1000
link/ether f0:2f:74:17:fb:9b brd ff:ff:ff:ff:ff:ff
3: loopback0: mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:15:5d:94:14:45 brd ff:ff:ff:ff:ff:ff
4: eth1: mtu 1500 qdisc mq state DOWN group default qlen 1000
link/ether 3c:9c:0f:8c:67:e3 brd ff:ff:ff:ff:ff:ff

### Diagnostic Logs

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the report with mirrored mode, one connected ethernet adapter, and one disconnected Wi-Fi adapter, then trace how mirrored networking selects host adapters. Add regression coverage for the reported state and verify that WSL keeps the connected ethernet adapter available while ignoring the disconnected adapter.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, ubuntu
Domain
networking, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.