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

mDNS service discovery middleware #317

Closed
rtreffer opened this issue Oct 3, 2016 · 4 comments · Fixed by coredns/coredns.io#200
Closed

mDNS service discovery middleware #317

rtreffer opened this issue Oct 3, 2016 · 4 comments · Fixed by coredns/coredns.io#200

Comments

@rtreffer
Copy link
Collaborator

rtreffer commented Oct 3, 2016

For my home network I used to run a zone that is filled by mDNS (excluding private IPv6 addresses). That way exposing a host was a matter of allowing access.
Not all applications are mDNS aware thus having a DNS zone is helpful in those cases, too.

I also used to run a caddy proxy for some services. Having different internal and external resolutions for the same names makes them work seemingly.

I'd thus like to see a mDNS service discovery middleware for CoreDNS.

@miekg
Copy link
Member

miekg commented Oct 3, 2016

[ Quoting notifications@github.com in "[miekg/coredns] mDNS service discov..." ]

For my home network I used to run a zone that is filled by mDNS (excluding private IPv6 addresses). That way exposing a host was a matter of allowing access.
Not all applications are mDNS aware thus having a DNS zone is helpful in those cases, too.

I also used to run a caddy proxy for some services. Having different internal and external resolutions for the same names makes them work seemingly.

I'd thus like to see a mDNS service discovery middleware for CoreDNS.

I'm not intimate familiar with mDNS - this also involves registration with
CoreDNS?

I.e. it would help to populate this bug with some design requirements; what is
needed in the middleware to make it happen. Is an in-memory store enough, or do
we need disk persistence or remote storage?

/Miek

Miek Gieben

@rtreffer
Copy link
Collaborator Author

rtreffer commented Oct 3, 2016

mDNS is basically DNS as a multicasting service on port 5353.

To receive e.g. printers one would broadcast a PTR query for "_printer._tcp.local". For hosts one could simple do a broadcast of a ANY query for the name, e.g.

dig @224.0.0.251 -p 5353 home.local ANY

; <<>> DiG 9.10.3-P4-Ubuntu <<>> @224.0.0.251 -p 5353 home.local ANY
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 43155
;; flags: qr aa; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;home.local.                    IN      ANY

;; ANSWER SECTION:
home.local.             10      IN      HINFO   "MIPS" "LINUX"
home.local.             10      IN      A       192.168.2.1
home.local.             10      IN      AAAA    fd00:b0ef:54ac::1

;; Query time: 2 msec
;; SERVER: 192.168.2.1#5353(224.0.0.251)
;; WHEN: Mon Oct 03 14:37:26 CEST 2016
;; MSG SIZE  rcvd: 95

An implementation would need at least

  • An internal cache that respects TTL (implementations may rate-limit responses)
  • An mDNS client that can re-fetch entries via mDNS, bound to port 5353 (with reuse port)
  • Translation of zone-relative entries (strip zone name + append .local for queries and the other way around for responses)

Others have build mDNS clients on top of your DNS library, e.g.: https://github.com/hashicorp/mdns

@miekg
Copy link
Member

miekg commented Oct 3, 2016

feel free to create PR that implements this, I think that would be a useful addition.

@miekg
Copy link
Member

miekg commented Feb 10, 2017

This is probably non-trivial, esp seeing discussions about mDNS popping up on Go DNS (github.com/miekg/dns)

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

Successfully merging a pull request may close this issue.

2 participants