microsoft / WSL

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

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

Open colemar opened 3 months ago

colemar commented 3 months ago

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

github-actions[bot] commented 3 months ago

Logs are required for review from WSL team

If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'. Otherwise please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.

How to collect WSL logs Download and execute [collect-wsl-logs.ps1](https://github.com/Microsoft/WSL/blob/master/diagnostics/collect-wsl-logs.ps1) in an **administrative powershell prompt**: ``` Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1 Set-ExecutionPolicy Bypass -Scope Process -Force .\collect-wsl-logs.ps1 ``` The scipt will output the path of the log file once done. Once completed please upload the output files to this Github issue. [Click here for more info on logging](https://github.com/microsoft/WSL/blob/master/CONTRIBUTING.md#8-collect-wsl-logs-recommended-method) If you choose to email these logs instead of attaching to the bug, please send them to wsl-gh-logs@microsoft.com with the number of the github issue in the subject, and in the message a link to your comment in the github issue and reply with '/emailed-logs'.

View similar issues

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!

Open similar issues:

Closed similar issues:

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

colemar commented 3 months ago

WSL logs WslLogs-2024-05-29_23-44-06.zip

github-actions[bot] commented 3 months ago

The log file doesn't contain any WSL traces. Please make sure that you reproduced the issue while the log collection was running.

Diagnostic information ``` .wslconfig found appxpackage.txt not found Found no WSL traces in the logs ```
colemar commented 3 months ago

image

colemar commented 3 months ago

Alternative workaround explanation: https://github.com/colemar/Win10WSL2UbuntuExternalIP/blob/main/README.md