# Proper way to do domain name & hostnames

**URL:** <https://discourse.pi-hole.net/t/proper-way-to-do-domain-name-hostnames/53467>\
**Category:** Help\
**Created:** [February 10, 2022, 7:58am UTC](https://discourse.pi-hole.net/t/proper-way-to-do-domain-name-hostnames/53467 "2022-02-10T07:58:57Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Bucking\_Horn](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/bucking_horn/32/18719_2.png) [@Bucking\_Horn](https://discourse.pi-hole.net/u/Bucking_Horn)\
**Post date:** [February 10, 2022, 6:53pm UTC](https://discourse.pi-hole.net/t/proper-way-to-do-domain-name-hostnames/53467/2 "2022-02-10T18:53:49Z")

</div>

[_`dnsmasq`_'s **`expand-hosts`**](http://www.thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html) 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:

```auto
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.

---

_[View the full topic](https://discourse.pi-hole.net/t/proper-way-to-do-domain-name-hostnames/53467)._
