Groups and Clients
Scope: different rules for different devices — the group machinery, how a client is recognised, and the lab's Bedtime group, where one name was refused for exactly one client and then, on the same evidence, not refused. This chapter's central claim was proven both directions.
The problem with one rule for everyone
A single blocklist for the whole house fits most houses. Then someone wants the game server reachable from the children's tablets only after homework hours, or the work laptop exempt from a rule that keeps breaking its VPN, or the TV — which phones home twelve times an hour — watched more strictly than everything else. Pi-hole's answer is groups: lists belong to groups, devices belong to groups, and a device is governed by the lists of every group it sits in. Everybody starts in the group Pi-hole calls Default (id 0), and a device in no group you've defined is treated as Default — the machinery is invisible until you use it.
The vocabulary, precisely
- A client is a device Pi-hole can recognise — most often by its IP address; a full install can also key on the device's MAC address or a whole subnet.
- A group is a named bucket (
Bedtime, in the lab). - Membership is many-to-many both ways: a list can serve several groups, and a client can sit in several groups at once, gathering all their rules.
The lab's proof
The lab created a second group through the API (the web interface's Group management pages drive the same calls), then wrote one rule into it and only it:
POST /api/groups {"name":"Bedtime", ...} -> id 1
POST /api/domains/deny/exact {"domain":"games.specimen.test",
"groups":[1]} -> Bedtime only
POST /api/clients {"client":"127.0.0.1",
"groups":[0,1]} -> the bench joins both
The bench — the lab computer itself, client
127.0.0.1 — sat in Default and Bedtime.
The name games.specimen.test was on no
blocklist and in no Default rule. Asked
from inside the group:
$ dig @127.0.0.1 -p 8053 games.specimen.test A +tcp
; EDE: 15 (Blocked): (denylist)
games.specimen.test. 2 IN A 0.0.0.0
Then the bench was removed from Bedtime —
same machine, same name, same engine, one
membership changed — and the refusal went
away. (The full transcript is t04. One
trap this test sets for the impatient is
real, and the lab fell into it on an
earlier attempt — examples/lab-notes.txt
has the story: a blocked answer sits in
the cache for its two-second lifetime, so
a retest a heartbeat after removing a
rule can still show the refusal. Wait,
then ask again.) The query log certified
the pair with its status words:
videos.specimen.test -> DENYLIST (reply: IP) [in the group]
videos.specimen.test -> CACHE (reply: NXDOMAIN) [out of the group]
The second line's NXDOMAIN is the sandbox
talking (FTL answers for the reserved
.test suffix itself rather than forwarding
it); on a real network the out-of-group
answer is simply the name's real address,
fetched upstream as usual. What the pair
proves is the part that's Pi-hole's: the
rule followed the group, because nothing
else changed.
Running groups without confusing yourself
- Name groups by household meaning, not
by technology.
Bedtime,Work,Guests,TVs— you'll remember what you meant;Group2you won't. - Default is a real group. Lists you add with no thought land there and apply to everyone, including devices you add groups for later — a client in Bedtime and Default (the normal arrangement) obeys both.
- Recognition is the weak point. A client keyed by IP address stops being recognised if its address changes — one more argument for the fixed addresses and DHCP reservations of chapter 2 and 7. Modern phones also randomise their MAC addresses per network, which can quietly move a phone out of the client you defined for it; the query log (next chapter) is where you'd notice.
- Groups are not schedules. The lab's group is called Bedtime because that's the use everyone imagines, but nothing in the machinery knows what time it is — membership is changed by hand or by API, not by the clock. (People do script the API call from a scheduler; that is a household invention, not a Pi-hole feature, and it's honestly labelled as such when you meet it in the wild.)
Check: one name, one bench, two answers — the difference was a list in the client's group. If you can say why the Default group's lists still applied while the bench was in Bedtime (membership is additive), you have the whole model. Chapter 6 opens the log that lets you watch all of this.