Skip to content

Commit 0d9b982

Browse files
committed
Wireguard: better document how PEERDNS works with host resolv.conf
Fix script comment to properly describe how th bridge gateway works.
1 parent 118648d commit 0d9b982

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-5
lines changed

.templates/wireguard/use-container-dns.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# Forward DNS requests from remote WireGuard clients to the default
22
# gateway on the internal bridged network that the WireGuard container
3-
# is attached to. This results in queries being sent to any other
4-
# container on the same internal bridged network that is listening
5-
# on port 53 (eg PiHole, AdGuardHome or bind9).
3+
# is attached to. The gateway routes queries out from the bridged network to
4+
# the host's network. This results in queries being sent to any daemon or
5+
# container that is listening on host port 53 (eg PiHole, AdGuardHome, dnsmasq
6+
# or bind9).
67
#
78
# Acknowledgement: @ukkopahis
89

docs/Containers/WireGuard.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,26 @@ You have several options for how your remote peers resolve DNS requests:
106106

107107
* `PEERDNS=auto`
108108

109-
The default value of `auto` instructs the WireGuard *service* running within the WireGuard *container* to use the same DNS as the WireGuard *container* when resolving requests from connected peers. In practice, that means the *service* directs queries to 127.0.0.11, which Docker intercepts and forwards to whichever resolvers are specified in the Raspberry Pi's `/etc/resolv.conf`.
109+
DNS queries made on connected WireGuard clients should work as if they were
110+
made on the host. If you [configure](Pi-hole.md#pi-hole-as-dns-server) your
111+
ad-blocker into the host's `resolveconf.conf`, Wireguard clients will also
112+
automatically use it.
113+
114+
Details: The default value of `auto` instructs the WireGuard *service*
115+
running within the WireGuard *container* to use a DNS-service, coredns,
116+
also running in the Wireguard container. Coredns by default directs queries
117+
to 127.0.0.11, which Docker intercepts and forwards to whichever resolvers
118+
are specified in the Raspberry Pi's `/etc/resolv.conf`.
110119

111120
* `PEERDNS=auto` with `custom-cont-init` <a name="customContInit"></a>
112121

113-
This configuration instructs WireGuard to forward DNS queries from remote peers to any **container** which is listening on port 53. This is the option you will want to choose if you are running an ad-blocking DNS server (eg *PiHole* or *AdGuardHome*) in a container on the same host as WireGuard, and you want your remote clients to obtain DNS resolution via the ad-blocker.
122+
This configuration instructs WireGuard to forward DNS queries from remote
123+
peers to any host daemon or **container** which is listening on port 53.
124+
This is the option you will want to choose if you are running an
125+
ad-blocking DNS server (eg *PiHole* or *AdGuardHome*) in a container on the
126+
same host as WireGuard, and you want your remote clients to obtain DNS
127+
resolution via the ad-blocker, but don't want your Raspberry Pi host to use
128+
it.
114129

115130
> Acknowledgement: thanks to @ukkopahis for developing this option.
116131

@@ -160,6 +175,9 @@ You have several options for how your remote peers resolve DNS requests:
160175
```yml
161176
- PEERDNS=192.168.203.65
162177
```
178+
Do note that changes to `PEERDNS` will not be updated to existing clients,
179+
and as such you may want to use `PEERDNS=auto` unless you have a very
180+
specific requirement.
163181

164182
#### Optional configuration - WireGuard ports
165183

0 commit comments

Comments
 (0)