What is Bonjour

What exactly is Bonjour? You’ve probably heard about it. I know we’ve written about it a bit on Macgasm. But you might have no clue exactly what it is or what it actually does for OS X. Well I’ll attempt to clear up, and explain what Bonjour actually is and does for you.

Let’s start with the basics. Some of you may get bored by this section, because you already know about it, but bear with me.

Any device on a network requires an address to be able to talk to any other device. The most typical type of address is a Transmission Control Protocol/Internet Protocol Address, or commonly referred to as TCP/IP Address.

The TCP portion within TCP/IP is the actual way that computers talk to each other. Suffice it to say, that this could easily be a book on just the way that TCP works. But we’re going to focus on Internet Protocol or IP. There are two different types of IP Addresses. IP version 4 (IPv4) and IP version 6 (IPv6). IPv4 is the most common form on IP address existing today. I’m pretty sure you’ve seen one. It’s in ‘quad-octect’ formation. An example would be 192.168.200.1.

There are a few reserved address spaces. They are, 10.0.0.0 – 10.255.255.255, 172.16.0.0 – 172.31.255.255, 192.168.0.0-192.168.255.255, and anything above 223.0.0.0 to 255.255.255.255. There is one more, that I left out, but we’ll get to that in a little bit. Any ‘private’ network can utilize any of these addresses. Commonly, though, most home routers utilize the 192.168.x.x network. The 172.16.x.x-172.31.x.x networks, along the 10.x.x.x networks are used for larger networks. Mostly corporations, and larger businesses that need the additional addresses. If you’re on AT&T in the United states, your IP address for your iPhone is using a 10.x.x.x IP Address.

The need for these networks is because IPv4 has a limited amount of address that can be publicly given out. It’s about 4.2 billion addresses. And while this may seem like a lot, they are going to run out at some point. IPv6 provides 2^128 addresses. Which is approximately 6.5 billion addresses for everybody on the planet. So IPv6 will suffice for quite a while.

So what about this last address space. That’s 169.254.0.0 – 169.254.255.255. This address space is reserved for Automatic Private IP allocation. Basically, it’s a way for any device to automatically be able to setup and pick an IP Address so they can talk to each other. This is typically used when you don’t have a router or cable modem hooked up to your computer. An IP Address will automatically be chosen out of the 169.254.X.X range and any other device on that same address space can talk to the other devices on that same 169.254.X.X network. I know this is confusing, but this last part is the basis of Bonjour.

If you’re using 2 computers, that are not connected to a router the only way that they’ll talk to each other is by using a ‘Self-Assigned’ IP Address. This IP Address is in the 169.254.X.X range. And with this, they are able to talk to each other as if they were using any other IP address space. Now, onto Bonjour itself.

Now that the hard technical details are out of the way we can get back to Bonjour. Bonjour, also called Universal Plug and Play (UPnP) uses your local network to find other devices automatically. This allows for your Mac (or Windows computer) to talk to other devices. The other devices could be a router, network switch, toaster, refrigerator, microwave, Wireless Access Point, or just about anything else that is UPnP enabled.

It doesn’t just have to be hardware either. All Macs are bonjour enabled, so one Mac can see another Mac on the network via Bonjour. There are also many applications, like Cyberduck (an FTP/SFTP program) that are Bonjour enabled. If you were to load up Cyberduck it was show that it was able to find another computer, if it that computer had an FTP server, you could connect to it and being storing things on that computer’s FTP server.

One of the most common applications to use Bonjour is iTunes. iTunes uses Bonjour to find other iTunes libraries and connect to them. Along with iTunes, the iPhone / iPod Touch has Apple’s Remote application which allows you to connect to your iTunes library and control playback. The Remote application uses Bonjour as well.

Bonjour is not something that most will encounter on a day to day basis, but it is a service that is present whether it is actively being used or not. It is something that will become more popular and useful over time. Bonjour is available for Mac OS X, Windows, Linux, and iPhone OS.

I'm into everything technology related, particularly anything Apple related. I enjoy programming and tend to lean towards server-based technologies over client-based. You can contact me on twitter, via e-mail, or follow me on friendfeed.