microsoft / microsoft/WSL

Add a neutral networkingMode in C:\Users\user\.wslconfig

Open
#11,632 5 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature
Dominant language
C++
Stars
33.7k
Forks
1.8k
Avg merge
3d 17h
Merged PRs (30d)
116

Description

**Is your feature request related to a problem? Please describe.**
Cannot tell WSL2 to leave eth0 alone, that is don't set IP address, mask, routes.

**Describe the solution you'd like**
Some setting in .wslconfig like: `networkingMode = noip`

**Describe alternatives you've considered**
Add this to /etc/wsl.conf
```
[boot]
command = ip address flush dev eth0
```

**Why?**
Because being unable to make `networkingMode = bridged` work, I resorted to this solution:

1. wsl --shutdown
2. open Hyper-V Manager / Virtual Switch Manager
3. click on Virtual Switches / WSL
4. enable External Network and select the LAN interface
5. Click Apply
6. Start WSL Ubuntu 22.04.2
7. `sudo -i`
8. `vi /usr/lib/systemd/network/wsl_external.network`
```
[Match]
Name=eth0
[Network]
Description=WSLBridge
DHCP=true
```
9. `vi /etc/wsl.conf`
```
[boot]
systemd=true
```
10. `echo "nameserver 192.168.0.1" > /etc/resolv.conf`
11. `systemctl enable systemd-networkd`
12. `systemctl enable systemd-resolved`
13. `wsl --shutdown`
14. Start WSL Ubuntu 22.04.2
15. `ip addr` shows that eth0 has **two** ip addresses: 172.x.x.x.x and 192.168.0.x (the first I believe is related to NAT)
16. `ip route` shows **two** default routes

**Additional context**
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.19045.4412

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the requested .wslconfig networkingMode setting alongside the /etc/wsl.conf and /usr/lib/systemd/network/wsl_external.network examples in the issue. Determine how a neutral mode should leave eth0 without an address, mask, routes, or duplicate default routes; done means the configuration is documented and the resulting interface state matches that behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
networking
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.