Competing DHCP servers

My router is a TP-Link C7 v5 running on an OpenWrt 19.07.8 custom image.

On my other, "regular" router there is a checkbox for telling it to "give way" on encountering another DHCP server. I believe this encounter may be called "race condition," but am not sure.

Questions.

  1. What is the default OpenWrt setting for an encounter with another DCHP server?
  2. How can I expressly configure it to "give way" or "insist"? (Please include both the relevant config file and lines and where in LuCI, if available). Thanks.

ADDED LATER

Maybe I should have said what the desired outcome was. It's this:

  • The OpenWrt router's WAN connects to the modem and provides DHCP service.
  • The "regular" router is intended to be a "switch" (i.e. I only want it for the extra holes to plug LAN cables into) and connects LAN-LAN with the OpenWrt with (regular router's) DHCP either disabled or on "give way."

But if the OpenWrt is also on "give way," we'd get, as it were, a "You do it. Oh no, you do it" situation.

Thus, I want to put OpenWrt on "not give way" if possible. What would be the config or LuCI for that?

I understand from the comments already received that the better practice is to disable DHCP completely on the regular router. I would just like to know how to put OpenWrit on "not give way" if I wanted to.

A word on why I'd want that: While the "regular" router is being a switch, I may also be configuring it for some other role elsewhere (including an active DHCP). In this case, there would come a last moment when I would change it from "disabled" to "give way," after which I would unplug it from OpenWrt. In that short interval I would have two potentially active DHCP servers, one assertive (OpenWrt) and the other giving way.

Of course there would be alternatives such as connecting OpenWrt=LAN---WAN=Regular while setting up the regular (with all the DHCP it wants). But I want to have all the options available to me.

It just came to me that the OpenWrt default may already accommodate the above situation because slh has said:

Not checking constantly. If so, when at the "last moment" (as above) I change the other router from "disabled" to "give way," OpenWrt will not give way (it has not checked and does not know there is potential competition). Only, the other router will give way. If this is correct, please so advise. Thanks. (Even here, I would still like to know how to set OpenWrt on "not give way.")

1 Like

First of all, make sure that there'll never be a rogue DHCP server in your physical subnet, the effects are not pretty and will result in quite some issues before you'd find the culprit.

OpenWrt's default is to check for an existing DHCPd before starting its own - and bailing out if there is one. Never rely on this though, as race conditions (main DHCPd temporarily down) could end up quite ugly.

3 Likes

Unless you really need a configuration with two DHCP servers (for high availability, for example), and configure it adequately, I would just disable one completely.

2 Likes

Understood on potential ugliness. Would you however advise how to put OpenWrt on "not give way" if anybody wanted to? Please see ADDED LATER portion of question. Thanks.

I don't need two DHCP servers. Please see ADDED LATER portion. Thanks.

https://openwrt.org/docs/guide-user/base-system/dhcp_configuration#race_conditions_with_netifd

1 Like

Aren't you making this too complicated, just for a future situation that may or may not happen, and to avoid five potential minutes of downtime?

2 Likes

I'm not going to do it. Too complex and invasive, as you say. I have never edited an *.init before. Still good to know there's a whole new area for me out there.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.