8

Recently I came across avahi-daemon and mdns....

Do I need a mDNS client in my system to connect with mDNS server?

Or is there any other way to connect a computer without mDNS client to a mDNS server computer (hostname.local)?

Is it possible to ping from computer without mDNS service running.

2
  • mDNS is quite unlike grown-up DNS. They require separate clients. See en.wikipedia.org/wiki/Multicast_DNS – user535733 Nov 3 '17 at 17:59
  • Ubuntu systems just need avahi-daemon and libnss-mdns installed to get all of <whatever>.host running. Other OSes you need to look in other places for help. (Recent Windows 10 have mDNS built in , if it helps.) – rfm Oct 22 '18 at 6:52
16

1. What is mDNS?

To get the overall picture, you need to look at something named Zeroconf. The Zeroconf concepts were implemented first and fully by Apple, but Apple use the marketing name Bonjour (initially Rendezvous) for it. mDNS (multicast DNS) is part of this -- see below.

Apple uses Bonjour for...

  • ...AirPrint (when iOS mobile clients are looking for an available printer in the LAN which they can use for "driverless printing"), or for

  • ...CUPS printer shares to be published in the LAN, or for

  • ...iTunes music library sharing on the LAN, and for

  • ...many other services which should work without a central DNS server to be installed, configured and maintained.

Under Linux, these same concepts were implemented by the Avahi project.

Bonjour/Zeroconf has 3 major goals:

  1. Allocate IP addresses without a DHCP server.
  2. Translate between host names and IP addresses without a DNS server.
  3. Discover services (like print providers) without a directory server like LDAP and make it easy to use them.

The complete technical Zeroconf concepts are specified in a series of RFCs, mainly:

  • IPv4LL / rfc3927 for assigning Link-Local IP addresses without a DHCP server.
  • mDNS / rfc6762 for multicast DNS to resolve hostnames without a central DNS server.
  • DNS-SD / rfc6763 for DNS-based Service Discovery without a central directory server.

One of the principal architects of Zeroconf was Stuart Cheshire. After writing down his thoughts about how to implement Apple's original ease of use AppleTalk Name-Binding Protocol over TCP/IP networking Stuart got hired by Apple to help implement the Zeroconf concept for Mac devices. He then also was a principal author of the above linked RFC documents.

Apple's Bonjour implementation is also available for Windows and Linux (although on Linux there is also an independent implementation named Avahi) as Open Source under the Apache License v2.0.

IANA runs a service names and ports registry, where developers who wish to define and develop new service types for their systems can reserve and register names for them.

2. Is it possible to make an mDNS query without an mdns service running?

Yes, it is.

Just run

avahi-browse -a

to get a continuously updated list of service announcements from all nodes on your LAN and the services they offer. A more verbose output is listed by

avahi-browse -v -a -t

The -t here also terminates the command automatically (and doesn't auto-update the list) after it can be assumed to have all currently active services discovered.

You can browse for IPP-enabled (Internet Printing Protocol) printers like this:

avahi-browse  _ipp._tcp  -r -t

The -r will "resolve" the found services and show a human readable name for them. The _ipp._tcp is the (weird) name encoding for services you need to get used to if you study this topic in more details. In this case it is the precise syntax to be used for IPP services in the LAN. Example output for above command:

+  wlan1 IPv4 Officejet 6500 [F051B9]                       Internet Printer     local
=  wlan1 IPv4 Officejet 6500 [F051B9]                       Internet Printer     local
   hostname = [HPA0B3CCF051B9.local]
   address = [192.168.78.24]
   port = [631]
   txt = ["Scan=T" "Duplex=F" "Color=T" "UUID=1c852a4d-b800-1f08-abcd-a0b3ccf051b9" "note=" "adminurl=http://HPA0B3CCF051B9.local." "mac=a0:b3:cc:f0:51:b9" "priority=30" "usb_MDL=Officejet 6600" "usb_MFG=HP" "product=(HP Officejet 6600)" "ty=Officejet 6600" "URF=CP1,MT1-2-8-9-10-11,OB9,OFU0,PQ3-4-5,RS300-600,SRGB24,W8,DEVW8,DEVRGB24-48,ADOBERGB24-48,IS1" "rp=ipp/printer" "pdl=application/vnd.hp-PCL,image/jpeg,application/PCLm,image/urf" "qtotal=1" "txtvers=1"]

You can also browse for services in a different domain, which exposes these to The Internet. One example domain were you may succeed with this (most of the time) is dns-sd.org:

  avahi-browse --domain=dns-sd.org -a -v -r

I've copied part of this answer from the Bonjour tag info over at AskDifferent. However, most of this tag info article was written by me anyways, so I don't at all feel bad about it....

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.