DNS SD, also known as Apple’s Bonjour, utilizes DNS as a configuration database for automatic service discovery. For the most part, it appears its used by devices more than people. The multicast implementation, or mDNS, is what makes printers automatically show up in OS X when you put them on your network. I recently moved such a printer from a flat network, to one where the wired and wireless workstations were on separate subnets. In an attempt to make the printer easy to find, I implemented DNS SD over unicast so OS X laptops in the office could detect the printer with Bonjour.
First, I set the Domain Name to “office.opscode.com” using DHCP, so I would have a nice sandbox to mess around with DNS without breaking anything. Then I created a few DNS records:
OfficejetPro8500.office.opscode.com A 172.28.0.5 lb._dns-sd._udp.office.opscode.com PTR office.opscode.com. b._dns-sd._udp.office.opscode.com PTR office.opscode.com. _printer._tcp.office.opscode.com PTR _OfficejetPro8500._pdl-datastream._tcp.office.opscode.com. _pdl-datastream._tcp.office.opscode.com PTR _OfficejetPro8500._pdl-datastream._tcp.office.opscode.com. _OfficejetPro8500._pdl-datastream._tcp.office.opscode.com SRV 0 0 9100 OfficejetPro8500.office.opscode.com. _OfficejetPro8500._pdl-datastream._tcp.office.opscode.com TXT "txtvers=1" "note=Office Entry" "usb_MFG=HP" "usb_MDL=Officejet Pro 8500 A909g" "ty=HP Officejet Pro 8500"
- Specifies the internal IP address of the resource. We use this later in the SRV record.
- What domain the client should browse if they haven’t specified one.
- What domain a client in this domain should browse.
- Define a LPR/LPD printer. LPR is the “Flagship” protocol and “must” be defined (Port 515)
- Define a PDL printer, sometimes called raw (Port 9100)
- Specify the printer service. The last four fields there are priority, weight, port and host, per RFC 2782.
- Provide additional configuration information related to the printer
There isn’t a lot of clear information regarding how you should specify multiple key/value pairs in the TXT field. RFC 1035 specifies, <character-string> is a single length octet followed by that number of characters. <character-string> is treated as binary information, and can be up to 256 characters in length (including the length octet). For Microsoft DNS, check out this article. I was using DynInc’s Dynect, and was able to put all the key/value pairs in double quotes in the single input field. Also, if you are too, use the “Expert Editor” which is a menu option under the “Simple Editor,” it is a little easier to specify the multi-part hostnames this way. It sounds like in bind you put one key/value pair in double quotes per line, with the series wrapped in parenthesis.
Dynect wouldn’t let me specify the SRV record without a preceding underscore, which is a shame, because this is what OS X detects as the device name which also lower-cased it, making it a little difficult to read. You should be able to spaces in these names, but I wasn’t about to try escaping that. The key/value pairs in the TXT resource record are documented in the Apple Bonjour Printing specification.
- txtvers / Define what version of this format we are using
- note / User-readable information about the device, OS X displays this as Location
- usb_MFG / the Manufacturer name that the USB driver would specify. I made educated guesses at these.
- usb_MDL / the Model that the USB device would specify. Combined with the last field this will choose the driver for the user.
- ty / a User-readable name for the device. I had hoped this would be used in the Printer Name field in the GUI, but it wasn’t.
Aggggghhh!!! Zeroconf! O_o