[Dnsmasq-discuss] Active-passive failover for dnsmasq with ldirectord

Tom Fernandes anyaddress at gmx.net
Thu Jan 23 14:08:15 GMT 2020


I read the old threads regarding dnsmasq and high availability and would
like to know if the following setup is possible or if I'm missing something.

Master: dnsmasq A (
Slave: dnsmasq B (

Loadbalancer virtual IP in ldirectord

The clients use the virtual IP as their nameserver.

Host A is a "normally" configured dnsmasq server which also offers DHCP.

Host B is configured the same way like server A with addition of an
iptables rule which blocks incoming DHCP-Requests.

The configuration files + the DHCP leases file are on a shared
(active-active) Cluster-FS available to A and B.

ldirectord is configured with with one realserver (A) and one fallback
server (B). In this configuration a connection to will only
lookup records from host A (as long as A is alive).

When A goes down, the following will happen:
1) The fallback server B will be used when clients lookup records from
2) The loadbalancer will connect (through ldirectords "fallbackcommand"
with the "start" parameter) via SSH to server B and remove the iptables
rule which blocks incoming DHCP requests and will restart dnsmasq.

Now server B is offering DHCP and DNS requests in the same way like
server A was doing before.

When server A gets online again the "fallbackcommand" on the
loadbalancer is called again (this time with the "stop" parameter). It
will now connect to server A and restart dnsmasq and to server B and set
the iptables rule again to block incoming DHCP requests. Server B will
become the fallback server again.

What do you think?

Warm regards,


More information about the Dnsmasq-discuss mailing list