GET STARTED
Skip to main content

Bonjour

Bonjour is the name of the Apple project implementing the multicast DNS (mDNS) protocol resolves hostnames to IP addresses within small networks that do not include a local name server. It is a zero-configuration service, using essentially the same programming interfaces, packet formats and operating semantics as the unicast Domain Name System (DNS).

Why it's important for discovery?

The mechanism referred as DNS-based Service Discovery - or DNS-SD - is used to discover available services on a client. Apple devices, smart home and digital media devices make an intense use of bonjour/zeroconf implementation to communicate with other devices into the networks the type and the capabilities.

How to collect the data?

There are two kinds of Multicast DNS queries:

  • One-shot queries of the kind made by legacy DNS resolvers.
  • Continuous, ongoing Multicast DNS queries made by fully compliant Multicast DNS queriers, which support asynchronous operations including DNS-Based Service Discovery.

The most basic kind of Multicast DNS client may simply send standard DNS queries blindly to IP 224.0.0.251, port 5353, without necessarily even being aware of what a multicast address is. A simple DNS resolver like this will typically just take the first response it receives. Multicast DNS allows a querier to place multiple questions in the Question Section of a single Multicast DNS query message.

Service names are available in the "answer" section with:

  • Type = PTR
  • Class = IN
  • Domain = _services._dns-sd._udp.local.

DNS-SD uses DNS TXT records to store arbitrary key/value pairs conveying additional information about the named service. Each key/value pair is encoded as its own constituent string within the DNS TXT record, in the form "key=value" (without the quotation marks).

Hence, services info are available in the "additional" section with:

  • Type = TXT
  • Class = IN

For further reference, please refer to the RFC.

References