Skip to content
Contents
GuidesOpenWrt

Why add_wan_fqdn only works after restarting dnsmasq on OpenWrt

When the router powers on, the WAN address might be generated after the local host has already recorded it. Check the address and name at the time of failure and again after the WAN is ready to identify where the discrepancy occurs.

Applies to · dnsmasq · add_wan_fqdn

What to check

From startup after power was disconnected logs, check the order of WAN address acquisition and dnsmasq startup; verify the temporary hosts file contains the expected WAN name.

Connect over Ethernet and run the following commands in an SSH session on the router.

uci show dhcp | grep add_wan_fqdn
ubus call network.interface.wan status
ls -l /tmp/hosts/
grep -H . /tmp/hosts/* 2>/dev/null | head -n 40

How to interpret the result

First check the WAN status for uplink state and address. Then examine the generated hosts entries. If the WAN has not yet obtained an address, wait until the interface is ready before checking. If an address is assigned but no corresponding hostname exists, compare the hosts records before and after a normal reload.

Verify and recover

On the next normal startup, query the WAN name after the interface gets its address. It should resolve without manually restarting dnsmasq. Remove temporary delays or scheduled restarts before repeating the check.

Related guide · What to back up separately from OpenWrt UCI configuration

Explore hardware

Comments