System Administration Guide: Naming and Directory Services (DNS, NIS, and LDAP)

Multicast DNS and Service Discovery

Two extensions to the DNS protocol are multicast DNS (mDNS) and DNS Service Discovery (DNS-SD). mDNS extends the Domain Name Service system to operate over link-local multicast. DNS-SD adds support needed to discover network services over DNS.

Multicast DNS

Multicast DNS (mDNS) provides a naming service system that is easy to set up and maintain, for computers on a local link. All participating network devices on the same local link perform standard DNS functions, using multicast DNS rather than unicast, and do not need a unicast DNS server. For administrators, the primary advantage of mDNS is that no unicast DNS server needs to be maintained on the local network. There is no need, for example, to update and maintain host names in files to resolve hostname to IP address for devices on the local link that are using mDNS.

Service Discovery

Network services include printing, file transfer, music sharing, servers for photo, document and other file sharing, and services provided by other local devices. DNS service discovery support in the Solaris OS includes open source framework and tools from Apple to enable applications to advertise and discover network services, using DNS on the Solaris OS.

For users, network service discovery makes computing easier by enabling users to browse for services on the network, rather than needing to find the service manually. Existing standards, and work done by other companies and groups, assure that cross-platform support is available.

Administering mDNS

Use the Service Management Facility (SMF) to administer the mDNS daemon. You can use SMF to start and stop the mDNS service.

For an overview of SMF, refer to Chapter 17, Managing Services (Overview), in System Administration Guide: Basic Administration. Also refer to the svcadm(1M) and svcs(1) man pages for more details.

mDNS Deployment

For mDNS to function, it must be deployed on all peers that are to participate in mDNS. It is used to advertise the availability of services provided on the peer.

Multicast DNS and Service Discovery are both installed by default in the “all” cluster, when installing the Solaris OS. For other types of devices, for example, printers, music, video, and communication devices, many already have mDNS installed.

In addition to being installed, mDNS must be enabled, and must be included in the /etc/nsswitch.conf file. See nsswitch.conf(4)

Enable mDNS

For the Solaris OS, as root, or as a user with appropriate privileges, enable mDNS on each computer that will participate in mDNS.

# svcadm enable svc:/network/dns/multicast:default

Enabling mDNS this way persists through upgrades and reboots. For more information, see svcadm(1M).

Edit nsswitch.conf

To be able to resolve local hosts, edit the nsswitch.conf file and add mdns to the list of name services. For example, the file might look like the following:

# /etc/nsswitch.conf   
hosts: files dns mdns   
ipnodes: files dns mdns

For an example of the form such a file should take, see /etc/nswitch.conf.dns.

Review Errors or Messages

Check the multicast DNS service log for errors or messages.


mDNS and dns-sd Tool

Use the dns-sd command as a network diagnosis tool, to browse and discover services, similar to how you would use ping (1M) or traceroute (1M).

The dns-sd command is intended primarily for interactive use, mainly because its command line arguments and its output format can change over time, which makes invoking it from a shell script unpredictable and risky. Additionally, the asynchronous nature of DNS Service Discovery does not easily lend itself to script-oriented programming.

For complete dns-sd information, see the man page for dns-sd (1M) and to incorporate DNS service in applications, see the libdns_sd (3DNS_SD) man page.

EXAMPLES of the dns-sd command

Advertising a printing service

The following command advertises the existence of LPR printing service on port 515 on “My Test” machine, so that it will be available to DNS-SD compatible printing clients:

dns-sd -R "My Test" _printer._tcp. . 515 pdl=application/postscript

For this registration to be useful, the LPR service should be available on port 515.

Advertising a web page

The following command advertises a web page being served by an HTTP server on port 80 on My Test machine. The web page will appear on the Bonjour list in Safari and other DNS-SD compatible Web clients:

dns-sd -R "My Test" _http._tcp . 80 path=/path-to-page.html