[Dnsmasq-discuss] Further thoughts/questions on failover

Ed W lists at wildgooses.com
Fri Sep 3 11:05:43 UTC 2021


On 02/09/2021 15:30, Chris Green wrote:
> On Thu, Sep 02, 2021 at 02:58:44PM +0100, Kevin Tedder wrote:
>> Personally, I'd rather have two systems fully operational all the time. To
>> discover that the back up solution is not working at the critical moment is
>> the same as not having a backup at all.
> Is there some way the two systems can share the client names supplied
> at DHCP time?


This isn't a totally serious suggestion, but I was just pondering your request:

You could write a little script to sync the DHCP events between two machines, probably pick lua, etc
for this, but just as a proof of concept:

    dbus-monitor --system --profile "interface='uk.org.thekelleys.dnsmasq',type=signal"

Will give you a stream of all the dbus events, which you can pipe into a "while -r line; do ... end"
loop.

Send details of the lease update to the other machine with dbus-send.


I *think* this will keep your DNS in sync such that leases or releases update each machine

BUT: It won't solve your cluster problem on what happens when one machine goes down because
"something" needs to promote the other machine to master DHCP server...

I wonder if you were running the above script whether it would "work" as desired in a small lan to
just let both DHCP servers fight it out? Probably on average each will assign the identical address
and give an identical response anyway... Run a longer cable to one or the other ;-)


At least theoretically you need a 3+ machine cluster to decide a quorum of who is dead or alive,
some way to ensure that the dead node really is dead (and it's not just a net split) and then the
quorum will have some way to promote/demote the alive machine to master.

Note I think from your question you might not be clear that it's absolutely fine for multiple
machines on the network to just "take" any IP address they wish, ie to promote machine 2 to the same
IP address as dead machine 1, you just tell machine 2 to add the IP address to it's interface.
(Note: there can be some seconds delay when you do this if there is a switch in the way, but read up
on gratuitous ARPs to eliminate this delay). Also be very wary now about how easy it is for a rogue
device to spoof being your internet gateway and be sitting in the middle of reading all your
traffic... ;-)


I would be interested if anyone had a moment to knock up the rest of the script described above and
report how well it works? I speculate that if you were to ignore the problem of netsplits then it
would likely be reasonably simple to add some cluster functionality to dnsmasq which simply
monitored it's twin and if inaccessible would promote itself to master. Technically this is
incorrect as it doesn't handle netsplits, but I think for home use and for DHCP where you can just
unplug and replug a couple of devices after some cockup, this would be "good enough"?

Ed W





More information about the Dnsmasq-discuss mailing list