How To: Create Printer Discovery in DNS for MAC Clients



Based on CUPS and DNS-SD printing.

How to create printer discovery in DNS for MAC clients

Mac OS from version 10.8 on discovers printer by using multicast DNS (mDNS or Bonjour). However, if your printers are located in a different IP-subnet this does not work as mDNS is limited to the local net only.
But mDNS works in conjunction with DNS Service Discovery (DNS-SD). So what you would need is to enable the bind nameserver from UCS to serve the needed service records.

Note: UMC currently does not allow the creation of such records. See this bug. Because of this the below steps are not persistent during updates. The files from Steps 2 will get overwritten every time when UMC rewrites the DNS configuration.
Additional Note: The changes could be made permanent when editing /etc/univention/templates/files/etc/bind/named.conf.samba4 but this will prevent UCS getting newer releases of this template file.


Step 1

Identify the backend you are using for your environment by using the ucr command:

root@ucs:/etc/bind# ucr get dns/backend

If using Samba you would get “samba4” back instead of the above "ldap".

In the further steps you need to edit the configuration files according to your backend.

Step 2

Add the response-policy to your configuration file.

For ldap use named.conf.proxy.
For samba4 use named.conf.samba4.

In the section

options {

add the following lines:

response-policy {
  zone "rp-printer";

Step 3

Add the zone entry to the configuration files.

For ldap use /etc/bind/local.conf.proxy
For samba4 use /etc/bind/local.conf.samba4

Add the following lines:

zone "rp-printer" {
  type master;
  file "/etc/bind/rp-printer";
  allow-query { none; };

Step 4

Create the above mentioned zone file /etc/bind/rp-printer with the following content by replacing the “” with your zone name:

@ SOA LOCALHOST. (1 1h 15m 30d 2h)

; define all internal domains to overwrite
b._dns-sd._udp           PTR
lb._dns-sd._udp          PTR
_ipp._tcp                PTR
_cups._sub._ipp._tcp      PTR
_universal._sub._ipp._tcp PTR
printer._ipp._tcp        SRV  0 0 631
printer._ipp._tcp        TXT ( 
			   "product=(Xerox WorkCentre 7556)"
			   "ty=Xerox WorkCentre 7556"

The b and lb entries tell the clients to use DNS for service discovery.
The _ipp and _cups entries point to the printer itself.
The _universal is needed for AirPrint.
The printer SRV record tells where the printer is attached to.
The TXT record just gives additional information regarding the printer.

You want to check if you created the file with correct syntax:

root@master:~# named-checkzone /etc/bind/printer-response-policy
zone loaded serial 1

If you are not getting the “OK” you need to check the file for typing errors.

Step 5

Restart your bind DNS server:

systemctl restart bind9

Step 6

Verify the entry is available by requesting the PTR records from your DNS server to see if it works:

host -t PTR

This will show all printer capable of doing IPP over TCP. If this works your basic setup works.

If you have avahi installed you can run the same check like this:

avahi-browse -t -d _ipp._tcp