Add PTR and NS Records to DNS Resolver possible?
-
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.
-
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.
-
johnpoz LAYER 8 Global Moderatorlast edited by johnpoz Jul 21, 2018, 12:35 PM Jul 21, 2018, 12:34 PM
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..
-
@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?
-
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.
-
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.XXXIt'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/
-
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._udpwould actually be
b._dns-sd._udp.domain.tld
lb._dns-sd._udp.domain.tldThis 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"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.
-
@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 domainIts 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.htmlHow 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
What do you think that command is doing... Its creating a PTR for the FQDN b._dns-sd._udp.papercutsoftware.com
-
Well what do you know ;) It can find the printer with just a few records..
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
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 ;)
-
@johnpoz Isn’t the syntax for the TXT record in Unbound as described in this article
I’m not an expert and maybe i’m wrong but i just wanted to give my two cents after an entire aftertnoon spent searching for a solution (i’m on the way home so i’ll try your code later but i’m optimistic).Thank you anyway.
-
I don't think it had a problem with my TXT settings... Might have to do a single ' outside the double '' - maybe.. I don't know I didn't care enough to dive any deeper into to be honest.
Just run your freaking airprint server on the same L2 you need to use it ;) Or use a simple printer server that supports airprint would be my solution..
But sure if you can get it to work because I did some typo or something - sure please post to help the next guy.
-
I've read the whole article and am quite confused. Has anyone succeeded in setting up the DNS?
I've installed BIND9 on Windows 7,
forward.bind
$TTL 3h @ IN SOA example.local. root.example.local. ( 1 ; Serial 3h ; Refresh 1h ; Retry 1w ; Expire 1h ) ; Negative Cache TTL 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 print-server IN A 192.168.10.4 ; Mobility Print server ; @ IN NS example.local. example.local. IN A 192.168.10.252 ; DNS SERVER
named.conf
options { directory "C:\Program Files\ISC BIND 9\etc"; listen-on { 192.168.10.252; 127.0.0.1; }; forwarders { 8.8.8.8; 8.8.4.4; }; dnssec-enable yes; dnssec-validation yes; dnssec-must-be-secure pc-printer-discovery no; }; logging { channel my_log { file "named.log" versions 3 size 1m; severity debug; print-severity yes; }; category default { my_log; }; }; zone "10.168.192.in-addr.arpa" { type master; file "C:\Program Files\ISC BIND 9\etc\reverse.10.168.192.bind"; notify no; }; zone "20.168.192.in-addr.arpa" { type master; file "C:\Program Files\ISC BIND 9\etc\reverse.20.168.192.bind"; notify no; }; zone "example.local" { type master; file "C:\Program Files\ISC BIND 9\etc\forward.bind"; }; zone "pc-printer-discovery" { type forward; forward only; forwarders { 192.168.10.252; }; };
and two reverse files alike
$TTL 3h @ IN SOA example.local. root.example.local. ( 1 ; Serial 3h ; Refresh 1h ; Retry 1w ; Expire 1h ) ; Negative Cache TTL ; @ IN NS example.local. 4 IN PTR PRINT-SERVER. b._dns-sd._udp IN PTR 0.10.168.192.pc-printer-discovery. ; 0.20.168.192 lb._dns-sd._udp IN PTR 0.10.168.192.pc-printer-discovery. ; 0.20.168.192
On my DNS Server, I set DNS 192.168.10.252, 127.0.0.1; 8.8.8.8
I do see DNS suffix example.localI even went further and set DHCP option 119 on my router.
Disabled all firewalls.I don't get even one bloody green tick! What's the heck?
C:\Program Files\ISC BIND 9\bin>nslookup pc-printer-discovery.example.local Server: 192.168.10.252 Address: 192.168.10.252#53 ** server can't find pc-printer-discovery.example.local: NXDOMAIN
The last idea came to my mind is to separate Mobility Print Server and DNS Server - they are split apart and working on different PCs.
I get JSON when I request
http://print-server:9163/printers or
http://192.168.10.4:9163/printersThat's it.
My apologies for a silly question, I'm not an administrator and not quite close to be in the future, however could it happen with me because I use .local ?
And another question: Should a domain name for those records be the same as I use for ADDC ? I wish I knew it before I set up ADDC. We've got an external domain and today I would rather set up our inner domain as a subdomain of the external one.Any help would appreciated! Thank you in advanced!
-
Been a while since I looked at this - and that was trying to get it to work with unbound and not bind.. They have a template you should just be able to load up in bind from that mobility print stuff.
There was a guy from mobility print that was suppose to get back to me, he never did.
I guess I could give this another go with bind.. But to be honest there shit is pretty broken if you ask me.. Creating records that resolve are not a problem, its how their shit software works from what I recall.
But you calling up an IP or host name, print-server not even fully qualified so you didn't get that from dns even a port via http has really little to do with airprint and dns across L2s.
If you have dns running on something other than pfsense, then this has nothing to with pfsense at all, even if using on it bind or unbound. Not really pfsense questions - but how to use a software package bind or unbound that is just running on pfsense.. which could be running on anything at all.
I would suggest you get with them on support on getting it to work with your bind server... Then once you have a working zone file.. More than happy to help you get that zone file on the bind package in pfsense, or get it working in unbound. Unbound is more than capable of serving up any sort of record you want to serve up.
-
I've been chatting to Papercut's support for a month I think.... I've thrown my Asus AC68U to bin and bought Mikrotik RB4011iGS+5HacQ2HnD-IN to get more flexibility in settings.
I created DNS records on my QNAP (used as ADDC), then I installed BIND on Docker, then I took all things home, installed BIND9 on Windows 7 and playing with everything all day long.
Mikrotik isn't a home router though I googled a lot and learnt how to set up a basic configuration.
This thing just drives me mad.... since I don't know how, what, and why?
-
A month?? heheheh Yeah it should be tops a few minute conversation - to be honest I don't think they know how to make it work either ;)
If I am recalling correctly their software wasn't even doing the proper queries anyway.. If I get bored latter I might fire this up again.. in general dns-sd is not all that complex... But I don't think their software works how they think it does to be honest..
It should do a PTR query, which I never saw it actually do.. If I am recalling this correctly.. This was back couple years now..
-
Sorry for bringing back a 4 year old thread, but I think I got this working for me in OPNSense using Unbound and I wanted to update the thread with a solution in case anyone else is looking. This is the only useful result that comes up when searching for making Mobility Print work with Unbound.
This hint about using
typetransparent
seems to make it work without doing anything else special. I set that through the GUI in OPNSense but I believe the relevant config line it results in is:local-zone: "mydomain" typetransparent
I think these are the other relevant parts of the config files - in OPNSense I created a custom config file to add the entries as they removed the "advanced" box on the current release. (the OPNSense config file has a
include: /var/unbound/etc/*.conf
where custom entries go)root@OPNsense:/var/unbound/etc # cat mobilityprint.conf server: local-data: "b._dns-sd._udp.mydomain IN PTR pc-printer-discovery.mydomain" local-data: "lb._dns-sd._udp.mydomain IN PTR pc-printer-discovery.mydomain" local-data: "pc-printer-discovery.mydomain IN NS lxc-print.mydomain"
I didn't add the A record here, since I have a static DHCP lease for my Mobility Print server called lxc-print, but that record is just:
local-data: "lxc-print.mydomain IN A 10.10.5.17"
Everything passes in the Mobility Print DNS setup page and I get the correct results from nslookup:
lvm-debian-1:~> nslookup -query=ptr b._dns-sd._udp.mydomain Server: 10.10.0.2 Address: 10.10.0.2#53 b._dns-sd._udp.mydomain name = pc-printer-discovery.mydomain. lvm-debian-1:~> nslookup -query=ptr lb._dns-sd._udp.mydomain Server: 10.10.0.2 Address: 10.10.0.2#53 lb._dns-sd._udp.mydomain name = pc-printer-discovery.mydomain. lvm-debian-1:~> nslookup -query=ns pc-printer-discovery.mydomain Server: 10.10.0.2 Address: 10.10.0.2#53 pc-printer-discovery.mydomain nameserver = lxc-print.mydomain. lvm-debian-1:~> nslookup lxc-print.mydomain Server: 10.10.0.2 Address: 10.10.0.2#53 Non-authoritative answer: Name: lxc-print.mydomain Address: 10.10.5.17