Thomas De Reyck's Blog

Setting up intersubnet AirPrint on any printer with CUPS and a DNS server

About AirPrint and Bonjour

AirPrint is a specification from Apple, which allows iOS devices such as iPhones and iPads to print to specially equipped printers without knowing anything about them. On the device side, no configuration is necessary. It is advertised to work in 2 ways:

The problem is of course that in many settings this needs to work across subnets. By default, Bonjour, the technology used for advertising the printer, only works within one subnet. The solution is to configure your DNS server to advertise the Bonjour information instead. Every device that is using your DNS server, and is configured to use the correct search domain, can then use AirPrint to print.

Setting it up

In order to set this up, you need to perform the following steps:

Set up a CUPS server, and use it to share the printers that you want to make usable via AirPrint. I will not go in depth about how to do this, but you can just enable printer sharing on your Mac, or set up a single-purpose Linux server. Either way, when it is set up, you should have the URI used to communicate with your printer. For my printer, I am using the following URI: http://nexus:631/printers/Canon_iP4200.

Once the CUPS server is properly configured, you need to advertise the printers in your DNS. You can do this by adding records to your DNS zone, e.g.:

; These two records inform Bonjour clients that
; they should check the DNS zone for advertised services.
lb._dns-sd._udp                 IN PTR @
b._dns-sd._udp                  IN PTR @

;Everything below this line is specific for AirPrint.
_cups._sub._ipp._tcp            IN PTR Canon_iP4200._printer._tcp
_universal._sub._ipp._tcp       IN PTR Canon_iP4200._printer._tcp
Canon_iP4200._printer._tcp             IN SRV 0 0  631 nexus

Canon_iP4200._printer._tcp            IN TXT     ( "txtvers=1" "qtotl=1"  "rp=printers/Canon_iP4200" "adminurl=http://nexus:631/printers/Canon_iP4200" "ty=Canon_iP4200"  "product=(Canon_iP4200)"  "transparent=t"  "copies=t"  "duplex=t"  " color=t"  "pdl=application/octet-stream,application/pdf,application/postscript,image/jpeg,image/png,image/urf" "printer-type=0x801046" "URF=W8,SRGB24,CP1,RS600" )

Of course you should make changes to the records where appropriate, specifically the parts where it says “Canon_iP4200” should be changed to what is correct for your printer.

Restart your DNS server to make sure the new information will be provided. Also, make sure that you didn’t make any typo’s, and that the DNS zone is correctly loaded.

The iOS devices should be set up to use the correct search domain. E.g. if you defined the above records in the zone, then make sure the search domain is set up to be on these devices. It is probably best to have your DHCP server provide the correct search domain automatically, although you can also input them manually in the network settings of your iOS device.

Try printing something now. Your printer should be visible in iOS.


If you can see the printer, but it refuses to print, then check your CUPS logs. If you don’t see the printer, then the DNS records aren’t properly configured. Also, you may try restarting your iOS device to clear any DNS cache that might still be in memory.


#AirPrint #dns