Every time OpenWrt is started, the external network must be physically disconnected to start the DHCP service, otherwise the client will not be assigned an IP. What is the reason?

After a power failure or restart, the client will not be assigned an intranet IP address. The network cable of eth1 (WAN) must be unplugged and restarted to return to normal.

Hardware setup:

[Modem] <-> [OpenWrt] <-> [Asus AP] <-> [Clients]

The network configuration is as follows:

root@OpenWrt:~ # cat /etc/config/network

config interface 'loopback'
	option device 'lo'
	option proto 'static'
	option ipaddr '127.0.0.1'
	option netmask '255.0.0.0'

config globals 'globals'
	option ula_prefix 'xxx'

config device
	option name 'br-lan'
	option type 'bridge'
	list ports 'eth0'
	list ports 'eth2'
	list ports 'eth3'

config interface 'lan'
	option device 'br-lan'
	option proto 'static'
	option ipaddr '192.168.3.1'
	option netmask '255.255.255.0'
	option ip6assign '60'

config interface 'wan'
	option device 'eth1'
	option proto 'pppoe'
	option username 'xxx'
	option password 'xxx'
	option ipv6 'auto'

config interface 'wan6'
	option device 'eth1'
	option proto 'dhcpv6'

config interface 'docker'
	option device 'docker0'
	option proto 'none'
	option auto '0'

config device
	option type 'bridge'
	option name 'docker0'

Would you help by describing things a bit more?

What loses power? Does your ISP "drop" at the same time? Which modem do you have and how is it configured (bridge/pass-through or NAT)?

What is providing DHCP for your devices? Which device(s) does not get a DHCP assignment?

What loses power?

Sorry, I should be clear: It is just power outage.

Does your ISP "drop" at the same time?

No.

Which modem do you have and how is it configured (bridge/pass-through or NAT)?

It is bridge mode.

What is providing DHCP for your devices?

I want the OpenWrt device to provide DHCP. Maybe I have the wrong configuration?

Which device(s) does not get a DHCP assignment?

All of my devices, including MacBooks/iPhones/Android phones/PCs

No problem -- I've run into modems that "decided" if to be in bridge vs. NAT mode depending on the order in which they came up relative to the downstream device. That disconnecting the cable (I'm assuming between the modem and the OpenWrt router, yes?) changed things had me thinking it might be something like that.

It might have to do with sequencing in a different way. If you've got a Docker container starting up, I don't know how that might impact other parts of the start-up sequence. I would think you need PPPoE to come up, as well as whatever you're using for a DHCP server.

Having the Asus AP in the mix, depending on how it is configured, might be another complication. If it has a DHCP server that hasn't been disabled completely, there may be contention or some other sequencing question.

Unless it is something obvious with the Asus' configuration, these things can be time-consuming to diagnose. If you do need to start testing things, I'd start with disabling any "extra" things on the OpenWrt box, such as Docker (assuming it isn't running the DNS or DHCP server). Put everything on a power strip with a switch and that way you can make power failures with simultaneous restoration to all devices at will.

1 Like

Thanks Jeff! This makes sense! Let me disable Docker and give a try.
My Docker is running several services like Tesla Mate and Jellyfin.

Update:

I also asked this question in another forum (in Chinese: https://v2ex.com/t/856351).
They suspect that the Asus AP could cause this problem and ask me to check Force of the DHCP Server Advanced Settings:

I tried and it helps to "work around" this problem.

I'm a bit lazy to debug it now. :sweat_smile:
Maybe after my work hours I can debug and read the logs.

:warning: This is a bad idea if there is another DHCP server on the network. It could cause major problems for the entire network

Yeah. But for the home network, there's usually only one DHCP server?

With the exception of larger networks (typically medium size businesses up to 'enterprise'), there should only be one DHCP server in a network/subnet. In those larger networks, there are various techniques used to have multiple DHCP servers running simultaneously so that they don't conflict with each other.

1 Like

Yeah, exactly. One DHCP server per device (router, modem, switch, AP) multiplied by devices in the home because all manufacturers believe they are the only device in home owners network.

And they all want to ”help” the home owner by auto setting up everything.