# DNS server priority, fallback for pihole

**URL:** <https://forum.openwrt.org/t/dns-server-priority-fallback-for-pihole/178802>\
**Category:** Network and Wireless Configuration\
**Created:** [November 26, 2023, 8:22pm UTC](https://forum.openwrt.org/t/dns-server-priority-fallback-for-pihole/178802 "2023-11-26T20:22:09Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![wait\_what](https://forum.openwrt.org/letter_avatar/wait_what/32/5_5575768a8748004e209b776fc1b2916d.png) [@wait\_what](https://forum.openwrt.org/u/wait_what)\
**Post date:** [November 26, 2023, 8:22pm UTC](https://forum.openwrt.org/t/dns-server-priority-fallback-for-pihole/178802/1 "2023-11-26T20:22:10Z")

</div>

Hello.

I am able to configure multiple DNS servers under "DHCP and DNS \> DNS forwardings". I have a DNS server running on LAN (pihole), and if I configure it as the only DNS server, everything works as expected.

I would also like to specify a fallback DNS server, such as 1.1.1.1, however, if I specify 2 DNS servers, it seems to be chosen at random, and not in the order that they are specified in.

Is there a way to set priority?

---

<div class="post-metadata">

**Author:** ![frollic](https://forum.openwrt.org/user_avatar/forum.openwrt.org/frollic/32/30113_2.png) [@frollic](https://forum.openwrt.org/u/frollic)\
**Post date:** [November 26, 2023, 8:43pm UTC](https://forum.openwrt.org/t/dns-server-priority-fallback-for-pihole/178802/2 "2023-11-26T20:43:29Z")

</div>

> [@wait\_what](#):
>
> Is there a way to set priority?

no, it's a client decision.

most clients will use the 1st DNS IP as long as it works.  
if you shut it down, it'll keep using the 2nd for a while, even if you bring up the 1st again.

---

<div class="post-metadata">

**Author:** ![wait\_what](https://forum.openwrt.org/letter_avatar/wait_what/32/5_5575768a8748004e209b776fc1b2916d.png) [@wait\_what](https://forum.openwrt.org/u/wait_what)\
**Post date:** [November 26, 2023, 8:47pm UTC](https://forum.openwrt.org/t/dns-server-priority-fallback-for-pihole/178802/3 "2023-11-26T20:47:30Z")

</div>

I was under the impression that when I specify a DNS server under "DNS forwardings" (not "Interfaces \> LAN \> Advanced \> Use custom DNS servers"), it's resolved on the router, rather than advertised to the clients.

---

<div class="post-metadata">

**Author:** ![krazeh](https://forum.openwrt.org/user_avatar/forum.openwrt.org/krazeh/32/21639_2.png) [@krazeh](https://forum.openwrt.org/u/krazeh)\
**Post date:** [November 26, 2023, 8:52pm UTC](https://forum.openwrt.org/t/dns-server-priority-fallback-for-pihole/178802/4 "2023-11-26T20:52:36Z")

</div>

Under DHCP and DNS \> Advanced settings, tick 'Strict Order'.

---

<div class="post-metadata">

**Author:** ![frollic](https://forum.openwrt.org/user_avatar/forum.openwrt.org/frollic/32/30113_2.png) [@frollic](https://forum.openwrt.org/u/frollic)\
**Post date:** [November 26, 2023, 9:09pm UTC](https://forum.openwrt.org/t/dns-server-priority-fallback-for-pihole/178802/5 "2023-11-26T21:09:01Z")

</div>

yeah, sorry.

misunderstood the question, though you meant the IPs were given to the clients, by DHCP.

my bad.

---

<div class="post-metadata">

**Author:** ![wait\_what](https://forum.openwrt.org/letter_avatar/wait_what/32/5_5575768a8748004e209b776fc1b2916d.png) [@wait\_what](https://forum.openwrt.org/u/wait_what)\
**Post date:** [November 26, 2023, 9:17pm UTC](https://forum.openwrt.org/t/dns-server-priority-fallback-for-pihole/178802/6 "2023-11-26T21:17:28Z")

</div>

Thank you, no idea how I missed that option. And it works.

As a related side question. When I specify `options timeout:2` and `attempts:1` in `resolv.conf`, it seems to have no effect, DNS queries still take around 10 seconds when the "main" server is down.

Is there a way to make it to give up on trying to reach the "main" server more quickly?

---

<div class="post-metadata">

**Author:** ![slh](https://forum.openwrt.org/user_avatar/forum.openwrt.org/slh/32/113591_2.png) [@slh](https://forum.openwrt.org/u/slh)\
**Post date:** [November 27, 2023, 1:02am UTC](https://forum.openwrt.org/t/dns-server-priority-fallback-for-pihole/178802/7 "2023-11-27T01:02:23Z")

</div>

Using an unfiltered DNS server as fallback pretty much defeats the purpose, especially as you never know how the clients deal with it. There are two good options for this, either configuring only the primary DNS server and making sure that it (pihole) never goes down - or setting up a parallel pihole on different hardware. In a home environment, using a single DNS server only is usually good enough.

---

<div class="post-metadata">

**Author:** ![system](https://forum.openwrt.org/uploads/default/original/3X/7/4/740520c71f00039bbf001045c682f0ecb25e905a.png) [@system](https://forum.openwrt.org/u/system)\
**Post date:** [December 7, 2023, 1:04am UTC](https://forum.openwrt.org/t/dns-server-priority-fallback-for-pihole/178802/8 "2023-12-07T01:04:44Z")

</div>

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