Add PTR and NS Records to DNS Resolver possible?


  • LAYER 8 Global Moderator

    Tell you what... I have some clients (ipad, iphone, etc) that pretty much need airprint to work. If I get a chance after work I will move my printer to my lan vs the secured wireless (the printer supports airprint) so a long as devices are on the same L2 they find the printer directly.

    This has been on my sort of todo list for awhile ;) But since I only allow my devices to print it was just faster and easier to put the printer on that L2. My wired devices that print - for example my PC or laptops that might be on other wireless networks like guest, etc. Just point directly to brother.local.lan for the printer that resolves to 192.168.2.50.

    But allowing print from my secured wifi (eap-tls) for my devices, and allowing to print on my guest might be useful I guess ;)

    The dns-sd should be possible to setup in unbound.

    I can setup the records from work.. But won't really be able to test until I get home and fire up ipad/iphone, etc.



  • @johnpoz

    Hi johnpoz,

    Printer discovery with PaperCut Mobility Print leverages the way that Apple devices natively discover printers on the network. It's meant to be zero-config for the end users, which means no entering IP addresses or server FQDNs for it to work. Admittedly, this means that there is a bit more work for the sysadmin to do though.

    The way this works is that macOS and iOS clients will look for two DNS records (b._dns-sd._udp and lb._dns-sd._udp) which we forward to an NS record (pc-printer-discovery). Whereas, Windows, Android, and Chrome devices running the Mobility Print client app will just look for the NS record. This NS record in turn can resolve to the hostname or IP address of the Mobility Print.

    I want to let you know that I'd be more than happy to do a remote session with you to see if there's a way to get this working with Unbound on PFSense. We've actually had few PFSense enthusiasts reach out to us to ask if we can help them, so it would be great to get a solution tested and documented.

    Let me know if this is something that you're interested in, or if there are any questions I can answer for you at all.


  • LAYER 8 Global Moderator

    I don't really give 2 shits about your product... You should be reaching out to the OP that is having the hard time with this.. Not me ;)

    The questions you can answer is the simple easy to understand instructions for how to make it work with unbound.. If you have had a few pfsense users reach out to you - you would think you would already have this documented on your site..


  • LAYER 8 Netgate

    @papercutsupportdude said in Add PTR and NS Records to DNS Resolver possible?:

    The way this works is that macOS and iOS clients will look for two DNS records (b._dns-sd._udp and lb._dns-sd._udp) which we forward to an NS record (pc-printer-discovery). Whereas, Windows, Android, and Chrome devices running the Mobility Print client app will just look for the NS record.

    What, precisely, would a BIND zone file (or set of zone files) look like that accomplishes this?


  • LAYER 8 Global Moderator

    How you can do this is in that link I posted Derelict.. Most of all the docs I found are for bind which is running as authoritative for your zone.. But pretty sure you could get it working with unbound.

    I found the stuff that needs to go in to dns for my printer via avahi-browse.. But have not had time to translate it to record structure yet.. Is kind of PITA if you ask me - just easier to place the airprint on the same L2 as the devices wanting to use it, or just use avahi ;)

    So for example here is what you have to translate to TXT record...

    =   ens3 IPv4 Brother HL-3170CDW series                     Internet Printer     local
       hostname = [BRN30055C116AD9.local]
       address = [192.168.2.50]
       port = [631]
       txt = ["print_wfds=T" "UUID=e3248000-80ce-11db-8000-30055c116ad9"     "URF=SRGB24,W8,CP1,IS1-4,MT1-3-4-5-8-11,OB10,PQ4-5,RS600,DM1" "TBCP=F" "Transparent=T" "Binary=T" "PaperCustom=T" "Scan=F" "Duplex=T" "Copies=T" "Color=T" "usb_CMD=PJL,PCL,PCLXL,URF" "usb_MDL=HL-3170CDW series" "usb_MFG=Brother" "priority=25" "adminurl=http://BRN30055C116AD9.local./net/net/airprint.html" "product=(Brother HL-3170CDW series)" "ty=Brother HL-3170CDW series" "note=" "rp=ipp/print" "pdl=application/octet-stream,image/urf,image/pwg-raster" "qtotal=1" "txtvers=1"]
    

    There is some other records as well - like I said its kind of real PITA ;) If I ever get motivated enough I will put together some sort of run through. But you really need to be able to do the query directly to your printer so you know what it returns for devices on the local.. If you have the command dns-sd you can do a specific query that is suppose to come back in the bind syntax.. But haven't got that running on any of my linux boxes.. Think its more a bsd command. Closest thing is the avahi-browse.. Which you get stuff like this back

    user@uc:~$ avahi-browse --all
    +   ens3 IPv4 Brother HL-3170CDW series                     Web Site             local
    +   ens3 IPv4 Brother HL-3170CDW series                     Internet Printer     local
    +   ens3 IPv4 Brother HL-3170CDW series                     UNIX Printer         local
    +   ens3 IPv4 Brother HL-3170CDW series                     PDL Printer          local
    

    Then you can use the -r to find out what those actually return that you have to translate to actual dns records. So you need for sure those 2 PTR, then there is something that returns SRV and TXT, etc. But you have to set them up for your actual search domain vs what the browse comes back looking for .local I had a sniff I grabbed if my ipad finding it doing the mdns queries, etc.

    I haven't got up the drive yet to read the actual RFC ;) Since I never really have had any need for this.


  • LAYER 8 Netgate

    I am not in the mood to do a search/research on this. They should be able to provide example bind zone files. Those can then likely be converted to unbound.



  • @derelict
    We actually do show examples of the BIND DNS records on this page (albeit a bit further down): https://www.papercut.com/products/ng/mobility-print/manual/how-to-setup/step-2-configuration/discover-your-printers-using-dns/

    b._dns-sd._udp IN PTR pc-printer-discovery
    lb._dns-sd._udp IN PTR pc-printer-discovery
    pc-printer-discovery IN NS print-server-hostname
    print-server-hostname IN A XXX.XXX.XXX.XXX

    It's important to note though that if you have the records set up this way there are still a couple hurdles to successful discovery. The clients need to be pointed a the right DNS server, and need a DNS Search Suffix that matches the zone where the records are stored.

    We are happy to work with you to get Mobility Print up and running in your environment. Just head over to our support portal to get a ticket started if you'd like a hand. https://support.papercut.com/hc/en-us/requests/new/


  • LAYER 8 Global Moderator

    Those records tell the client to search in pc-printer-discovery domain, and that the ns for pc-printer-discovery domain is print-server-hostname

    And what should print-server-hostname point to.. Your mobility server?

    The instructions are as clear as MUD...

    Where is the example when using domain.tld internally as the search suffix on the clients.

    So
    b._dns-sd._udp
    lb._dns-sd._udp

    would actually be
    b._dns-sd._udp.domain.tld
    lb._dns-sd._udp.domain.tld

    This would tell the client to use pc-printer-discovery as their domain suffix, and go ask the NS for that which is print-server-hostname

    So what exactly is print-server-hostname in your scenario? The actual server running your software, some box running the mobility thing?

    Those records are no problem to setup, the NS would be a simple domain override in unbound... Just need to know where to point this... because now the client is going to come looking for its printer records at that server.. ie the stuff like _ipp._tcp.pc-printer-discovery and _universal._sub._ipp._tcp.pc-printer-discovery right??

    These records will get served up by some box running YOUR software..

    So to get this to work with unbound you just need a domain override pointing to whatever box is running your software and need to know what domain its going to be doing the the query against. This pc-printer-discovery domain.

    So the records in unbound should be like I listed above in the custom box if your clients are using domain.tld as their current search suffix.

    server:
    local-data: "b._dns-sd._udp.domain.tld IN PTR pc-printer-discovery"
    local-data: "lb._dns-sd._udp.domain.tld IN PTR pc-printer-discovery"

    0_1532361541816_query.png

    Then just need a domain override to point the domain pc-printer-discovery to whatever box is running your software and will provide the rest of the queries in this pc-printer-discovery domain.

    Here is the thing.. When I get around to putting this together its not going to have anything to do with your software. But just a simple walk through of how to put in the records to allow the client to find the airprinter on the other network.



  • This post is deleted!


  • @johnpoz
    About putting together a guide showing how to point clients to a AirPrint printer in another subnet, that would be really cool actually. I've been wanting to try this out for awhile, but haven't got around to it.

    To clarify a few points about the DNS records:

    • print-server-hostname could be the hostname of your Mobility Print server, or it can literally just be an A record "print-server-hostname" so long as it points towards the IP address of the server running the Mobility Print software.
    • b._dns-sd._udp.domain.tld would not be the correct record. I'm not a BIND expert, so I can't really explain how this works that well. I just know firsthand that the PTR record should be b._dns-sd._udp and the client should supply the DNS search suffix.

    I definitely agree that the records are not typical. It's not something we invented, but we're just leveraging the way that Apple devices natively discover services on the network. It definitely is a bit unusual.

    Let me know if that makes a bit more sense.


  • LAYER 8 Global Moderator

    @papercutsupportdude said in Add PTR and NS Records to DNS Resolver possible?:

    b._dns-sd._udp.domain.tld would not be the correct record

    yes it would be.. If the clients search suffix is domain.tld... The client is not going to do a search for just b._dns-sd._udp

    b._dns-sd._udp IN PTR @ ; b = browse domain
    lb._dns-sd._udp IN PTR @ ; lb = legacy browse domain

    Its going to do do a search for that with its default domain suffix.

    This is what it says here
    http://www.dns-sd.org/serverstaticsetup.html

    How it Works

    Now that you’ve created your DNS records, the process works like this:

    When a client gets an address from your DHCP server, your DHCP server also includes information specifying a default DNS domain. In this example, we’ll assume that’s “example.com.”

    The client needs to determine whether you’d like it to use Wide-Area DNS-SD to browse for services. It does this by prepending the text “lb._dns-sd._udp” to the default DNS domain, and then doing a query for PTR records with that name (in this case “lb._dns-sd._udp.example.com.”).

    In our example the client’s query gets an answer: “example.com.” In principle the PTR record could indicate some other domain to browse instead, but in the common case a self-referential PTR referring back to the same domain is usually easiest.

    The client now knows it’s supposed to browse for services in “example.com.” Any time an application like the Safari web browser calls one of the DNS-SD browsing APIs to browse for services, without explicitly specifying a particular DNS domain to browse, the mdnsd daemon will automatically browse the default browse domain it learned from the network.

    Simple enough to sniff and see what a client does a query for..

    From your own sites instructions
    0_1532369121874_commands.png

    What do you think that command is doing... Its creating a PTR for the FQDN b._dns-sd._udp.papercutsoftware.com


  • LAYER 8 Global Moderator

    Well what do you know ;) It can find the printer with just a few records..

    0_1532401679078_unbound-airprint.png

    The plex.direct is not part of it.. But the other records are.. So it finds the printer and lists it. But when I try and print to it says offline. I opened all ports to the printer IP.. But I don't see the ipad actually trying to send any printer traffic. It looks to be trying to do some sort NAT-PMP.. Its asking pfsense to nat some ports, asks for its external IP, etc.

    But pretty sure that is NOT related..

    Gawd Damit ;) Going to have to read the freaking RFC I take it... This is a billion times more than I ever wanted to know about stupid ass airprint ;)

    Simple enough to create the records in unbound that is for sure.. As you see above.. You can get the info for the SRV and TXT records with avahi-browse.. So it finds printers, and yeah I was right about the domain.tld having to be there - that is what it queries for.. See here

    0_1532404034161_dnsqueries.png

    I knew I had the simple solution when I just put my printer on the L2 my wireless vlan that I would want to airprint from ;)