Using as an access point, but also a router with DHCP

Hey everyone,

My setup is like this: I have an ISP provided router (192.168.0.1), which I can't do much on. I have a Xiaomi router with OpenWRT which I want to use as a main router. I also have a powerline extender for part of the home with poor wifi access.

Previously I was using Xiaomi router on 192.168.1.1 with NAT, and doing port forwarding with a setup like this:
ISP router -> Xiaomi router -> device

Now I am trying to do something like this:

  • ISP router is on 192.168.0.1
  • Xiaomi router is connected to ISP router on WAN port, and distributes that connection through wired LAN ports and wireless. This router can be on 192.168.0.10 (so that all the devices in the home are on the same network).

I configured the DHCP server on the ISP router to use IPs between 192.168.0.230-255.

And I want Xiaomi router's DHCP be enabled, too. With a range like 192.168.0.40-229.

The part I can't figure out is that, no matter what I tried DHCP clients receive IP from the ISP router. Is what I am trying doable? Or should I stick with the topology with NAT?

No, yes.
Unless you can disable the DHCP on the main router.

As frollic said, there can only be one DHCP server on a physical network[0]. In your envisioned setup (which can't work, at all), both would severely clash with each other and cause massive havoc.

--
[0] unless you have an enterprise setup, where multiple servers are closely cooperating to fail-over for each other, possible, but very complicated (and not at all possible with your ISP router, nor a default OpenWrt setup)

I think I managed to configure exactly as I said. In case someone else stumbles upon the same thing here is what I did:

  • I configured the DHCP settings on both routers with the ranges.
  • I enabled the "Force" option in DHCP Server > Advanced Settings.

  • For the Xiaomi router, I also added WAN port to the bridge, so I think it serves as a regular bridge port just like the LAN ports now.

Just to be clear, this is not a recommended path -- yes, you can physically get two DHCP servers to run on the same L2 network, but it is likely to cause problems -- there may be race conditions or inconsistent responses from the two DHCP servers. In many cases, this will lead to sub-optimal network performance.

Take a step back and think about what that setting is supposed to do.

Yes, it overrides the safety guard on OpenWrt not to start its own dhcpd if there's already another dhcpd running on the network, but it doesn't do anything beyond that. It doesn't magically make both cooperate, both will still respond to DHCP request and hand out -conflicting- DHCP leases, a total mess.

1 Like

Thanks for the explanations, I understand. Even if this configuration works most of the time, I have already started experiencing some weird behavior, sometimes the ISP router manages to assign IPs outside the OpwnWRT's range.

I want to keep the ISP router usable without any configuration, in case something in my setup goes down, and someone needs to use the ISP router's internet directly while I am not able to fix. What do you folks suggest?

Turn off the DHCP server on the OpenWrt device and just use it as a dumb AP.