# Allow different DNS for each group

**URL:** https://discourse.pi-hole.net/t/allow-different-dns-for-each-group/32258
**Category:** Feature Requests
**Created:** [May 13, 2020, 8:50am UTC](https://discourse.pi-hole.net/t/allow-different-dns-for-each-group/32258 "2020-05-13T08:50:14Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![tmysik](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/tmysik/32/15251_2.png) [@tmysik](https://discourse.pi-hole.net/u/tmysik)
#### Post date: [May 13, 2020, 8:50am UTC](https://discourse.pi-hole.net/t/allow-different-dns-for-each-group/32258/1 "2020-05-13T08:50:14Z")

</div>

In Pi-hole 5, we have groups now. It would be great if one could specify different DNS servers for each group (typically, [`1.1.1.3` for kids](https://blog.cloudflare.com/introducing-1-1-1-1-for-families/)).

Thank you.

---

<div class="post-metadata">

### Author: ![BassTeQ](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/bassteq/32/11163_2.png) [@BassTeQ](https://discourse.pi-hole.net/u/BassTeQ)
#### Post date: [July 6, 2020, 6:45am UTC](https://discourse.pi-hole.net/t/allow-different-dns-for-each-group/32258/2 "2020-07-06T06:45:38Z")

</div>

I'm looking for this exact feature! Would save me having to run multiple piHoles only for the purpose of selecting upstream DNS!

---

<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: [July 6, 2020, 6:51am UTC](https://discourse.pi-hole.net/t/allow-different-dns-for-each-group/32258/3 "2020-07-06T06:51:36Z")

</div>

What is the benefit of being able to use different upstream servers per client? I'm just asking this as it would be a massive work to get this implemented so it should be well-justified.

---

<div class="post-metadata">

### Author: ![BassTeQ](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/bassteq/32/11163_2.png) [@BassTeQ](https://discourse.pi-hole.net/u/BassTeQ)
#### Post date: [July 6, 2020, 7:30am UTC](https://discourse.pi-hole.net/t/allow-different-dns-for-each-group/32258/4 "2020-07-06T07:30:08Z")

</div>

For my purpose I have kids on a separate VLAN, I use OpenDNS for their vlan, and google for other VLANS.

192.168.100.X = 8.8.8.8  
10.0.40.X = OpenDNS  
10.0.30.X = 8.8.8.8

As per the original post, it should be configured by "group"

Group A = 192.168.100.0/24 = 8.8.8.8 (default)  
Group B = 10.0.40.0/24/24 = OpenDNS  
Group C = 10.0.30.0/24 = 8.8.8.8 (default)

---

<div class="post-metadata">

### Author: ![Crispin](https://discourse-cdn.pi-hole.net/letter_avatar_proxy/v4/letter/c/bc8723/32.png) [@Crispin](https://discourse.pi-hole.net/u/Crispin)
#### Post date: [June 18, 2021, 6:32pm UTC](https://discourse.pi-hole.net/t/allow-different-dns-for-each-group/32258/5 "2021-06-18T18:32:19Z")

</div>

This would be a great addition. At the moment I work around it by having 3 PIs running 🙂

My use-case is

- I want my kids, known devices via static DHCP (pfSense) assignment, to be on 1.1.1.3
- I want my personal and wife's devices on 1.1.1.2
- I want my research devices on 1.1.1.1

I think Groups is a brilliant addition and now needs one more extension in functionality.

Thanks

---

<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: [June 19, 2021, 8:42am UTC](https://discourse.pi-hole.net/t/allow-different-dns-for-each-group/32258/6 "2021-06-19T08:42:12Z")

</div>

I just want to clarify that this not being available has nothing to do with us not wanting this feature but rather the amount of work (and testing) required here.

We wrap tightly around the embedded DNS server `dnsmasq`. Client-individual behavior is something we added on top by being able to short-circuit some queries (the blocked ones). All other (non-blocked) queries are just sent back and are _all_ handled as they would be without any Pi-hole intervention.

Concerning which DNS server to use, `dnsmasq` picks the "best" DNS server (in case you configured more than one) by infrequently sending some queries to all configured DNS servers and then favoring the one that replied fastest.

We could maybe overwrite this favorite server for specific queries but this is just an early idea and I'm not sure yet if there would be any drawbacks.

Another open question is: How could this be added to the existing group management interface? If we add a new page where you can add servers to groups, how would we handle if clients belong to multiple groups and/or multiple DNS servers are selected for one and the same group? I wouldn't want to implement a second level performance-measurement strategy (we cannot reuse the existing one) to determine the "best" DNS server for any individual client. This would slow down Pi-hole quite drastically and cause a lot of traffic.

My current best guess it that in case of such an unclear configuration would be to pick _any_ of the configured ones without investing any effort into which one to pick (it'll likely be the first one in the database) and just issuing a warning on the dashboard that the configuration leads to unintentional behavior.

---

<div class="post-metadata">

### Author: ![Tntdruid](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/tntdruid/32/773_2.png) [@Tntdruid](https://discourse.pi-hole.net/u/Tntdruid)
#### Post date: [June 19, 2021, 4:25pm UTC](https://discourse.pi-hole.net/t/allow-different-dns-for-each-group/32258/7 "2021-06-19T16:25:18Z")

</div>

use tags for that:

dhcp-option=net:groupa,option:dns-server,8.8.8.8  
dhcp-option=net:groupb,option:dns-server,OpenDNS  
dhcp-option=net:groupc,option:dns-server,8.8.8.8

dhcp-host=xx:xx:xx:xx:xx:xx,set:groupa,SomeUser

dhcp-host=xx:xx:xx:xx:xx:xx,set:groupb,SomeUser

dhcp-host=xx:xx:xx:xx:xx:xx,set:groupc,SomeUser

---

<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: [June 19, 2021, 5:53pm UTC](https://discourse.pi-hole.net/t/allow-different-dns-for-each-group/32258/8 "2021-06-19T17:53:14Z")

</div>

This may not be what this feature request is requesting, but we should clarify it:  
What @Tntdruid suggests is Pi-hole acting as DHCP server telling some clients to use a specific DNS server _instead_ of the Pi-hole. I understood this feature request rather as every client should still use the Pi-hole but then we should ask different upstream servers on behave of the clients.

But this nicely highlights one additional problem: Cache. Assume a parents device asked for `baddomain.com` and received the correct answer. This answer will then be added to the DNS cache and when the kid's device asks for the same domain, it will immediately get the cached answer instead of forwarding it answer another time. This is because dnsmasq's cache is entirely unaware of what the source of the query was (why should it). Such a configuration could only work if you disable caching at all. This is clearly a showstopper for this feature.

---

<div class="post-metadata">

### Author: ![Mark\_Carnahan](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/mark_carnahan/32/27880_2.png) [@Mark\_Carnahan](https://discourse.pi-hole.net/u/Mark_Carnahan)
#### Post date: [October 23, 2021, 1:08pm UTC](https://discourse.pi-hole.net/t/allow-different-dns-for-each-group/32258/12 "2021-10-23T13:08:53Z")

</div>

Another use case for this is media streaming devices like roku and fire tv. I use cleanbrowsing.org as my upstream DNS and I routinely have to go through the query log and whitelist streaming sites as they change over time. It would be so much easier to allow my media streamers to use 1.1.1.1. I would statically set the DNS servers on my media streamers, but most of them don't allow it.

---

<div class="post-metadata">

### Author: ![jfb](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/jfb/32/4332_2.png) [@jfb](https://discourse.pi-hole.net/u/jfb)
#### Post date: [October 23, 2021, 2:02pm UTC](https://discourse.pi-hole.net/t/allow-different-dns-for-each-group/32258/13 "2021-10-23T14:02:25Z")

</div>

> [@Mark\_Carnahan](#):
>
> It would be so much easier to allow my media streamers to use 1.1.1.1

If you use Pi-hole as the DHCP server, this can be done with a dnsmasq configuration.

> <https://github.com/deathbybandaid/piadvanced/blob/7e227f0651fee56f4253c2d23fc1f9194a36ff31/piholetweaks/dnsmasqtweaks/04-bypass.conf>

---

<div class="post-metadata">

### Author: ![bc3tech](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/bc3tech/32/30431_2.png) [@bc3tech](https://discourse.pi-hole.net/u/bc3tech)
#### Post date: [March 13, 2025, 2:52pm UTC](https://discourse.pi-hole.net/t/allow-different-dns-for-each-group/32258/16 "2025-03-13T14:52:56Z")

</div>

I'll drop another use case here: parental feature.

I use `1.1.1.3` (cloudflare's family DNS) but would like to use `1.1.1.1` for some device instead.
