internal DNS: lab.internal resolver on the WG hub (dnsmasq on rpi)
WireGuard clients apply the tunnel DNS to the whole device, so the hub resolver answers lab.internal authoritatively and forwards everything else: - dnsmasq on rpi, bound to lo/wg0/wg-remote only, 10.10.0.1 + 10.20.0.2 - grafana.lab.internal, hubble.lab.internal -> 10.10.0.2 (hosts file, one line per record) - ufw: 53 allowed from 10.10.0.0/24, 10.20.0.0/24, 10.244.0.0/16; dropped everywhere else, inserted above the LAN catch-all - docs: zone, per-client instructions (phone is a linode-hub spoke), rollback
This commit is contained in:
parent
48b2b6ac01
commit
ead60fface
6 changed files with 365 additions and 0 deletions
56
infrastructure/networking/internal/dns/README.md
Normal file
56
infrastructure/networking/internal/dns/README.md
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
# `lab.internal` resolver (WireGuard only)
|
||||
|
||||
Authoritative for the `lab.internal` zone and a forwarder for everything else,
|
||||
running as **dnsmasq on rpi** (the WireGuard hub) at `10.10.0.1:53` and
|
||||
`10.20.0.2:53`. It is a **host** service, not a cluster object — deliberately
|
||||
not behind Cilium's internal Gateway, so it cannot inherit the Envoy
|
||||
listener flapping (`t_e9564aa3`).
|
||||
|
||||
Full write-up, client instructions and rollback: `docs/internal-wireguard-services.md` §11.
|
||||
|
||||
## Files
|
||||
|
||||
| File | Installed to | Purpose |
|
||||
|---|---|---|
|
||||
| `lab-internal.conf` | `/etc/dnsmasq.d/lab-internal.conf` | zone authority (`local=/lab.internal/`), records file, bind list |
|
||||
| `lab-internal.hosts` | `/etc/dnsmasq-lab-internal.hosts` | records, hosts(5) syntax — one line per name |
|
||||
| `rpi-ufw-dns.sh` | — | ufw: allow 53 from mesh/hub-spokes/pods, deny everything else (inserted above the LAN catch-all) |
|
||||
| `install-rpi-dns.sh` | — | installs everything, restarts dnsmasq, prints the bind view |
|
||||
|
||||
`lab-internal.hosts` is installed **outside** `/etc/dnsmasq.d` because the
|
||||
systemd unit parses every file in that directory as config (`-7
|
||||
/etc/dnsmasq.d`); a hosts file there aborts the start with `bad option`.
|
||||
|
||||
## Install / update (root on rpi)
|
||||
|
||||
```bash
|
||||
bash install-rpi-dns.sh
|
||||
```
|
||||
|
||||
## Add a record
|
||||
|
||||
```bash
|
||||
# 1. edit lab-internal.hosts in git and commit, then on rpi:
|
||||
sudo install -m 0644 lab-internal.hosts /etc/dnsmasq-lab-internal.hosts
|
||||
sudo systemctl reload dnsmasq # re-reads addn-hosts, no restart
|
||||
dig +short grafana.lab.internal @10.10.0.1
|
||||
```
|
||||
|
||||
## Verify
|
||||
|
||||
```bash
|
||||
sudo ss -lntuH 'sport = :53' # 127.0.0.1, 10.10.0.1, 10.20.0.2, [::1] only
|
||||
sudo iptables -L ufw-user-input -n -v | grep dpt:53
|
||||
# from a WireGuard client (not on the LAN):
|
||||
dig +short grafana.lab.internal @10.10.0.1 # 10.10.0.2
|
||||
dig +short example.com @10.10.0.1 # forwards, public answer
|
||||
# negative, from the LAN: must time out (DROP)
|
||||
dig +time=3 grafana.lab.internal @192.168.1.125
|
||||
```
|
||||
|
||||
## Why the client must use `10.10.0.1` as its DNS
|
||||
|
||||
Android/iOS apply the tunnel's DNS as the resolver for the **whole device**
|
||||
while the tunnel is up — there is no per-domain split. This resolver therefore
|
||||
answers `lab.internal` locally and forwards everything else upstream, so public
|
||||
DNS keeps working. Clearing the field in the WireGuard app is the rollback.
|
||||
Loading…
Reference in a new issue