I'm trying to use unbound in combination with vrrp/keepalived.
The use of floating ips, would require an unbound restart every
time an ip moves from one host to another.
For ipv4 linux has the ip.nonlocal_bind sysctl to allow binding
to non-local ips, however ipv6 has no such sysctl.
NSD has the ip-transparent option to set the sockopt to make
non-local binding possible, unbound doesn't seem to support
a similar feature.
Would a patch adding support for this feature be accepted?
A very crude, but works-for-me diff is included below.
(this is based on 1.4.22, but 1.5 seems to be pretty similar)
I'm trying to use unbound in combination with vrrp/keepalived.
The use of floating ips, would require an unbound restart every
time an ip moves from one host to another.
Have you tried using: interface-automatic: yes
(So something like:
interface: 0.0.0.0
interface: ::0
interface-automatic: yes
in unbound.conf).
We've used this with keepalived/unbound and it has worked for us.
(No need to restart unbound after ip address failover).
(We also have
outgoing-interface: server.ipv4.add.ress
outgoing-interface: server.ipv6.add.ress
so unbound doesn't use floating(keepalived) addrs for outgoing queries).
(I think on ip address failover unbound can try to send reply from
floating(vip) address that has just moved to another server, but
with our setup this hasn't been a problem).
For ipv4 linux has the ip.nonlocal_bind sysctl to allow binding
to non-local ips, however ipv6 has no such sysctl.
For haproxy/keepalived we use this "hack" for ipv6 vip(floating
addresses): bind all ipv6 VIPs to "lo" interface --> haproxy
can bind to needed addrs.
(Simple ip_nonlocal_bind IPv6 workaround · GitHub)
(I haven't tested this with unbound, because interface-automatic: yes
works for us).
As reported in my earlier mail, this doesn't work if you have
other daemons (like NSD) using port 53 on the same box.
I know there are workarounds to achieve the same result,
but I would actually prefer a fix to unbound which removes the need
for workarounds. It's not like this is an overly complicated patch.
This probably should be an optional feature, but listen_dnsports.c
passes options via function arguments so doing this would make the patch
a lot bigger and obscure the core requested feature.
Modified version of that ip-transparent patch is in unbound's code
repository (for future releases). I added a config option, because
setting it by default could not work, it fails for non-administrators.