-
Notifications
You must be signed in to change notification settings - Fork 824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DNS Server and port 53 #9095
Comments
Thank you for reporting this @boan-jfm. UDP traffic can't be routed to WSL via 127.0.0.1 at this time, but TCP should work. Can you try in TCP mode? What's the output of |
I did a
WSL response (immediately)
PowerShell response (very slow - maybe minutes)
It seems to work with TCP lookup - but it is very slow, and you can't select whether a common client should use TCP or UDP? I wanted to test some implementations and point my test device to the developer machine running dnsmasq in WSL, and let the "test" TLD point to the nginx server running on the same machine - but i think this requires UDP to be available? |
DNS can happen over either TCP or UDP so I don't think UDP is needed here. What if you try to use |
PowerShell
Every lookup is fast now - I do not know if there is a cache - but seems to work with the WSL 2 IP address on eth0. The only lookup not working is the UDP against 127.0.0.1 - but I think my test devices should work when using the WSL 2 IP address. I will try that again - thank you. Is there an explanation for why UDP is not working for 127.0.0.1? |
Okay - maybe I need some knowledge on how IP is mapped from Windows to WSL. WSL
PowerShell
How can I get the lookup to work on the external interfaces? |
I have the pretty much the same need as @boan-jfm. I need to hit a service running in WSL from another device on my local network where that device uses a DNS name that can only be resolved by my local system. I was hoping to add my system as a secondary DNS server in my local network router configuration. The client on the device in question would only try UDP for the name resolution, so TCP is probably not an option. If the DNS service is needed to have things working between host and guest (WSL), would it be possible to add to the configuration that the SharedAccess service module is using for resolution? As it stands, I can't run a DNS server listening on UDP port 53 nor can I add additional entries to the existing service. @OneBlue, would it be possible to add this functionality? Can this be done today via some undocumented config? BTW, @boan-jfm , on my system, I don't see a listening service using TCP port 53, only UDP. Did I understand correctly that on your system you have something using TCP? |
@asampal When I run dnsmasq in WSL2 it listen on UDP and TCP port 53 as default. |
When I tried to install dnsmasq in WSL2 it actually mentioned a failure due to port 53 already being used as you can see here: This should be expected given the SharedAccess service module which is tying up the port. I wonder how it installed for you without any warnings. Perhaps it's due to differences in Windows and WSL kernel versions. I'm at:
|
I do not know. But @OneBlue did not mention the "SharedAccess" as an issue in his first comment - I mentioned it in the issue description as i thought it was blocking the DNS requests to WSL. As far as I understand it, WSL 2 has its own closed environment (VM) - if you run In WSL 2 you can run |
Where I said, "This should be expected given the SharedAccess service module which is tying up the port.", more precisely it would be the case if the WSL2 adapter that dnsmasq was trying to bind to was bridged to the host adapter. |
Just a note: From the following comment #8783 (comment) I tried to run |
Is there any updates on the resolution of this issue ? |
dumb bot |
How you stop listening sharedaccess program on your ubuntu using the following steps. Create a .wslconfig file in your user home directory
add the following content and save changes.
Now if you are already inside wsl2
Wait 8 seconds and login to your wsl using Check who is listening port 53 using the following command:
|
Version
Microsoft Windows [Version 10.0.19044.1766]
WSL Version
Kernel Version
5.4.72
Distro Version
Ubuntu 2204
Other Software
Dnsmasq - configured to listen on 0.0.0.0 interface or 127.0.0.1 - default port 53
Repro Steps
nslookup example.org 127.0.0.1
and see the correct resultnslookup example.org 127.0.0.1
- Server: UnKnownIf you run a
netstat -nab
in PowerShellIt seems like a service occupying port 53 on Windows when running WSL. I have tried with a Windows restart - and the SharedAccess seems to start with the WSL start up.
Expected Behavior
You should be able to run
nslookup
within Windows and not only in WSL 2.Actual Behavior
dnsmasq runs fine in WSL 2, but can not be reached within the Windows environment
Diagnostic Logs
WSL
PowerShell
The text was updated successfully, but these errors were encountered: