This comment expands on my feature request from above and gives you and your developers a few hints about where to start.
Discover currently available Zeroconf-enabled services
You can easily discover all currently available Zeroconf-enabled services in your neighbourhood. For this, command-line tools as well as GUI apps are available.
Command line tools
Here are a few command line examples which will let you discover DNS-SD/mDNS service announcements travel through the network which you currently are connected to:
Using the standard command line tool dig
You can use the following commands on any platform which supports dig
.
Host name resolution without central DNS server:
Simply resolve IP addresses for hostnames you happen to know – but without knowing the central DNS server’s IP address (or while the DNS server is not available) – by using an mDNS query:
$ dig -p 5353 @224.0.0.251 hostname.local.
mDNS is using port 5353 and the multicast address 224.0.0.251 for its queries and its announcements, which are, with about 99% match, just standard DNS packets.
The last commands could return the following output:
; <<>> DiG 9.8.3-P1 <<>> -p 5353 @224.0.0.251 hostname.local.
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 28705
;; flags: qr aa; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;hostname.local. IN A
;; ANSWER SECTION:
hostname.local. 10 IN A 192.168.177.24
;; Query time: 78 msec
;; SERVER: 192.168.177.24#5353(224.0.0.251)
;; WHEN: Thu Jun 9 10:51:34 2016
;; MSG SIZE rcvd: 50
Or, asking for a less verbose output:
$ dig +nocmd -p 5353 @224.0.0.251 hostname.local. +noall +answer
hostname.local. 600 IN A 192.168.177.24
Service Discovery on Remote Domain
Asking for info about all (fake) services which the (remote) domain dns-sd.org has on offer:
$ dig +nocmd -t PTR _services._dns-sd._udp.dns-sd.org. +noall +answer
_services._dns-sd._udp.dns-sd.org. 59 IN PTR _afpovertcp._tcp.dns-sd.org.
_services._dns-sd._udp.dns-sd.org. 59 IN PTR _pdl-datastream._tcp.dns-sd.org.
_services._dns-sd._udp.dns-sd.org. 59 IN PTR _ftp._tcp.dns-sd.org.
_services._dns-sd._udp.dns-sd.org. 59 IN PTR _ipp._tcp.dns-sd.org.
_services._dns-sd._udp.dns-sd.org. 59 IN PTR _ssh._tcp.dns-sd.org.
_services._dns-sd._udp.dns-sd.org. 59 IN PTR _http._tcp.dns-sd.org.
_services._dns-sd._udp.dns-sd.org. 59 IN PTR _printer._tcp.dns-sd.org.
They offer Apple File Sharing (indicated by _afpovertcp
) as well as Printing via JetDirect/Port9100 (indicated by _pdl-datastream
), File Transfer Protocol (_ftp
), Internet Printing Protocol (_ipp
), Secure Shell (_ssh
), a Web Server (_http
) and a legacy Port 515 LPR/LPD Printer (_printer
).
AirPrint Printer Discovery for Remote Domain
Enumerate all AirPrint printers available at (remote) domain dns-sd.org:
$ dig +nocmd -t ANY _universal._sub._ipp._tcp.dns-sd.org. +noall +answer
_universal._sub._ipp._tcp.dns-sd.org. 59 IN PTR Stuart's\032Home\032AirPrint\032Printer._ipp._tcp.dns-sd.org.
IPP Printer Discovery for Remote Domain
Enumerate all IPP printers (includes, of course, AirPrint printers) at dns-sd.org:
$ dig +nocmd -t ANY _ipp._tcp.dns-sd.org. +noall +answer
_ipp._tcp.dns-sd.org. 59 IN PTR Sales._ipp._tcp.dns-sd.org.
_ipp._tcp.dns-sd.org. 59 IN PTR Marketing._ipp._tcp.dns-sd.org.
_ipp._tcp.dns-sd.org. 59 IN PTR Engineering._ipp._tcp.dns-sd.org.
_ipp._tcp.dns-sd.org. 59 IN PTR 3rd\.\032Floor\032Copy\032Room._ipp._tcp.dns-sd.org.
_ipp._tcp.dns-sd.org. 59 IN PTR Stuart's\032Home\032AirPrint\032Printer._ipp._tcp.dns-sd.org.
Using the dns-sd
command
The following commands work only on a Mac (or any platform, including Windows and Linux, where you have self-compiled Apple’s open source Bonjour SDK).
General Service Discovery on Local Network
Check for all types of services which are available to my notebook in my current network environment:
$ dns-sd -B _services._dns-sd._udp local.
Browsing for _services._dns-sd._udp.local.
DATE: ---Thu 09 Jun 2016---
11:45:23.751 ...STARTING...
Timestamp A/R Flags if Domain Service Type Instance Name
11:45:23.752 Add 3 4 . _tcp.local. _ssh
11:45:23.752 Add 3 4 . _tcp.local. _sftp-ssh
11:45:23.752 Add 3 4 . _tcp.local. _atc
11:45:23.752 Add 3 4 . _tcp.local. _daap
11:45:23.752 Add 3 4 . _tcp.local. _smb
11:45:23.752 Add 3 4 . _tcp.local. _googlecast
11:45:23.752 Add 3 4 . _tcp.local. _ipp
11:45:23.752 Add 3 4 . _tcp.local. _ipps
11:45:23.752 Add 3 4 . _tcp.local. _afpovertcp
11:45:23.752 Add 3 4 . _tcp.local. _testlargetxt
11:45:23.752 Add 3 4 local. _apple-mobdev2._tcp. _sub
11:45:23.752 Add 3 4 . _tcp.local. _ipp
11:45:23.752 Add 3 4 . _tcp.local. _ipps
11:45:23.752 Add 3 4 . _tcp.local. _testtxt
11:45:23.752 Add 3 4 . _tcp.local. _testdualtxt
11:45:23.752 Add 3 4 . _udp.local. _net-assistant
11:45:23.752 Add 3 4 . _tcp.local. _nomachine
11:45:23.752 Add 3 4 . _tcp.local. _http
11:45:23.752 Add 3 4 . _tcp.local. _ipp
11:45:23.752 Add 3 4 . _tcp.local. _rfb
11:45:23.752 Add 3 4 . _tcp.local. _raop
11:45:23.752 Add 3 4 . _tcp.local. _apple-mobdev2
11:45:23.752 Add 3 4 . _tcp.local. _airplay
11:45:23.752 Add 3 4 . _tcp.local. _workstation
11:45:23.752 Add 3 4 . _tcp.local. _eppc
11:45:23.752 Add 3 4 . _tcp.local. _testupdate
11:45:23.752 Add 3 4 . _tcp.local. _udisks-ssh
11:45:23.752 Add 2 4 . _tcp.local. _amzn-wplay
^C
Amazing, isn’t it ?!?
All these other notebooks, workstations, IoT devices, iPhones, iPads and Android phones and tablets in my neighbourhood seem to be sharing their info about services available for them rather liberally… (But disappointing: no ownCloud or Nextcloud in sight…)
IPP Printer Discovery on Remote Domain
Searching for all IPP-enabled printers in domain dns-sd.org (using -B
for “browse”):
$ dns-sd -B _ipp._tcp dns-sd.org.
Browsing for _ipp._tcp.dns-sd.org.
DATE: ---Tue 17 May 2016---
17:40:30.998 ...STARTING...
Timestamp A/R Flags if Domain Service Type Instance Name
17:40:30.998 Add 3 0 dns-sd.org. _ipp._tcp. Stuart's Home AirPrint Printer
17:40:30.998 Add 3 0 dns-sd.org. _ipp._tcp. Sales
17:40:30.998 Add 3 0 dns-sd.org. _ipp._tcp. Marketing
17:40:30.998 Add 3 0 dns-sd.org. _ipp._tcp. Engineering
17:40:30.998 Add 2 0 dns-sd.org. _ipp._tcp. 3rd. Floor Copy Room
^C
Look up and retrieve all info about a specific service instance which was previously discovered (using -L
for “lookup”:
$ dns-sd -L "Stuart's Home AirPrint Printer" _ipp._tcp dns-sd.org.
Lookup Stuart's Home AirPrint Printer._ipp._tcp.dns-sd.org.
DATE: ---Tue 17 May 2016---
17:45:22.284 ...STARTING...
17:45:22.737 Stuart's\032Home\032AirPrint\032Printer._ipp._tcp.dns-sd.org. can be reached at airprint.dns-sd.org.:631 (interface 0)
txtvers=1 qtotal=1 pdl=application/postscript,application/vnd.hp-PCL,application/vnd.hp-PCLXL,application/pdf,image/urf rp=ipp/printer \
URF=CP99,W8,OB10,PQ3-4-5,ADOBERGB24,DEVRGB24,DEVW8,SRGB24,IS1-2-4,MT1-2-3-5-12,MT1-2-3-5-12,RS600 ty=HP\ LaserJet\ 400\ color\ M451nw \
Color=T Duplex=F Scan=F product=\(HP\ LaserJet\ 400\ color\ M451nw\) priority=10 adminurl=http://www.dns-sd.org/ServerStaticSetup.html \
note=At\ Stuart\'s\ house
^C
Using the avahi-browse
command line tool
The following commands should work on any Linux system with Avahi packages installed.
Browse for all locally available services of all types
This will give a similar result as the previously shown command dns-sd -B _services._dns-sd._udp local.
for Mac OS X:
$ avahi-browse _services._dns-sd._udp. -t
+ wlan1 IPv4 _amzn-wplay _tcp local
+ wlan1 IPv4 _sftp-ssh _tcp local
+ wlan1 IPv4 _atc _tcp local
+ wlan1 IPv4 _daap _tcp local
+ wlan1 IPv4 _ssh _tcp local
+ wlan1 IPv4 _apple-mobdev2 _tcp local
+ wlan1 IPv4 _udisks-ssh _tcp local
+ wlan1 IPv4 _testupdate _tcp local
+ wlan1 IPv4 _eppc _tcp local
+ wlan1 IPv4 _airplay _tcp local
+ wlan1 IPv4 _raop _tcp local
+ wlan1 IPv4 _rfb _tcp local
+ wlan1 IPv4 _ipp _tcp bonjour.muada.nl
+ wlan1 IPv4 _http _tcp local
+ wlan1 IPv4 _nomachine _tcp local
+ wlan1 IPv4 _net-assistant _udp local
+ wlan1 IPv4 _testdualtxt _tcp local
+ wlan1 IPv4 _testtxt _tcp local
+ wlan1 IPv4 _ipps _tcp bonjour.muada.nl
+ wlan1 IPv4 _ipp _tcp local
+ wlan1 IPv4 _sub _apple-mobdev2._tcp local
+ wlan1 IPv4 _testlargetxt _tcp local
+ wlan1 IPv4 _afpovertcp _tcp local
+ wlan1 IPv4 _ipps _tcp local
+ wlan1 IPv4 _ipp _tcp dns-sd.org
+ wlan1 IPv4 _googlecast _tcp local
+ wlan1 IPv4 _smb _tcp local
+ wlan1 IPv4 _workstation _tcp local
You should be easily figuring out how to modify the avahi-browse
command to query specific local or remote (like provided on dns-sd.org) Zeroconf-enabled services.
GUI tools
Mac OS X: Bonjour Browser
For Mac, there is the no-cost GUI tool Bonjour Browser by Kevin Ballard available for download here:
It is rather old, but still works. At my current location, it displays this result in its very simple interface:
Linux: avahi-discover
For Linux, there is the GUI app avahi-discover. It will display a similar simple interfaces as the above Bonjour Browser tool. Note, how clicking on a particular service instance will display all its TXT record contents in the lower window pane:
Android, iOS
How Zeroconf Works
Zeroconf combines mainly two networking protocol “standards” which have been layed down in a few IETF RFC documents:
-
DNS-SD (DNS-based Service Discovery) as described in RFC6763 at http://www.ietf.org/rfc/rfc6763.txt
-
mDNS (Multicast-based Domain Name Services) as described in RFC6762 at http://www.ietf.org/rfc/rfc6762.txt and RFC6761 at http://www.ietf.org/rfc/rfc6761.txt.
DNS Service Discovery works via multicast announcements and queries. The details about the exact protocol to be used (like using TCP/UDP port 5353, or addressing the reserved multicast IP address 224.0.0.251 and more) are defined as “mDNS”.
DNS-SD uses existing DNS record types to store, hold and cache specific information about services: SRV, TXT and PTR records. Thus, DNS-SD packets sent on the network are very similar to “standard” DNS packets. Therefor also, all standard DNS servers can be used to hold and deliver on request of clients all DNS-SD related information pieces.
Clients only have to be taught how to ask for specifics about a particular service type by knowing its name. More “complicated” services may use a number of (proprietary) TXT records which relate specific info to clients who know how to make use of them. Potential AirPrint clients for example are looking all IPP print services first, then for two specific TXT records to be present in their announcments: a pdl=
field which contains the image/urf
value, and the existence of an URF=
field. If these two TXT records are present, an iPad will list this IPP printer as AirPrint capable. If further records like Duplex=T
and Color=T
are present, they will add duplex and color selection buttons to the print dialog user interface. The TXT record air=username,password
tells the clients that they need username + password in order to use that AirPrint service.
Of course, Nextcloud developers need to come up with their own scheme of TXT records which they want to use for DNS-SD announcements via mDNS or standard wide area DNS, so clients are able to find and successfully connect to Nextcloud servers.
Developers who want to Zeroconf-enable their applications (or hardware devices) are recommended to, as a minimum, register a service type name directly through IANA. For ownCloud or Nextcloud these could be named as _owncloud
and _nextcloud
. You could even consider to register a preferred port number to be used. (Of course, you could even implement this functionality without registering a name, as long as Nextcloud servers and clients both know how to call each other, but this would be rather bad netizenship…)
Further Resources
Difficult to discover sub-pages of the dns-sd.org main website (Isn’t it ironic?) – URLs here: