bonjour

About Apple Bonjour – Great Article

First of all: The following is not my writing. I copied it here just for future reference. If there is copy right issue, please contact me and I will remove it right away. 

I copied it from this link: http://blogs.brandeis.edu/netsys/2012/02/07/bonjour-hello-apples-misunderstood-zero-conf-protocol/

Thanks very much for the author to write up this great article.

———————————————————–

FEBRUARY 7, 2012POSTED IN: NETWORK

If you have ever used an Apple product in the last 8 years you have participated in Apple’s Bonjour network. Apple, being Apple, wanted to magically connect their devices. They didn’t want users entering ugly IP addresses or having to set up a directory of devices, that would be messy! They didn’t even want us propeller heads to be able to mess things up so they hid this magic behind a name. Originally it was called Rendezvous but someone owned that and probably wanted too much money for Apple to use it. (Actually this was probably a better name as it means a place to meet up) so they stuck with the French and renamed it Bonjour (hello in French).

So what IS Bonjour? Well, it is really two protocols, mDNS or multicast domain name system and DNS-SD or Domain Name System Service Discovery. Apple uses these two standard protocols to discover and advertise their services, like AppleTV or iTunes libraries, SSH, SAMBA, wireless routers etc. What is discovering a service? Well, in real terms, if you turn on your Apple product you may want to connect to some service over the network – say a file share or an Airplay device like a remote speaker or display. But how do you find these devices if you don’t know where they are on the network? Simple, you shout over the network and ask for them! OK, that is oversimplifying the issue, but it’s not far off from what really happens.

When your Apple product gets on a network it starts up the multicast DNS process (mdnsresponder) and sends a multicast join request to the address 224.0.0.251. What is multicast? Well that’s a longer post, but think of it as shouting with style. Your device then sends out a register or a hello announcing its intention to have a name on this network. It uses the name given by you, like John’s iPhone. Because all of these devices need a domain and this is all local, it uses the domain .local as in “John’s iPhone.local”, escaping all the illegal characters so they display all pretty to the user. The other devices do this greeting as well.

Each device participating in the mDNS group maintains a DNS server and a DNS cache. It serves out only its own services and computer name to IP mapping and caches the results of the queries it makes. Bonjour can also use a real DNS server to register itself and the services it has to offer but your DNS system must be set up for dynamic DNS and service discovery. It does this by attempting to register itself with the domain presented to it by the DHCP server.

OK, so now you are on your network and have an IP address but now you want to print or share something local. When you open your add printer wizard your device sends a new request to its fellow mDNS neighbors. It says, “Hey are there any printers on this network?” If there are printers shared on the network they respond and send their names to your computer. Once you attach to the printer, your computer sends print commands like it would had you known the IP address. However, since you discovered it by name, you save the name and not the IP address. In technical details, this means that your device made a DNS service discovery request.

Apple has some good documents on this here but here is a pretty picture that shows this happening:

All of this happens very nicely on your home network where there is only one network with one subnet. However, in an enterprise like Brandeis, it gets way more complicated. In order for Brandeis to support large numbers of users we need to set up lots of networks with lots of subnets.  Because users move around with their devices, and there are a lot of mobile devices at Brandeis, we use a technology called VLAN pooling. This provides lots of room for users. The down side is that a user’s device and the device they want to connect to will most likely will not be in the same subnet.

This is a pain. Unfortunately, there is not much we can do now to “fix” this. However, we are working on a fix with our wireless vendor that will address this issue in a very cool way! More to come on this!

UPDATE: I forgot to add this in: bonjour supports registering with enterprise DNS. This is also called wide area bonjour

Here are some links about this: