# How to set TTL for Local DNS records?

**URL:** <https://discourse.pi-hole.net/t/how-to-set-ttl-for-local-dns-records/80177>\
**Category:** Help\
**Created:** [May 30, 2025, 9:00am UTC](https://discourse.pi-hole.net/t/how-to-set-ttl-for-local-dns-records/80177 "2025-05-30T09:00:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ChrisJ](https://discourse-cdn.pi-hole.net/letter_avatar_proxy/v4/letter/c/f475e1/32.png) [@ChrisJ](https://discourse.pi-hole.net/u/ChrisJ)\
**Post date:** [May 30, 2025, 9:00am UTC](https://discourse.pi-hole.net/t/how-to-set-ttl-for-local-dns-records/80177/1 "2025-05-30T09:00:33Z")

</div>

I like the dns.hosts feature in v6, however it seems to have an issue. Records added using this feature always get served with TTL=0 and I cannot find any way to change this. The setting for local-ttl in DNSmasq settings doesn't seem to be applied to these records. A default of 0 seems like very bad idea so maybe it could be changed and a GUI option provided to configure an explicit value?

---

<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, 10:01am UTC](https://discourse.pi-hole.net/t/how-to-set-ttl-for-local-dns-records/80177/2 "2025-05-30T10:01:24Z")

</div>

You can add a custom dnsmasq config line, e.g. to set a local TTL of 60 seconds:

```auto
sudo pihole-FTL --config misc.dnsmasq_lines '["local-ttl=60"]'

```

In case you'd run Pi-hole as a Docker container, you may set its **`FTLCONF_misc_dnsmasq_lines`** environment variable.

That option is also accessible via _[All settings](http://pihole-5:8086/admin/settings/all) » Miscellaneous_ as **`misc.dnsmasq_lines`**.

If instead you want to keep a bunch of configuration lines in your own custom file under `/etc/dnsmasq.d/`, you could alternatively enable **`misc.etc_dnsmasq_d`**.

_All settings_ is available in _Expert_ mode only.

---

<div class="post-metadata">

**Author:** ![ChrisJ](https://discourse-cdn.pi-hole.net/letter_avatar_proxy/v4/letter/c/f475e1/32.png) [@ChrisJ](https://discourse.pi-hole.net/u/ChrisJ)\
**Post date:** [May 31, 2025, 7:15am UTC](https://discourse.pi-hole.net/t/how-to-set-ttl-for-local-dns-records/80177/3 "2025-05-31T07:15:39Z")

</div>

Thanks, this solved it for me. I hadn't noticed that inclusion of files in dnsmasq.d is no longer enabled by default since (I think) 6.0.

---

<div class="post-metadata">

**Author:** ![system](https://discourse.pi-hole.net/uploads/default/original/3X/7/c/7c8792f649eeb921c5d2b4c41564ffa873d9a2b8.png) [@system](https://discourse.pi-hole.net/u/system)\
**Post date:** [June 21, 2025, 7:15am UTC](https://discourse.pi-hole.net/t/how-to-set-ttl-for-local-dns-records/80177/4 "2025-06-21T07:15:43Z")

</div>

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.
