HELIOS Base UB2 User manual (Version 3.0.0)  
 

16 mDNS (Bonjour)

16.1 Introduction

Bonjour, also known as zero configuration networking, enables automatic discovery of computers, devices, and services on IP networks. Bonjour uses industry standard IP protocols to allow devices to automatically discover each other without the need to enter IP addresses or configure DNS servers. The HELIOS mDNS (multicast DNS) server implementation is based on the Apple Bonjour server. To provide a true zero configuration experience, Bonjour requires that devices implement three essential parts:

  1. Allocate IP addresses without a DHCP server

  2. Translate between names and addresses without a DNS server

  3. Locate or advertise services without using a directory server

HELIOS mDNS fully implements part 2. and 3. The automatic IP address configuration of the HELIOS server is up to the operating system and networking environment. HELIOS mDNS uses the existing IP configuration.

mDNS uses IP UDP network packets to exchange information. mDNS is a joint effort by participants of the “IETF Zero Configuration Networking” (www.zeroconf.org) and “DNS Extensions” working groups (datatracker.ietf.org/wg/dnsext/charter/).

16.2 mDNS vs. AppleTalk

A good starting point is a simple comparison between mDNS and AppleTalk. Historically, AppleTalk handled zero configuration very well and is still being used. The goal of mDNS is to offer similar services based on standard IP networks. A standard AppleTalk entity registration looks like:

lw8500:LaserWriter@HELIOS Support

“lw8500” represents the device name, “LaserWriter” the type, and “HELIOS Support” the AppleTalk zone. A standard mDNS registration looks like:

lw8500_printer._tcp. local. 515 pdl=application/postscript
AppleTalk mDNS
Device name (lw8500) Service name (lw8500)
Type (LaserWriter) Service type (_printer._tcp)
Zone (HELIOS Support) Domain (local.)
IP port (515)
TXT info (pdl=application/postscript)


Features AppleTalk mDNS
zeroconf hsymCheckMark hsymCheckMark
Multiple NICs hsymCheckMark hsymCheckMark
Routing hsymCheckMark – (only local DNS multicasts)
Additional info hsymCheckMark (TXT info)
Unicode hsymCheckMark (UTF-8 names)
Lookup tool HELIOS “poll” HELIOS “mdnstool”
Note:

The mDNS service name for a given type represents this service on a host. A lookup allows querying the host name for a given service.

16.3 Host names with DNS and mDNS

DNS case

Computer host names are usually resolved by use of a local “hosts” file lookup table or when configured from a DNS server. Some DHCP servers, e.g. the HELIOS DHCP server, can automatically update a DNS server with the preferred computer name. Applications and system utilities, e.g. the “ping” command will resolve host names into an IP address.

mDNS case

Applications must use the mDNS client APIs to resolve mDNS registered host names, e.g. “macbook.local” to the corresponding IP address. HELIOS “mdnstool” allows mapping the name into an IP address, e.g. mdnstool -Q "macbook.local."

Mac OS X case

Apple’s host resolving will automatically resolve host names via both DNS and mDNS.

Windows Bonjour case

When Apple’s Bonjour installer package (not the HELIOS mDNS installation!) is installed on Windows, an included Apple Bonjour NameSpace Provider (mdnsNSP) will resolve host names via both DNS and mDNS.

Wide Area Bonjour

The deployment of mDNS in a local network needs zero configuration to find its services. In this case all mDNS registered names are in the “local” mDNS domain. For wide area network names the existing DNS servers must be updated manually to handle the name resolving.

Apple Bonjour adds capabilities (“Wide Area Bonjour”) to register its names with an existing DNS server. This requires additional configuration and a trusted DNS server. At present, the HELIOS mDNS server does not support “Wide Area Bonjour”.

16.4 Coexistence of Apple Bonjour and the HELIOS mDNS server

Mac OS X

On Mac OS X, HELIOS services will not include the HELIOS mDNS server. The existing Apple mDNS server “mDNSResponder” is used instead. All HELIOS services and tools are compatible with the Apple Bonjour server.

Windows

On Windows, the HELIOS mDNS server will check whether the Apple Bonjour Server for Windows is running and, if yes, use it. If the Bonjour Server is not running the HELIOS mDNS server will be used instead. If HELIOS services are installed on Windows it is recommended to use the HELIOS mDNS server because support is provided via HELIOS and its partners.

16.5 HELIOS mDNS server

The HELIOS mDNS server is part of the HELIOS Base product and implements the multicast DNS protocol, which is called “Bonjour” by Apple. The HELIOS mDNS server supports all network interfaces with a valid IPv4 network interface. All IPv4 activated network interfaces are detected by default and used by the HELIOS mDNS server. Basically, no configuration is needed.

The HELIOS mDNS server is called “mdnssrv” and it is started by the HELIOS Service Controller (see 14 “The HELIOS Service Controller”).

The default mDNS server name is adapted from the server’s host name. If a different name is required the “mdnssrv” preference hostname (see 19.8 “mDNS server preference keys”) allows specifying a custom host name for mDNS.

The HELIOS network interface tool “ifstat” (see 8.8 “ifstat”) lists all available network interfaces with their names, e.g.:

Interface Address
lo0 127.0.0.1
en0 192.168.1.1
en1 172.16.0.1

If only specific interfaces should be used by the HELIOS mDNS server, the interfaces preference (see 19.8 “mDNS server preference keys”) allows limiting the interfaces being used.

If a setting of the HELIOS mDNS server is changed the service must be restarted, to adopt the new settings:

# srvutil stop -f mdnssrv
# srvutil start mdnssrv

An automatic reconfiguration of the HELIOS mDNS server is not implemented because server environments are expected to be static and should not change automatically compared with mobile computers where an automatic configuration change is a great feature.

The HELIOS mDNS server uses the (UDP) IP port 5353, the mDNS Windows (TCP) IP port is 5354 (loopback only!).

mDNS local library communication requires the following resources:

OS Resource
UNIX HELIOSDIR/var/run/mdnssrv
Mac OS X /var/run/mDNSResponder
Windows TCP port 5354 (loopback only)

Registration types used by HELIOS:

Service RegType
createpdf _helcreatepdf._tcp
notifysrv _telnet._tcp
authsrv _telnet._tcp
scriptsrv _telnet._tcp
afpsrv _afpovertcp._tcp and _adisk._tcp
heladmsrv _heladmsrv._tcp
pcshare _telnet._tcp
opisrv _telnet._tcp
websharesrv _telnet._tcp
dhcpsrv _bootps._udp and _telnet._tcp
toolsrv _heltoolsrv._tcp
papsrv _helprinter._tcp
lpd _printer._tcp
mdnsproxysrv _telnet._tcp

16.6 Sample network configurations

Single server network with clients
Single server network with two IP network interfaces
Router network

16.7 mDNS proxy server

The HELIOS mDNS proxy server ( “mdnsproxysrv”) forwards requests between network interfaces, and so allows connecting devices on different subnets, which would otherwise not “see” each other. HELIOS mDNS proxy also allows …

16.8 Additional information

16.8.1 Automatic mDNS service reconnect

All HELIOS applications will automatically reconnect and re-register their mDNS services if an mDNS server should abort. The reconnect will be done every 10 seconds within the first minute, and later on every minute until the mDNS server is available again. This works also if the Apple Bonjour server is used.

16.8.2 Tracing the mDNS server communication

Network tracers like “Wireshark” can decode the mDNS protocol.

16.9 mdnstool

HELIOS “mdnstool” is a network diagnostic tool, which allows browsing for registrations and registering names. It resembles Apple’s Mac OS X “dns-sd” (“Bonjour”) tool and can be used on all HELIOS supported platforms. Most of its functionality is not implemented in the binary itself, but in library code that is available to any application.

Usage:

-E                  (Enumerate recommended registration domains)
-F                      (Enumerate recommended browsing domains)
-B        <Type> <Domain>        (Browse for services instances)
-L <Name> <Type> <Domain>           (Look up a service instance)
-C        <Type> <Domain>      (complete Browse with IP-Address)
-R <Name> <Type> <Domain> <Port> [<TXT>...] (Register a service)
-P <Name> <Type> <Domain> <Port> <Host> <IP> [<TXT>...]  (Proxy)
-Q <FQDN> <rrtype> <rrclass> (Generic query for any record type)
-I   (Test registering and then immediately updating TXT record)
-H <Host> <IP>      (Register a host record for an unknown host)
-h                                      (Help and documentation)

16.9.1 Options

If “mdnstool” is called without options, a brief usage info is issued.

-E

Enumerate recommended registration domains

-F

Enumerate recommended browsing domains

-B

Browse for service instances To find a list of all services use the type “_services._dns-sd._udp”

-L

Look up a service instance

-C

Browse with port and IP address

-R

Register a service

-P

Proxy

-Q

Get the IP address of an mDNS host name

-I

Test registering and then immediately updating TXT record

-t

Set time limit for calls

-H

Register a host record for an unknown host

-h

Display help text

<Name>

May be arbitrary Unicode text (UTF-8), containing any legal unicode characters (including dots, spaces, slashes, colons, etc. without restriction), up to 63 bytes long

<Type>

Form: “_app-proto._tcp” or “_app-proto._udp”, where “app-proto” is a registered application protocol name

<Domain>

Domain in which to register the service. In current implementations, only the local multicast domain “local” is supported

<Port>

Number from 0 to 65535. The TCP or UDP port number upon which the service is listening

<Host>

Host name of the mDNS client, e.g. “macbook.local.”

<IP>

IP address that the HELIOS mDNS server delivers upon request

These additional parameters must be – if specified – the first argument:

-no

(No auto rename of duplicate registrations)
In combination with registering a service, duplicate names will not be renamed into a number suffix. Instead an error will be reported

-lo

(Loopback interface only)
By default registrations and lookups are performed using all configured network interfaces. The -lo option allows limiting the operation on the loopback interface only.

-p

(Numbered interface only)
The -p option allows limiting the operation on a specified interface only, e.g. -p4.

16.9.2 Output flags

Timestamp

Time when service was last refreshed.

A/R

Add or remove services. During a short request, there are probably only “Add” messages. However, if running the tool for a longer time, when services disappear, also “remove” (“Rmv”) messages will be shown.

Flags

Internally used flag field with the content:

kDNSServiceFlagsAdd = 2 A service has been added.
kDNSServiceFlagsMoreComing = 1 Additional messages in the
same packet.
3 A combination of both flags.
if

Internally used ID of the interface via which a message came in.

Domain (“Browsing” only!)

Always local for mDNS messages; on DNS queries this might also be any other domain, e.g. helios.de.

Service Type (“Browsing” only!)

Type description of the reported service.

Instance Name (“Browsing” only! With “Query” this flag is named Name)

Service name.

T/​C (“Query” only!)

Actual type and class. A query does not just request service messages but also internal server data. Service types as well as the classes are listed in the library file “libmdns.h”.

The type is required: kDNSServiceType_A = 1
and the class: kDNSServiceClass_IN = 1

Rdata (“Query” only!)

Data received as a result of the query, e.g. the IP address of the queried server name.

16.9.3 Examples

Registration

Register the printer “testreg” on the standard “lpd” port (515) to the local Bonjour/mDNS domain. This registration is valid until the connection to the server is closed:

# mdnstool -R testreg _printer._tcp local. 515
Browsing

List all services:

# mdnstool -B _services._dns-sd._udp

List all printers including their IP address:

# mdnstool -C _printer._tcp

List all printers found while stopping the browsing after 2 seconds:

# mdnstool -t2 -B _printer._tcp

If you have a server with more than one interface, you will see that the services are listed for each interface. In the “if” column you will see the interface number:

# mdnstool -t2 -B _printer._tcp
Browsing for _printer._tcp 
Timestamp     A/R Flags if Domain Service Type   Instance Name
16:48:21.410  Add     3  2 local. _printer._tcp. cpdf-suse113
16:48:21.410  Add     3  2 local. _printer._tcp. ppv-suse113
16:48:21.410  Add     3  2 local. _printer._tcp. p2d-suse113
16:48:21.411  Add     3  3 local. _printer._tcp. cpdf-suse113
16:48:21.411  Add     3  3 local. _printer._tcp. ppv-suse113
16:48:21.411  Add     2  3 local. _printer._tcp. p2d-suse113

If you wish to limit the output to a certain interface only, you may use the -p option. In the following example, the p3 parameter is specified to limit the output to the interface number 3:

# mdnstool -p3 -t2 -B _printer._tcp
Set interface to 3
Browsing for _printer._tcp 
Timestamp     A/R Flags if Domain Service Type   Instance Name
16:48:21.411  Add     3  3 local. _printer._tcp. cpdf-suse113
16:48:21.411  Add     3  3 local. _printer._tcp. ppv-suse113
16:48:21.411  Add     2  3 local. _printer._tcp. p2d-suse113
Lookup

Get more information on the printer “testreg” like the complete service name, its host and TXT resources:

# mdnstool -L testreg _printer._tcp
Query

Get the IP address of a local host:

# mdnstool -Q macbook.local.

HELIOS Website © 2011 HELIOS Software GmbH  
HELIOS Manuals May 17, 2013