# Local DNS records

**URL:** <https://discourse.pi-hole.net/t/local-dns-records/74898>\
**Category:** Beta 6.0\
**Created:** [January 2, 2025, 3:11pm UTC](https://discourse.pi-hole.net/t/local-dns-records/74898 "2025-01-02T15:11:30Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mirkok](https://discourse-cdn.pi-hole.net/letter_avatar_proxy/v4/letter/m/5f8ce5/32.png) [@mirkok](https://discourse.pi-hole.net/u/mirkok)\
**Post date:** [January 2, 2025, 3:11pm UTC](https://discourse.pi-hole.net/t/local-dns-records/74898/1 "2025-01-02T15:11:30Z")

</div>

FTL 6.x offers 2 ways to add local DNS records:

- dns.hostRecord - this currently is a string, which allows only for a single host record entry to be added (dnsmasq allows an arbitrary number). Ok, one can use the user defined dnsmasq settings to add more, but if this is really considered as a viable way going forward, this needs to be made into a list and put into the web gui.
- dns.hosts - a very basic IP to name mapping, writing to /etc/pihole/hosts/custom.list and pulling these in via hostsdir config setting.

What I like about the host record entries is that they're concise: Everything you need to know in one line, all names, both IPv4 and IPv6 as well as an optional TTL.

What I like about the hostsdir approach is its flexibility. One can add other files in the same directory that one, for whichever reason, doesn't want FTL to manage directly, and the built-in dnsmasq monitors and applies changes automagically.

What I don't like here is that the current implementation does not provide a good user experience. Only basic 1:1 mappings are supported, so it lacks the "all at one glance" that hosts records provide and maintaining multiple names for both IPv4 and IPv6 is simply a pain.

So can this be pimped that a little bit? What I'd like to have in the web gui:

- A list box to be able to see/define any number of names.
- An IPv4 address box.
- An IPv6 address box.

That way it'd be equally usable as the host records. These could be dumped then from the general config from my point of view: Both are providing 90% the same functionality and if someone really needs the special additional features from host records, these can be added in the user specific section.

---

<div class="post-metadata">

**Author:** ![DL6ER](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/dl6er/32/281_2.png) [@DL6ER](https://discourse.pi-hole.net/u/DL6ER)\
**Post date:** [January 3, 2025, 9:56am UTC](https://discourse.pi-hole.net/t/local-dns-records/74898/2 "2025-01-03T09:56:02Z")

</div>

The reason why `dns.hostRecord` exists in exactly this form is simply that it was there pre-v6 and we simply maintain this setting for users. However, `dns.hosts` does allow multiple names, is this what you are asking for?, e.g.

```auto
127.0.0.1 a b c

```

would be possible to define said IP for all three host names. I don't feel easy deviating from the very well-known HOSTS format allowing multiple address types in the same line (like IPv4 + IPv6) but multiple host names for the same address should already be possible. If not, this is a bug and we can fix it.

---

<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:** [January 3, 2025, 10:23am UTC](https://discourse.pi-hole.net/t/local-dns-records/74898/3 "2025-01-03T10:23:01Z")

</div>

> [@mirkok](#):
>
> So can this be pimped that a little bit? What I'd like to have in the web gui:
> 
> - A list box to be able to see/define any number of names.

Did you take a look at v6's [Settings | Local DNS records](http://pi.hole/admin/settings/dnsrecords) ?

---

<div class="post-metadata">

**Author:** ![mirkok](https://discourse-cdn.pi-hole.net/letter_avatar_proxy/v4/letter/m/5f8ce5/32.png) [@mirkok](https://discourse.pi-hole.net/u/mirkok)\
**Post date:** [January 3, 2025, 1:38pm UTC](https://discourse.pi-hole.net/t/local-dns-records/74898/4 "2025-01-03T13:38:05Z")

</div>

It's not an ask to move away from HOSTS format. It's a matter of UX: How is the information presented to an end user? In my surroundings users are mostly people who are somewhat ok with IT, but no geeks. The better the UX, the better the acceptance.

Let's say I need to have the following in custom.list:

```auto
1.2.3.4 some.long.name.for.a.machine yet.another.long.name third.name.for.this.machine
2::1 some.long.name.for.a.machine yet.another.long.name third.name.for.this.machine

```

Today with the single line entry field not all of these long names are visible, so it's not easy to verify at a glance before hitting the "+" button.

If the UI would look something like this, it'd be very easy to achieve (very closely related to what today is shown in the list of existing records is done, which uses exactly this broken down format):

```auto
Domain(s) IPv4
+--------------------------------------+ +------------------------------+
| some.long.name.for.a.machine | | 1.2.3.4 |
| yet.another.long.name | +------------------------------+
| third.name.for.this.machine | IPv6
| | +------------------------------+
| | | 2::1 |
+--------------------------------------+ +------------------------------+

```

This can be very easily converted into the proper HOSTS format (i.e. the above 2 lines in my example).

---

<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:** [January 3, 2025, 2:08pm UTC](https://discourse.pi-hole.net/t/local-dns-records/74898/5 "2025-01-03T14:08:07Z")

</div>

The current Local DNS records UI design also happens to be a user contributed feature.

As this seems easy for you, would you consider contributing a respective [web-related PR](https://github.com/pi-hole/web) with the necessary improvements of Pi-hole v6's [Settings | Local DNS records](http://pi.hole/admin/settings/dnsrecords) UI?  
That would be most welcome.

---

<div class="post-metadata">

**Author:** ![mirkok](https://discourse-cdn.pi-hole.net/letter_avatar_proxy/v4/letter/m/5f8ce5/32.png) [@mirkok](https://discourse.pi-hole.net/u/mirkok)\
**Post date:** [January 3, 2025, 7:09pm UTC](https://discourse.pi-hole.net/t/local-dns-records/74898/7 "2025-01-03T19:09:31Z")

</div>

I'm not much of a web developer 🤣 But let me see if I can work out some kind of PoC.

---

<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:** [May 30, 2025, 9:53am UTC](https://discourse.pi-hole.net/t/local-dns-records/74898/12 "2025-05-30T09:53:23Z")

</div>

A post was split to a new topic: [How to set TTL for Local DNS records?](https://discourse.pi-hole.net/t/how-to-set-ttl-for-local-dns-records/80177)
