The URL for my printer generated by hp-makeuri
looks like this:
hp:/net/Officejet_6500_E710n-z?ip=192.168.178.30
But the printer is on a dhcp enabled wifi network and so its IP-address does and could change. On the other hand my wifi router seems smart enough to have some sort of DNS:
$ ping hp-6500a
PING hp-6500a.fritz.box (192.168.178.30) 56(84) bytes of data.
64 bytes from hp-6500a.fritz.box (192.168.178.30): icmp_req=1 ttl=255 time=11.3 ms
I tried to use the hostname in the CUPS URL/DeviceUID but it failed, any suggestions if this is possible and the correct format?
I think you can make use of ZeroConf here to dynamically find your printer. The syntax is like:
There,
zc
stands for ZeroConf, the mDNS implemented by avahi. On setting that URI, you may see some multicast network traffic to query the printer as can be seen in the partial tcpdump below.DNS A records like
printer.anintranet.example
can be added to a dynamic zone by the DHCP server. The original domain name (anintranet.example
) is discarded -- possibly because it is in the "search" directive of/etc/resolv.conf
?-- and.local
is added as part of the mDNS query.