microsoft / WSL

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

Querying `${hostname}.local` takes forever due to DNS server that is built into WSL #12080

Open sigasigasiga opened 3 days ago

sigasigasiga commented 3 days ago

Windows Version

Microsoft Windows [Version 10.0.22631.4169]

WSL Version

2.2.4.0

Are you using WSL 1 or WSL 2?

Kernel Version

Linux version 5.15.153.1-microsoft-standard-WSL2

Distro Version

Any, I guess. The bug reproduces on Ubuntu 23.04 and on openSUSE Tumbleweed 20240923

Other Software

on my openSUSE Tumbleweed machine: avahi-daemon 0.8 libnss-mdns 0.15.1-1.5 systemd 256.5-1.1

Repro Steps

$ cat /etc/resolv.conf
# This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/wsl.conf:
# [network]
# generateResolvConf = false
nameserver 10.255.255.254

$ time getent hosts ${hostname}.local
172.28.0.1      egor-bychin-pc.local

________________________________________________________
Executed in   10.02 secs      fish           external
   usr time    3.26 millis  177.00 micros    3.08 millis
   sys time    0.53 millis  530.00 micros    0.00 millis

However, if I change my DNS server in /etc/resolv.conf, then everything is super fast:

$ cat /etc/resolv.conf
nameserver 1.1.1.1

$ time getent hosts ${hostname}.local
172.28.0.1      egor-bychin-pc.local

________________________________________________________
Executed in   10.55 millis    fish           external
   usr time    1.31 millis   57.00 micros    1.26 millis
   sys time    0.21 millis  210.00 micros    0.00 millis

Expected Behavior

I get the results in 10 seconds

Actual Behavior

I get the results in 0.00001 seconds

Diagnostic Logs

No response

github-actions[bot] commented 3 days 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 script will output the path of the log file once done. If this is a networking issue, please use [collect-networking-logs.ps1](https://github.com/Microsoft/WSL/blob/master/diagnostics/collect-networking-logs.ps1), following the instructions [here](https://github.com/microsoft/WSL/blob/master/CONTRIBUTING.md#collect-wsl-logs-for-networking-issues) 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.

sigasigasiga commented 3 days ago

WslNetworkingLogs-2024-09-26_00-58-02.zip WslLogs-2024-09-26_00-56-16.zip

logs

github-actions[bot] commented 3 days ago
Diagnostic information ``` Multiple log files found, using: https://github.com/user-attachments/files/17138533/WslNetworkingLogs-2024-09-26_00-58-02.zip Detected appx version: 2.2.4.0 optional-components.txt not found ```