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
In order for the Pi-hole to ad-block or resolve anything, it needs to be
38
+
defined as the DNS server. This can either be done manually to each device or
39
+
you can define it as a DNS-nameserver for the whole LAN.
12
40
13
-
In order for the Pi-hole to work, it needs to be defined as the DNS server.
14
-
This can either be done manually to each device or you can define it as a
15
-
DNS-nameserver for the whole LAN.
41
+
Note that using Pi-hole for clients on your network pretty much **requires** the
42
+
Raspberry Pi running Pi-hole to have a fixed IP address.
16
43
17
-
Assuming your pihole hostname is `raspberrypi` and has the IP `192.168.1.10`:
44
+
Assuming your RPi hostname is `raspberrypi` and has the static IP
45
+
`192.168.1.10`:
18
46
19
-
1. Go to the Pi-hole web interface: `http://raspberrypi.local:8089/admin` and Login
20
-
* From Left menu: Select Local DNS -> DNS Records
21
-
* Enter Domain: `raspberrypi.home.arpa` and IP Address: `192.168.1.10`. Press Add.
22
-
2. Go to your DHCP server, usually this is your Wireless Access Point / WLAN Router web interface.
47
+
1. Go to your network's DHCP server, usually this is your Wireless Access Point
48
+
/ WLAN Router.
49
+
* Login into its web-interface
23
50
* Find where DNS servers are defined
24
-
* Change all DNS fields to `192.168.1.10`.
25
-
3. All local machines have to be rebooted or have their DHCP leases released. Without this they will continue to use the old DNS setting from an old DHCP lease for quite some time.
51
+
* Change all DNS fields to `192.168.1.10`
52
+
2. All local machines have to be rebooted. Without this they will continue to
53
+
use the old DNS setting from an old DHCP lease for quite some time.
26
54
27
-
Now you can use `raspberrypi.home.arpa` as the domain name for the Raspberry Pi in your whole local network.
55
+
## Adding domain names
28
56
29
-
For the Raspberry Pi itself to also use the Pi-hole DNS server, run:
57
+
Login to the Pi-hole web interface: `http://raspberrypi.local:8089/admin`:
58
+
59
+
1. Select from Left menu: Local DNS -> DNS Records
60
+
2. Enter Domain: `raspberrypi.home.arpa` and IP Address: `192.168.1.10`. Press
61
+
Add.
62
+
63
+
Now you can use `raspberrypi.home.arpa` as the domain name for the Raspberry Pi
64
+
in your whole local network. You can also add domain names for your other
65
+
devices, provided they too have static IPs.
66
+
67
+
The Raspberry Pi itself must also use be configured to use the Pi-hole DNS
68
+
server. This is especially important when you add your own domains names,
69
+
otherwise DNS may work differently on the Pi than on other devices. Configure
70
+
this by running:
30
71
```bash
31
72
echo"name_servers=127.0.0.1"| sudo tee -a /etc/resolvconf.conf
32
73
echo"name_servers_append=8.8.8.8"| sudo tee -a /etc/resolvconf.conf
33
74
echo"resolv_conf_local_only=NO"| sudo tee -a /etc/resolvconf.conf
34
75
sudo resolvconf -u # Ignore "Too few arguments."-complaint
35
76
```
36
-
Quick explanation: resolv_conf_local_only is disabled and a public nameserver is added, so that in case the Pi-hole container is stopped, the Raspberry won't lose DNS functionality. It will just fallback to 8.8.8.8.
77
+
Quick explanation: resolv_conf_local_only is disabled and a public nameserver
78
+
is added, so that in case the Pi-hole container is stopped, the Raspberry won't
79
+
lose DNS functionality. It will just fallback to 8.8.8.8.
37
80
38
81
### Testing & Troubleshooting
39
82
@@ -42,29 +85,43 @@ Install dig:
42
85
apt install dnsutils
43
86
```
44
87
45
-
Test that pi-hole is correctly configured (should respond 192.168.1.10):
88
+
Test that Pi-hole is correctly configured (should respond 192.168.1.10):
46
89
```
47
90
dig raspberrypi.home.arpa @192.168.1.10
48
91
```
49
92
50
-
To test on your desktop if your network configuration is correct, and an ESP will resolve its DNS queries correctly, restart your desktop machine to ensure DNS changes are updated and then use:
93
+
To test on your desktop if your network configuration is correct, and an ESP
94
+
will resolve its DNS queries correctly, restart your desktop machine to ensure
95
+
DNS changes are updated and then use:
51
96
```
52
97
dig raspberrypi.home.arpa
53
98
```
54
99
This should produce the same result as the previous command.
55
100
56
-
If this fails to resolve the IP, check that the server in the response is `192.168.1.10`.
57
-
If it's `127.0.0.xx` check `/etc/resolv.conf` begins with `nameserver 192.168.1.10`.
101
+
If this fails to resolve the IP, check that the server in the response is
102
+
`192.168.1.10`. If it's `127.0.0.xx` check `/etc/resolv.conf` begins with
103
+
`nameserver 192.168.1.10`.
104
+
105
+
## Why .home.arpa?
106
+
107
+
Instead of `.home.arpa` - which is the real standard, but a mouthful - you may
108
+
use `.internal`. Using `.local` would technically also work, but it should be
109
+
reserved only for mDNS use.
58
110
59
111
## Microcontrollers
60
112
61
113
If you want to avoid hardcoding your Raspberry Pi IP to your ESPhome devices,
62
114
you need a DNS server that will do the resolving. This can be done using the
63
115
Pi-hole container as described above.
64
116
65
-
## Why .home.arpa?
117
+
!!! info "`*.local` won't work for ESPhome"
66
118
67
-
Instead of `.home.arpa` - which is the real standard, but a mouthful - you may use `.internal`.
68
-
Using `.local` would technically also work, but it should be reserved only for mDNS use.
119
+
There is a special case for resolving `*.local` addresses. If you do a
120
+
`ping raspberrypi.local` on your desktop linux or the RPI, it will first
121
+
try using mDNS/bonjour to resolve the IP address raspberrypi.local. If this
122
+
fails it will then ask the DNS server. Esphome devices can't use mDNS to
123
+
resolve an IP address. You need a proper DNS server to respond to queries
124
+
made by an ESP. As such, `dig raspberrypi.local` will fail, simulating
125
+
ESPhome device behavior. This is as intended, and you should use
126
+
raspberrypi.home.arpa as the address on your ESP-device.
69
127
70
-
Note: There is a special case for resolving `*.local` addresses. If you do a `ping raspberrypi.local` on your desktop linux or the RPI, it will first try using mDNS/bonjour to resolve the IP address raspberrypi.local. If this fails it will then ask the DNS server. Esphome devices can't use mDNS to resolve an IP address. You need a proper DNS server to respond to queries made by an ESP. As such, `dig raspberrypi.local` will fail, simulating ESPhome device behavior. This is as intended, and you should use raspberrypi.home.arpa as the address on your ESP-device.
0 commit comments