OpenWrt as Secondary or BackUp dhcp server

Hi,
I have a home network with a DHCP and DNS server on a Raspberry and OpenWRT as router.

Sometimes I am away from my house for long periods. It happened that after an upgrade, my Raspberry Pi did not restart.
In this case, I would have the OpenWrt server acting as a DHCP server. Is it possible?

The other solution could be a private wifi network, managed by an OpenWRT router, having a separate DHCP server. Any suggestions?

I read

but I am not sure that this is the better solution. I asking someone with suitable expertise.

Best Regards

You can have both dhcp servers running. Set the dhcp pool on RPi from 192.168.1.10-100 and to OpenWrt from 192.168.1.110-200 for example. You can use the remaining addresses for static leases (which must be replicated). Also check the setting to Force dhcp even if another dhcp is detected.

1 Like

sure, depends on how many ip´s you need but for example
share ip range from box1
192.168.1.10-100
and box2
192.168.1.101-200

same dns/gateway etc on both scopes

the one that responds first get to "deliver" the ip

I would like to have a deterministic solution.
I could write a script on the OpenWRT that enables the DHCP server if the Rasp does not respond... perhaps this is the better idea... What do you think about this solution?

What you are looking for is called "DHCP failover". People often lump it in with other related topics under a broader concept of "high availability". In order for DHCP failover to work, all DHCP servers on the network must support it.

Implementation of DHCP failover in OpenWrt is discussed in the documentation:

But, to repeat, your primary DHCP server (in your case, the Raspberry Pi) must be aware that it is a part of a setup that includes failover and act accordingly. To simplify, it must be able to tell clients, "hey, if I'm dead, here's where you go for service".

So I would suggest reading up on DHCP failover (and on overall high availability) in general and on its implementation in both OpenWrt and whatever OS you're running on the RasPi.

2 Likes