Skip to content
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

Need help making mDNS work #2664

Closed
anohren opened this issue Nov 14, 2017 · 18 comments
Closed

Need help making mDNS work #2664

anohren opened this issue Nov 14, 2017 · 18 comments

Comments

@anohren
Copy link

anohren commented Nov 14, 2017

I can't figure out how to do it. I can't ssh into my .local address because it can't resolve the name.

I also have this unanswered question on Superuser:
https://superuser.com/q/1262998/36197

I've followed the last example in this thread:

#384

In other words:

~$ sudo service dbus start
 * Starting system message bus dbus                                                                                                                    [ OK ]
~$ sudo service avahi-daemon start
 * Starting Avahi mDNS/DNS-SD Daemon avahi-daemon                                                                                                      [ OK ]
~$ avahi-resolve --name rpi.local
Failed to resolve host name 'rpi.local': Timeout reached

This was done after installing the packages listed in this answer.

rpi.localcan be resolved by Windows.

Windows 10 Version 10.0.16299 build 16299

~$ lsb_release -a

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.3 LTS
Release:        16.04
Codename:       xenial
@therealkenc
Copy link
Collaborator

therealkenc commented Nov 15, 2017

#384 says SO_REUSEPORT was stubbed, but it isn't immediately obvious to me whether stubbing SO_REUSEPORT would address the problem. Windows already has a service listening on 5353. You fired up another service on the same port under WSL, but that doesn't mean the WSL service is going to get the request. Maybe someone out there could confirm they have actually got avahi-daemon running satisfactorily, because #384 technically only says the Protocol not available error was squashed, not that avahi-daemon actually does what people are expecting.

Or I could be talking out of my butt. Haven't tried it. But essentially you've set up (in principle) a load-balanced mDNS with two services on your box, and that tilts my head to the left. YRMV.

@anohren
Copy link
Author

anohren commented Mar 13, 2018

Ok, I see. I was led to believe that these lines from #384 was an indication that avahi was doing something useful:

:~# avahi-resolve-address 192.168.0.52
192.168.0.52    xxxxx.corp.microsoft.com

@therealkenc
Copy link
Collaborator

To be clear, I don't specifically know that it isn't doing something useful. I just did a netstat.exe -na | find "5353" and know Windows is already there; which is "unusual" compared to what would be the case on a Real Linux box. My November post was fishing for someone to say "yep avahi-daemon is working great on WSL here", in which case we could wander down the path of figuring out why it is working for them but not you. It was more of a question than a statement.

If you are feeling motivated you can try posting a concise CLI repro from clean Ubuntu / unadulterated Windows and see if you get a bite.

@anohren
Copy link
Author

anohren commented Mar 19, 2018

Thanks for the clarification

@OhMeadhbh
Copy link

please see #384 for a concise CLI repro from WSL and native Ubuntu.

@n3dst4
Copy link

n3dst4 commented Sep 6, 2018

I see #384 has been closed but this is still a problem for me. I don't mind how mDNS gets resolved in WSL, I just care that it should.

Here are ground-up repro steps to make the problem clear:

  1. Set up a computer on your network running actual Ubuntu. Let's call it bunty. 🐧
  2. Make sure avahi-daemon in installed: sudo apt install avahi-daemon
  3. Make sure avahi-daemon is started: sudo systemctl start avahi-daemon.service
  4. Test that this ubuntu box can resolve its own mDNS name: ping bunty.local
  5. For extra certainty, run avahi-browse -a to get a list of all the local mDNS info. It should contain bunty somewhere.
  6. Go to a Windows box with WSL installed. 🗔
  7. Open a CMD prompt and enter ping bunty.local
  8. You should see it pinging the IP address of the Ubuntu box from step 1, indicating that Windows 10's built-in mDNS resolution is working 👌
  9. Now pop open a WSL prompt and enter the same command ping bunty.local

Expected: it should be able to resolve the name like everything else on the network ✨
Actual: it has no clue 😢

@anohren
Copy link
Author

anohren commented Sep 6, 2018

Even worse: once WSL resolved my rpi.local address to a random internet server address. I was SSH-ing into it and I even got a prompt for my user password...

Bottom line, I accidentally sent my password to a random machine.

@n3dst4
Copy link

n3dst4 commented Sep 6, 2018

@anohren I had that too, but it turned out I had my work VPN up at the time and it was finding a raspberrypi.local on the office LAN. Any chance you were doing something similar?

@anohren
Copy link
Author

anohren commented Sep 6, 2018

Do you mean you had vpn set up in WSL, or in windows?

I don't have any vpn set up though so I doubt it.

@n3dst4
Copy link

n3dst4 commented Sep 7, 2018

@anohren Windows VPN, no idea what crazy network config they had but it was making their .local addresses resolvable over regular DNS. I was just throwing that out there because there's no way a .local address should be resolvable over the public internet.

@Coder-256
Copy link

This is still an issue on Windows 1903.

@strarsis
Copy link

+1! System ping in cmd.exe resolves correctly, but in WSL either with System error (when some unsupported resolver is used in /etc/nsswitch.conf; hosts) or just not being able to resolve.

@hovissimo
Copy link

Still not working in Version 10.0.17763 Build 17763

@daler-rahimov
Copy link

not working on winver 19041.1

@ma2shita
Copy link

ma2shita commented Jan 7, 2020

Wrote how to use powershell.exe. It is not cool, but worked.
I pray for COOL improvements.
#384 (comment)

@therealkenc
Copy link
Collaborator

Ref #3365 avahi-daemon is better on WSL2

@nnp19111990
Copy link

Hello Guys,
I am running the below command on my one of the board having custom linux OS ,
avahi-daemon --file=/system/etc/avahi/avahi-daemon.conf&
the avahi-daemon started on my board and I am able to ping the Host Name on one of the windows PC available with me , using commnad ping Ingenic.local
The only issue is i am not able to see the host name on bonjour application(add-on) running on Internet Explorer.
what is missing?

@dlamblin
Copy link

Well, the m in mDNS is multicast... And I noticed there's comment in WSL2 docs about mirrored networking mode allowing multicast to work. Maybe that's what you want? https://learn.microsoft.com/en-us/windows/wsl/networking#mirrored-mode-networking ; I didn't really check if it is, but I was searching why a zeroconf name wasn't working for a host on a WSL2 instance, and this old closed issue came up and later I found that mirrored mode addressed my issue, so I thought there may be others reading this with a similar situation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests