resolved: add "proxy-only" stub on 127.0.0.54
authorLennart Poettering <lennart@poettering.net>
Mon, 22 Nov 2021 11:20:05 +0000 (12:20 +0100)
committerLennart Poettering <lennart@poettering.net>
Mon, 22 Nov 2021 21:33:24 +0000 (22:33 +0100)
commita8d09063447568d87288a8e868fe386c1da7ce09
treeb61ea5adbb8a517ecd64ce2407491eb193f67942
parentc1b91f06b93ba29eafbf50f4858aedfb6ded4ff1
resolved: add "proxy-only" stub on 127.0.0.54

This beefs up the DNS stub logic to listen on two IP addresses:
127.0.0.53 (as before) + 127.0.0.54 (new). When the latter is contact
our stub will operate in "bypass" mode only, i.e we'll try to pass DNS
requests as unmodified upstream as we can (and not do mDNS/LLMNR and
such, also no DNSSEC validation – but we'll still do DNS-over-TLS
wrapping).

This is supposed to be useful for container environments or tethering:
this stub could be exposed (via NAT redirect) to clients of this system
and we'll try to stay out of the way with doing too much DNS magic
ourselves, but still expose whatever the current DNS server is from
upstream under a stable address/port.

How to use this:

  # iptables -t nat -I PREROUTING -p udp -i <interface> --dport 53 -j DNAT --to 127.0.0.54:53
  # echo 1 > /proc/sys/net/ipv4/conf/<interface>/route_localnet
man/resolved.conf.xml
man/systemd-resolved.service.xml
src/resolve/resolved-conf.c
src/resolve/resolved-dns-stub.c
src/resolve/resolved-manager.h
src/shared/resolve-util.c
src/shared/resolve-util.h