Open DanielG opened 1 year ago
After a quick look at the code I figured it out, you're supposed to set ip-freebind: yes
.
While the manpage does mention "freebind" it doesn't make it explicit that this option needs to be turned on:
On Linux you need these two commands
to be able to use the freebind socket option to receive traffic
for the ip6 netblock: ip -6 addr add mynetblock/64 dev lo && ip
-6 route add local mynetblock/64 dev lo
Describe the bug
When using an ip6 netblock with
outgoing-interface
as documented in the manpage queries needing TCP fail witherror: outgoing tcp: bind: Cannot assign requested address
. I noticed this since it causes DNSSEC enabled domains to be completely broken.To reproduce
(Prerequisite: a prefix of some size should be routed to the host running unbound, I use 2001:db8::/64 as an example here)
Add to unbound.conf:
Make sure to test with domains that have IPv6 enabled nameservers, I use
tracker.debian.org
here as that's what I initially saw the problem with.unbound (verbosity 4) debug logs showing the bind error: https://gist.github.com/DanielG/34bac7d94983c0065bf12e0de313d986
Documentation fix
I've found that setting
sysctl -w net.ipv6.ip_nonlocal_bind=1
will fix this, but I'm not sure if it's intended for this to be needed. If so the documentation should probably be updated.System:
unbound -V
output:Configure line: --build=x86_64-linux-gnu --prefix=/usr --includedir=${prefix}/include --mandir=${prefix}/share/man --infodir=${prefix}/share/info --sysconfdir=/etc --localstatedir=/var --disable-option-checking --disable-silent-rules --libdir=${prefix}/lib/x86_64-linux-gnu --runstatedir=/run --disable-maintainer-mode --disable-dependency-tracking --with-pythonmodule --with-pyunbound --enable-subnet --enable-dnstap --enable-systemd --enable-cachedb --with-libhiredis --with-libnghttp2 --with-chroot-dir= --with-dnstap-socket-path=/run/dnstap.sock --disable-rpath --with-pidfile=/run/unbound.pid --with-libevent --enable-tfo-client --with-rootkey-file=/usr/share/dns/root.key --enable-tfo-server Linked libs: libevent 2.1.12-stable (it uses epoll), OpenSSL 3.0.9 30 May 2023 Linked modules: dns64 python cachedb subnetcache respip validator iterator TCP Fastopen feature available