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:
Allocate IP addresses without a DHCP server
Translate between names and addresses without a DNS server
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/).
A good starting point is a simple comparison between mDNS and AppleTalk. Historically, AppleTalk handled zero configuration very well. 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 | ||
Multiple NICs | ||
Routing | – (only local DNS multicasts) | |
Additional info | – | (TXT info) |
Unicode | – | (UTF-8 names) |
Lookup tool | HELIOS “poll” | HELIOS “mdnstool” |
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.
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, like the HELIOS DHCP server, can automatically update a DNS server with the preferred computer name. Applications and system utilities will resolve host names into an IP address.
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."
Apple’s host resolving will automatically resolve host names via both DNS and mDNS.
If 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.
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. The HELIOS mDNS server does not support “Wide Area Bonjour”.
On OS X, HELIOS services do 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.
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.
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 allows specifying a custom host name for mDNS (see 19.10 “mDNS server preference keys”).
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 |
The “ifstat” tool is not available on Windows.
If only specific interfaces should be used by the HELIOS mDNS server, the interfaces preference (see 19.10 “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 |
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 |
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 …
… mapping mDNS host names to remote IP addresses
… registering non-Bonjour devices (printers, websites, etc.)
… easy mDNS registrations for third-party applications via the mDNS telnet service port
… synchronizing static registrations from primary server via the mDNS remote server port
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.
Network tracers like “Wireshark” can decode the mDNS protocol.
HELIOS “mdnstool” is a network diagnostic tool, which allows browsing for registrations and registering names. It resembles Apple’s OS X “dns-sd” (DNS Service Discovery) test 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.
mdnstool [-E] [-F] [-B <Type> <Domain>] [-L <Name> <Type> <Domain>] [-C <Type> <Domain>] [-R <Name> <Type> <Domain> <Port> [<TXT>...]] [-P <Name> <Type> <Domain> <Port> <Host> <IP> [<TXT>...]] [-Q <FQDN> <rrtype> <rrclass>] [-I] [-H <Host> <IP>]
If “mdnstool” is called without options, a brief usage info is issued (see above).
Enumerate recommended registration domains.
Enumerate recommended browsing domains.
Browse for service instances. To find a list of all
services
_services._dns-sd._udp
.
Look up a service instance.
Browse with port and IP address.
Register a service.
Proxy
Get the IP address of an mDNS host name.
Test registering and then immediately updating TXT record.
Register a host record for an unknown host.
Display help text.
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.
Form: _app-proto._tcp
or _app-proto._udp
, where
“app-proto” is a registered application protocol name.
Domain in which to register the service. In current implementations, only the local multicast domain “local” is supported.
Number from 0 to 65535. The TCP or UDP port number upon which the service is listening.
Host name of the mDNS client, e.g. “macbook.local.”.
IP address that the HELIOS mDNS server delivers upon request.
These additional parameters must be – if specified – the first argument:
(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.
(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.
(Numbered interface only)
The -p
option allows limiting the operation on a
specified interface only, e.g. -p4
. The interface
numbers are listed via the browsing -B
option (see
16.9.3 “Examples”).
Time when service was last refreshed.
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.
Internally used flag field with the content:
1 |
Additional messages in the same packet. |
2 |
A service has been added. |
3 |
A combination of both flags. |
Internally used ID of the interface via which a message came in.
Always local.
for mDNS messages; on DNS queries this
might also be any other domain, e.g. helios.de
.
Type description of the reported service.
Name
)Service name.
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
Data received as a result of the query, e.g. the IP address of the queried server name.
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
Register the host name “myhost.local” with the IP address 192.168.1.1.
Hosts can be registered using the -R
option, or with the -H
option.
This registration is valid until the connection to the server is closed.
The host can be resolved via the mdnstool -Q myhost.local.
query.
# mdnstool -H myhost.local 192.168.1.1
The host name registration is not supported running HELIOS servers on OS X 10.9 or higher.
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
Get more information on the printer “testreg” like the complete service name, its host and TXT resources:
# mdnstool -L testreg _printer._tcp
Get the IP address of a local host:
# mdnstool -Q macbook.local.