Monday, December 19, 2011

Fun with AirPrint, Bonjour and DNS Service Discovery (dns-sd) for iOS

I'm currently working on getting AirPrint working with our installed base of printers that don't share an IP subnet with a fleet of iOS devices. For now I'm just going to post links to the source material I've gathered. Once I've figured it out, I'll come back and expand this post:

High-Level Outline:
  • Create new DNS zone (ex: bonjour.yourdomain, this domain does not have to have a public TLD. For instance, I used print.test, and will refer to the zone as print.test in this document)
  • Add new DNS zone as published search suffix in DHCP
  • Install CUPS server (I used Ubuntu Linux Server v11.10)
  • Configure a shared printer queue in CUPS for printer1 named printer1_q
  • Add an A record for CUPS server to print.test dns zone (assumes CUPS server is at
    • cups1 IN A
  • Add b._dns-sd._udp and lb._dns-sd._udp PTR record
    • b._dns-sd._udp IN PTR print.test.
    • lb._dns-sd._udp IN PTR print.test.
  • Add PTR records for printer
    • _universal._sub._ipp._tcp IN PTR printer1._printer._tcp.print.test.
    • _cups._sub._ipp._tcp IN PTR printer1._printer._tcp.print.test.
  • Add SRV records for CUPS printer queue named printer1_q on the print server
    • printer1._printer._tcp IN SRV 0 0 631 
  • Add TXT record for CUPS printer queue named printer1_q on the print server
    • printer1._printer._tcp IN TXT (
      "ty=HP Laserjet Color 4650 DN"
      "product=(GPL Ghostscript)"
      "pdl=application/octet-stream,application/pdf, application/postscript,image/jpeg ,image/png,image/urf"
      "URF=none" )
Notes on the TXT record:

  • Always set URF=none, it must be present for the record to work
  • The value from the "ty" key is displayed in the iOS printer search results as the printer name
  • The value from the "note" key is displayed under the printer name in the iOS printer search results
  • Feature descriptors are added in a key= where is T (for true) or F (for false). If a key is not specified or is blank, the value is assumed to be false. Optional keys include:
    • Duplex: enable duplex (two-sided) printing
    • Staple: can staple
    • Copies: supports printing more than one copy of a document
    • Collate: can collate (group) pages 
    • Punch: can punch
    • Bind: can bind (assume this is saddle stitch or other binding method)
    • Sort: printer includes a sorter
  • The printer-type key appears to reference bit mask data type. I have not found a description for this enumeration.
  • I have not found documentation printer-state enumeration. Most examples set this to 3
  • If your print server requires authentication, add the following literal string to the TXT record : "air=username,password"
I'm looking into the feasibility of using native IPP without CUPS in these TXT records and will update this post with what I find out.


IETF Draft: DNS-Based Service Discovery 

Manually Adding DNS-SD Service Discovery Records to an Existing Name Server

Apple Developer Documentation: Bonjour Operations

Apple Support Discussion: Airprint Information and FAQ

Apple Support Discussion: Airprint in the Enterprise across subnets

Bonjour Printing Specification

Printing from the iPad without buying a new printer

AirPrint and Linux

Airprint across subnets

CUPS & AirPrint from iPhone or iPad

Automatically generate AirPrint Avahi service files for CUPS printers

AirPrint with Ubuntu 10.10