Thursday, October 4, 2012

Use Wi-Fi diagnostics to find active Bonjour services in OS X

Mountain Lion has an easy way to look up all available Bonjour services, if needed.

Apple's Bonjour service in OS X is a convenient zero-configuration autodiscovery technology that allows the operating system to locate and present various network services available to you. For example, if a computer on the network has file sharing available, then the system will discover that and make it available in relevant areas of the system such as the Finder, and also allow your system to easily discover shared printers, remote log-in capability, screen sharing, and similar services the remote computer may have enabled.

While convenient, most of the services that Bonjour broadcasts are contextual, meaning that they only appear on your computer in the relevant programs and features that support them. For instance, if a system on your network has remote log-in enabled then you can detect the remote log-in broadcast by opening the Terminal utility and choosing its New Remote Connection option, but otherwise you wouldn't be aware that this broadcast is available.

This contextual nature of Bonjour services can be considered convenient, as it only shows available servers in relevant contexts. However, you may wish to check what services are being broadcast by Bonjour, both by your system and others on the local network.

One way to do this is to use the "dns-sd" command in the Terminal, which can identify Bonjour broadcasts on a network. In order to use it you will need to specify the services you are looking for. For example, if you wish to search for systems that have remote log-in enabled (the SSH service), you would use the following command:

dns-sd -B _ssh

In this case, the "_ssh" service name is easy enough to remember, but others like "_afpovertcp" for file-sharing services are not so intuitive or easy to remember. As a result, using this feature may not be the best approach if you want to figure out what Bonjour services are available to you in general. Even if you use OS X features such as the Terminal's New Remote Connection option and the Finder to identify the available Bonjour services that they can handle, you may overlook others like iTunes music sharing, which only shows up in iTunes.

Luckily if you have Mountain Lion installed on your system then Apple includes a way to easily look up all Bonjour services that are presented on the local network. One of the updated features in Mountain Lion is Apple's Wi-Fi Diagnostics utility, which in its latest version includes a Bonjour Services browser. To access this browser, open the utility from the /System/Library/CoreServices/ folder or hold the Option key before clicking the Wi-Fi menu bar icon, and you will see an option to open the Wi-Fi diagnostics. In this utility, press Command-7 or choose Bonjour Services from the View menu, and the tool will list each service that is available from computers on the local network.

Not only can you list the services in this utility, but you can also connect to them by clicking their icons, which should open the handling program for the service (such as Screen Sharing to open VNC connections) and establish the connection.