You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Applies changes recommended by `yamllint`.
Adds `FTLCONF_MAXDBDAYS` to the template with the existing default of
365 days, and adds words to the documentation explaining its use.
Adds `PIHOLE_DNS_` with the existing defaults of 8.8.8.8 and 8.8.4.4,
and adds words and screenshot to the documentation explaining its use.
Explains issue with Docker Desktop for macOS raised in #709 where all
client activity is logged against the default gateway on the internal
bridged network.
Tidies-up problematic code-fence language specs. Shortens some
subheadings so they fit on a single line in the Wiki TOC.
Fixes#709
Signed-off-by: Phill Kelley <[email protected]>
@@ -81,7 +81,7 @@ Each time the Pi-hole container is launched, it checks for the presence or absen
81
81
82
82
Some Pi-hole documentation on the web recommends using the following command to change Pi-hole's admin password:
83
83
84
-
```console
84
+
```console
85
85
$ docker exec pihole pihole -a -p «yourPasswordHere»
86
86
```
87
87
@@ -101,9 +101,56 @@ then "mySecondPassword" will become the admin password **until** the next time t
101
101
102
102
Given this behaviour, we recommend that you ignore the `pihole -a -p` command.
103
103
104
-
### Other variables { #otherVars }
104
+
### Logging { #loggingVar }
105
+
106
+
You can control the amount of information Pi-hole retains about your DNS queries using the "Privacy Settings" tab of the "Settings" group. The default is "Show & record everything".
107
+
108
+
If you choose any option except "Anonymous mode", then Pi-hole divides the logging store into two parts:
109
+
110
+
* Entries which are more recent than 24 hours; and
111
+
* Entries which are older than 24 hours.
112
+
113
+
In the "System" tab of the "Settings" group is a <kbd>Flush logs (last 24 hours)</kbd> button. Clicking that button erases all log entries which are more recent than 24 hours. The button does **not** erase entries which are older than 24 hours.
114
+
115
+
Retention of log entries older than 24 hours is controlled by the following environment variable:
116
+
117
+
``` yaml
118
+
- FTLCONF_MAXDBDAYS=365
119
+
```
120
+
121
+
The default (which applies if the variable is omitted) is to retain log entries for 365 days.
105
122
106
-
Most of Pi-hole's environment variables are self-explanatory but some can benefit from elaboration.
123
+
Depending on your DNS activity, the database where the log entries are stored can become quite large. Setting this variable to a shorter period will help you control the amount of storage Pi-hole consumes on disk and in your backups.
124
+
125
+
Tip:
126
+
127
+
* Adding this variable to an existing service definition, or changing the number of days to be less than the previous setting will **not** reduce the size of the logging database. Although Pi-hole will implement the change, the SQLite database where the logs are written retains the released storage for subsequent re-use. If you want to reclaim that space, run the following command:
The command should not need `sudo` because `pi` is the owner by default. There is no need to terminate Pi-hole before running this command (SQLite handles any contention).
134
+
135
+
### Recursive resolvers { #upstreamDNS }
136
+
137
+
You can control which public DNS servers are used by PiHole when it needs to refer queries to the Internet. You do this by enabling or disabling checkboxes in the "Upstream DNS Servers" panel of the "DNS" tab in the "Settings" group.
138
+
139
+
The default is to use the two Google IPv4 DNS servers which correspond with 8.8.8.8 and 8.8.4.4, respectively.
140
+
141
+
An alternative to toggling checkboxes in the Pi-hole GUI is to use an environment variable:
142
+
143
+
``` yaml
144
+
- PIHOLE_DNS_=8.8.8.8;8.8.4.4
145
+
```
146
+
147
+
> The variable *does* end with an underscore!
148
+
149
+
This variable takes a semi-colon-separated list of DNS servers. You can discover the IP address associated with a checkbox by hovering your mouse pointer over the checkbox and waiting for a tool-tip to appear:
150
+
151
+

152
+
153
+
### Advanced variables { #advancedVars }
107
154
108
155
??? info "(advanced) reverse DNS query handling"
109
156
@@ -221,13 +268,13 @@ devices, provided they too have static IPs.
221
268
be reserved for mDNS use only.
222
269
{ #homeArpa }
223
270
224
-
## Configure the Raspberry Pi to use Pi-hole { #rpiDNS }
271
+
## Configure your Pi to use Pi-hole { #rpiDNS }
225
272
226
273
The Raspberry Pi itself does **not** have to use the Pi-hole container for its own DNS services. Some chicken-and-egg situations can exist if, for example, the Pi-hole container is down when another process (eg `apt` or `docker-compose`) needs to do something that depends on DNS services being available.
227
274
228
275
Nevertheless, if you configure Pi-hole to be local DNS resolver, then you will probably want to configure your Raspberry Pi to use the Pi-hole container in the first instance, and then fall back to a public DNS server if the container is down. As a beginner, this is probably what you want regardless. Do this by running the commands:
229
276
230
-
```console
277
+
```console
231
278
$ echo "name_servers=127.0.0.1" | sudo tee -a /etc/resolvconf.conf
232
279
$ echo "name_servers_append=8.8.8.8" | sudo tee -a /etc/resolvconf.conf
233
280
$ echo "resolv_conf_local_only=NO" | sudo tee -a /etc/resolvconf.conf
@@ -253,7 +300,7 @@ container isn't running.
253
300
254
301
You need slightly different syntax if you want to add multiple fallback servers. For example, suppose your fallback hosts are a local server (eg 192.168.1.2) running BIND9 and 8.8.8.8. The command would be:
255
302
256
-
```console
303
+
```console
257
304
$ echo 'name_servers_append="192.168.1.2 8.8.8.8"' | sudo tee -a /etc/resolvconf.conf
258
305
```
259
306
@@ -273,15 +320,15 @@ container isn't running.
273
320
274
321
* If you wish to prevent the Raspberry Pi from including the address(es) of DNS servers learned from DHCP, you can instruct the DHCP client running on the Raspberry Pi to ignore the information coming from the DHCP server:
275
322
276
-
```console
323
+
```console
277
324
$ echo 'nooption domain_name_servers' | sudo tee -a /etc/dhcpcd.conf
278
325
$ sudo service dhcpcd reload
279
326
$ sudo resolvconf -u
280
327
```
281
328
282
329
* If you have followed the steps in [Adding local domain names](#localNames) to define names for your local hosts, you can inform the Raspberry Pi of that fact like this:
283
330
284
-
```console
331
+
```console
285
332
$ echo 'search_domains=home.arpa' | sudo tee -a /etc/resolvconf.conf
286
333
$ sudo resolvconf -u
287
334
```
@@ -305,19 +352,19 @@ container isn't running.
305
352
It's possible to make DNS queries directly cross-container, and even
306
353
supported in some [rare use-cases](WireGuard.md#customContInit).
307
354
308
-
## Configure Pi-hole as your local DNS resolver
355
+
## Using Pi-hole as your local DNS
309
356
310
-
To use the Pi-hole in your LAN, you need to assign the RPi a fixed IP-address and configure this IP as your DNS server.
357
+
To use the Pi-hole in your LAN, you need to assign the Raspberry Pi a fixed IP-address and configure this IP as your DNS server.
311
358
312
-
### 1. Assign the RPi a fixed IP address { #rpiFixedIP }
359
+
### Fixed IP address for Pi-hole { #rpiFixedIP }
313
360
314
361
If you want clients on your network to use Pi-hole for their DNS, the Raspberry Pi running Pi-hole **must** have a fixed IP address. It does not have to be a *static* IP address (in the sense of being hard-coded into the Raspberry Pi). The Raspberry Pi can still obtain its IP address from DHCP at boot time, providing your DHCP server (usually your home router) always returns the same IP address. This is usually referred to as a *static binding* and associates the Raspberry Pi's MAC address with a fixed IP address.
315
362
316
363
Keep in mind that many Raspberry Pis have both Ethernet and WiFi interfaces. It is generally prudent to establish static bindings for *both* network interfaces in your DHCP server.
317
364
318
365
You can use the following command to discover the MAC addresses for your Raspberry Pi's Ethernet and WiFi interfaces:
319
366
320
-
```console
367
+
```console
321
368
$ for I in eth0 wlan0 ; do ip link show $I ; done
322
369
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
If a physical interface does not exist, the command returns "Device does not exist" for that interface. If you prefer, you can also substitute the `ifconfig` command for `ip link show`. It's just a little more wordy.
334
381
335
-
336
-
### 2. Configuring other machines to use the Raspberry Pi running Pi-hole { #rpiConfig }
382
+
### Configure clients to use Pi-hole { #rpiConfig }
337
383
338
384
In order for Pi-hole to block ads or resolve anything, clients need to be told to use it as their DNS server. You can either:
339
385
@@ -378,7 +424,7 @@ Make these assumptions:
378
424
379
425
The result of the configuration appears in `/etc/resolv.conf`:
380
426
381
-
```console
427
+
```console
382
428
$ cat /etc/resolv.conf
383
429
# Generated by resolvconf
384
430
nameserver 127.0.0.1
@@ -394,25 +440,23 @@ Interpretation:
394
440
395
441
The fact that the Raspberry Pi is effectively represented twice (once as 127.0.0.1, and again as 192.168.1.10) does not matter. If the Pi-hole container stops running, the Raspberry Pi will bypass 192.168.1.10 and fail over to 8.8.8.8, failing back to 127.0.0.1 when the Pi-hole container starts again.
396
442
397
-
398
-
399
443
Install dig:
400
444
401
-
```console
445
+
```console
402
446
$ sudo apt install dnsutils
403
447
```
404
448
405
449
Test that Pi-hole is correctly configured (should respond 192.168.1.10):
406
450
407
-
```console
451
+
```console
408
452
$ dig raspberrypi.home.arpa @192.168.1.10
409
453
```
410
454
411
455
To test on another machine if your network's DNS configuration is correct, and
412
456
an ESP will resolve its DNS queries correctly, restart the other machine to
413
457
ensure DNS changes are updated and then use:
414
458
415
-
```console
459
+
```console
416
460
$ dig raspberrypi.home.arpa
417
461
```
418
462
@@ -450,7 +494,7 @@ The recommended approach is:
450
494
3. Logout of the Web GUI.
451
495
4. Run the following commands:
452
496
453
-
```console
497
+
```console
454
498
$ cd ~/IOTstack
455
499
$ docker-compose rm --force --stop -v pihole
456
500
$ sudo rm -rf ./volumes/pihole
@@ -459,3 +503,13 @@ The recommended approach is:
459
503
460
504
5. Login to Pi-hole's web GUI and navigate to Settings » Teleporter.
461
505
6. Use the checkboxes to select the settings you wish to restore, and click the <kbd>Browse</kbd> and <kbd>Restore</kbd> buttons.
506
+
507
+
## Docker Desktop { #dockerDesktop }
508
+
509
+
If you run Pi-hole using Docker Desktop for macOS, all client activity will be logged against the IP address of the default gateway on the internal bridged network.
510
+
511
+
It appears that Docker Desktop for macOS interposes an additional level of Network Address Translation (NAT) between clients and the Pi-hole service. This does not affect Pi-hole's ability to block ads. It just makes the GUI reports a little less useful.
512
+
513
+
It is not known whether this is peculiar to Docker Desktop for macOS or also affects other variants of Docker Desktop.
514
+
515
+
This problem does not affect Pi-hole running in a container on a Raspberry Pi.
0 commit comments