dnsmasq
's expand-hosts
option could help here, but there is no obvious wrong or right answer to your question.
Each of printer
and printer.home.lan
constitute a domain, even if the latter could be derived by attaching the local search domain to a plain hostname.
Consequently, to be able to automatically associate the same A/AAAA records with two domains, Pi-hole has to be aware of your local domain.
That is usually only the case if you operate Pi-hole as your DHCP server.
In that case, Pi-hole can also add expand-hosts
option to its configuration if you'd tick Never forward non-FQDNs as well.
If Pi-hole isn't your DHCP server, you may add a custom configuration file, e.g. 42-local-network-awareness.conf
, with the following contents:
expand-hosts
domain=fritz.box
But you should be aware that expand-hosts
does not cover all types of DNS record, e.g. CNAMEs would still need explicit dual definitions (if required). In addition, you should note that resolution for DHCP-client supplied hostnames only works as long as the client is active.
Also note that creating local DNS records would give you local name resolution independent from other sources like your DHCP server, which may be an advantage, e.g. if you are forced to swap to use a router model that doesn't register DHCP provided names into its integrated local DNS server.
So while you certainly could spare yourself from a bit of typing, creating dedicated DNS records may give you greater flexibility and persistence.
Hence, it would depend on your specific network requirements as well as your personal preferences which mix of measures would work best for you.