Posted: Sat Mar 22, 2025 5:47 Post subject: Configure dnsmasq for airprint
I'm trying to get my router to advertise my printer so iOS devices can discover it. I'm running DD-WRT v3.0-r60284 std on a Linksys MX8500. I have Dnsmasq and SmartDNS working. I enabled mDNS and I added the following to my Dnsmasq Additional Options in order to create the necessary DNS records for Airprint:
Code:
# Browse records (point DNS-SD clients to the DNS-SD domain)
ptr-record=r._dns-sd._udp.condo.,condo.
ptr-record=dr._dns-sd._udp.condo.,condo.
ptr-record=b._dns-sd._udp.condo.,condo.
ptr-record=lb._dns-sd._udp.condo.,condo.
# Descriptor for Airprint printer
ptr-record=_ipp._tcp.condo.,clp-320._ipp._tcp.condo.
ptr-record=_universal._sub._ipp._tcp.condo.,clp-320._ipp._tcp.condo.
# Where the print queue can be found
srv-host=clp-320._ipp._tcp.condo.,clp-320.condo.,631
txt-record= {for some reason the board won't post the printer properties}
As you can see, the domain name is 'condo' and the printer name is 'clp-320'. Dnsmasq resolves 'clp-320.condo' and I can access the printer from hosts on my network. However, my iOS devices, connected to the same subnet, still cannot see the printer.
I've poked around the boards here and spent all day with Google but I'm out of ideas. I'd really appreciate any help figuring out where I've gone astray.
# HTTP records
ptr-record=_http._tcp.condo.,clp-320._http._tcp.condo.
srv-host=clp-320._http._tcp.condo.,clp-320.condo.,80,0,0
txt-record=clp-320._http._tcp.condo.,""
However, my iOS devices still don't see the printer. Using DNS-SD I get the following:
Code:
C:\>dns-sd -B
Browsing for _http._tcp
Timestamp A/R Flags if Domain Service Type Instance Name
16:17:30.558 Add 3 0 condo. _http._tcp. clp-320
16:17:30.558 Add 2 18 local. _http._tcp. Samsung CLP-320 Series (CLP-320)
And, if I use DNS-SD -L to look for clp-320, it returns the correct FQDN of clp-320.condo and its TXT record. Therefore, it appears the dnsmasq entries are working. This leads me to think I have an issue somewhere other than my dnsmasq entries. I'm just not sure how to go about further troubleshooting DNS-SD/avahi.
I'm definitely not an authority on how Airprint works. However, it is my understanding that an Airprint printer registers with the DNS server and the iOS device queries the DNS server for the DNS-SD search domain, thus unicast rather than multicast. Since my printer is not Airprint-enabled, I have to create those DNS records on its behalf. Now that I have created those, the iOS devices should be able to discover the printer via DNS.
1. Airprint client (e.g., iPhone) sends mDNS request for the desired resource (e.g., _ipp._tcp or _printer._tcp) to the multicast address and specifies that a unicast response is desired.
2. Airprint device (i.e., printer) or DNS-SD server sends unicast response with resource record information for the printer.
3. Airprint client uses returned resource record to connect to the printer via unicast.
Thus, the WiFi-attached device does not need to receive multicast broadcasts. However, as a side note, WiFi is capable of multicast, per 802.11.https://ieeexplore.ieee.org/document/9363693
Since I manually created the DNS-SD records, when an iOS device requests available printer resources, the DNS resolver should provide those resource records and the iOS device should "see" the printer. It seems like this must be where it is breaking down. Either the iOS device is not sending the request correctly, or dnsmasq is not sending the response. I guess I'll have to see if I can capture that request/response traffic on my router to see what is going on.
I fixed a typo in my dnsmasq config (missed a . in a ptr-record). After reading more documentation I updated my config again.
Code:
# Browse records (point DNS-SD clients to the DNS-SD domain)
ptr-record = b._dns-sd._udp.condo., condo.
ptr-record = lb._dns-sd._udp.condo., condo.
# Services offered
ptr-record = _services._dns-sd._udp.condo., _printer._tcp.condo. # Line Printer Daemon (LPD) service
ptr-record = _services._dns-sd._udp.condo., _pdl-datastream._tcp.condo. # Direct socket service
ptr-record = _services._dns-sd._udp.condo., _ipp._tcp.condo. # Internet Printing Protocol (IPP) service
ptr-record = _services._dns-sd._udp.condo., _http._tcp.condo. # Ebmedded web server printing service
I can now see the printer on iOS devices. However, printing fails; stuck saying it's waiting. I'm wondering if the problem now is that the printer does not support Apple's Universal Raster Format (URF, a.k.a. Apple Raster). I'll have to see if I can get it to work with some other Page Description Language.
I've been thinking along the same lines. I'm able to share the printer through CUPS on Linux and print from iOS devices. I'll likely stick with that because it's good enough and I've spent more time on this than the printer is worth.