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

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 10.0.0.10
    • cups1 IN A 10.0.0.10
  • 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 (
      "txtvers=1"
      "qtotl=1"
      "rp=printers/printer1_q"
      "adminurl=http://cups1.print.test:631/printers/printer1_q"
      "ty=HP Laserjet Color 4650 DN"
      "product=(GPL Ghostscript)"
      "transparent=t"
      "copies=t"
      "duplex=t"
      "color=t"
      "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.

Sources:

IETF Draft: DNS-Based Service Discovery 
http://files.dns-sd.org/draft-cheshire-dnsext-dns-sd.txt

Manually Adding DNS-SD Service Discovery Records to an Existing Name Server
http://www.dns-sd.org/ServerStaticSetup.html

Apple Developer Documentation: Bonjour Operations
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/NetServices/Articles/NetServicesArchitecture.html#//apple_ref/doc/uid/20001074-SW1

Apple Support Discussion: Airprint Information and FAQ
https://discussions.apple.com/thread/2658560?start=15&tstart=0


Apple Support Discussion: Airprint in the Enterprise across subnets
https://discussions.apple.com/thread/2751128?start=0&tstart=0

Bonjour Printing Specification
http://devimages.apple.com/opensource/BonjourPrinting.pdf

Printing from the iPad without buying a new printer
http://jcostom.wordpress.com/2011/03/16/printing-from-the-ipad-without-buying-a-new-printer/

AirPrint and Linux
http://www.finnie.org/2010/11/13/airprint-and-linux/

Airprint across subnets
https://sites.google.com/site/iwastepaper/

CUPS & AirPrint from iPhone or iPad
http://element.edoceo.com/howto/cups-airprint

Automatically generate AirPrint Avahi service files for CUPS printers
http://atxconsulting.com/blog/tjfontaine/2010/11/21/automatically-generate-airprint-avahi-service-files-cups-printers

AirPrint with Ubuntu 10.10
http://hartlessbydesign.com/blog/view/197-airprint-with-ubuntu-1010

0 comments :