Diagnosing what caused DNSMASQ to restart

Hey,

from time to time (~ once / three days roughly) I do see that DNSMASQ gets restarted in system log

[Apr 15, 2026 at 11:06:44 PM PDT] daemon.info: dnsmasq[1]: exiting on receipt of SIGTERM

but I’m not able to find out why in the log (it happens out of nowhere and there’s nothing in kernel log or system log). What’s the best way to figure out how to raise log level or add some debugging to see where it got restarted?

Running 25.12.2 on NanoPi R6s.

Send the logs to a syslog server or open an ssh session with the live log and leave that running until you capture the event. Without that, it will be hard to know what is actually happening.

We can review the configuration in the meantime.

Please connect to your OpenWrt device using ssh and copy the output of the following commands and post it here using the "Preformatted text </> " button (red circle; this works best in the 'Markdown' composer view in the blue oval):

Screenshot 2025-10-20 at 8.14.14 PM

Remember to redact passwords, VPN keys, MAC addresses and any public IP addresses you may have:

ubus call system board
cat /etc/config/network
cat /etc/config/wireless
cat /etc/config/dhcp
cat /etc/config/firewall

And what's the exact command to run to get the live log? I imagine I can install screen and run it from shell and wait till next occurrence happens to get more info.

Commands attached below (with ... for redactions). IPv6 should be disabled in settings.

root@openwrt:~# ubus call system board
{
	"kernel": "6.12.74",
	"hostname": ...,
	"system": "ARMv8 Processor rev 0",
	"model": "FriendlyElec NanoPi R6S",
	"board_name": "friendlyarm,nanopi-r6s",
	"rootfs_type": "squashfs",
	"release": {
		"distribution": "OpenWrt",
		"version": "25.12.2",
		"firmware_url": "https://downloads.openwrt.org/",
		"revision": "r32802-f505120278",
		"target": "rockchip/armv8",
		"description": "OpenWrt 25.12.2 r32802-f505120278",
		"builddate": "1774469393"
	}

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 packet_steering '0'
	option dhcp_default_duid ...

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

config device
	option name 'eth0'
	option macaddr ...

config device
	option name 'eth2'
	option macaddr ...

config interface 'lan'
	option device 'br-lan'
	option proto 'static'
	option ipaddr '192.168.0.1'
	option netmask '255.255.248.0'
	option ip6assign '60'
	option force_link '0'
	option delegate '0'

config device
	option name 'eth1'
	option macaddr ...

config interface 'wan'
	option device 'eth1'
	option proto 'dhcp'

config interface 'modem'
	option proto 'static'
	option device '@wan'
	option ipaddr '192.168.100.2'
	option netmask '255.255.255.0'

config interface 'guest'
	option proto 'static'
	option ipaddr '10.0.0.1'
	option netmask '255.255.255.0'

root@openwrt:~# cat /etc/config/wireless

config wifi-device 'radio0'
	option type 'mac80211'
	option path 'platform/fc000000.usb/xhci-hcd.3.auto/usb4/4-1/4-1:1.0'
	option band '2g'
	option channel 'auto'
	option htmode 'HT20'
	option country 'US'
	option cell_density '0'

config wifi-iface 'default_radio0'
	option device 'radio0'
	option network 'guest'
	option mode 'ap'
	option ssid ...
	option encryption 'psk2'
	option isolate '1'
	option dtim_period '3'
	option wpa_group_rekey '3600'
	option skip_inactivity_poll '1'
	option disassoc_low_ack '0'
	option key ...
	option wpa_disable_eapol_key_retries '1'

config wifi-device 'radio1'
	option type 'mac80211'
	option path 'platform/fc000000.usb/xhci-hcd.3.auto/usb3/3-1/3-1:1.0'
	option band '5g'
	option channel '36'
	option htmode 'VHT80'

config wifi-iface 'default_radio1'
	option device 'radio1'
	option network 'lan'
	option mode 'ap'
	option ssid 'OpenWrt'
	option encryption 'none'
	option disabled '1'
root@openwrt:~# cat /etc/config/dhcp

config dnsmasq
	option domainneeded '1'
	option localise_queries '1'
	option rebind_protection '0'
	option local '/lan/'
	option domain ...
	option expandhosts '1'
	option cachesize '1000'
	option authoritative '1'
	option readethers '1'
	option leasefile '/tmp/dhcp.leases'
	option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
	option localservice '1'
	option ednspacket_max '1232'

config dhcp 'lan'
	option interface 'lan'
	option start '100'
	option limit '150'
	option leasetime '12h'
	option dhcpv4 'server'

config dhcp 'wan'
	option interface 'wan'
	option ignore '1'

config odhcpd 'odhcpd'
	option maindhcp '0'
	option leasefile '/tmp/odhcpd.leases'
	option leasetrigger '/usr/sbin/odhcpd-update'
	option loglevel '4'
	option piodir '/tmp/odhcpd-piodir'
	option hostsdir '/tmp/hosts'

config host
	....
root@openwrt:~# cat /etc/config/firewall

config defaults
	option input 'REJECT'
	option output 'ACCEPT'
	option forward 'REJECT'
	option synflood_protect '1'

config zone
	option name 'lan'
	option input 'ACCEPT'
	option output 'ACCEPT'
	option forward 'ACCEPT'
	list network 'lan'

config zone
	option name 'wan'
	option input 'REJECT'
	option output 'ACCEPT'
	option forward 'REJECT'
	option masq '1'
	option mtu_fix '1'
	list network 'wan'
	list network 'modem'

config forwarding
	option src 'lan'
	option dest 'wan'

config rule
	option name 'Allow-DHCP-Renew'
	option src 'wan'
	option proto 'udp'
	option dest_port '68'
	option target 'ACCEPT'
	option family 'ipv4'

config rule
	option name 'Allow-Ping'
	option src 'wan'
	option proto 'icmp'
	option icmp_type 'echo-request'
	option family 'ipv4'
	option target 'ACCEPT'

config rule
	option name 'Allow-IGMP'
	option src 'wan'
	option proto 'igmp'
	option family 'ipv4'
	option target 'ACCEPT'

config rule
	option name 'Allow-DHCPv6'
	option src 'wan'
	option proto 'udp'
	option dest_port '546'
	option family 'ipv6'
	option target 'ACCEPT'

config rule
	option name 'Allow-MLD'
	option src 'wan'
	option proto 'icmp'
	option src_ip 'fe80::/10'
	list icmp_type '130/0'
	list icmp_type '131/0'
	list icmp_type '132/0'
	list icmp_type '143/0'
	option family 'ipv6'
	option target 'ACCEPT'

config rule
	option name 'Allow-ICMPv6-Input'
	option src 'wan'
	option proto 'icmp'
	list icmp_type 'echo-request'
	list icmp_type 'echo-reply'
	list icmp_type 'destination-unreachable'
	list icmp_type 'packet-too-big'
	list icmp_type 'time-exceeded'
	list icmp_type 'bad-header'
	list icmp_type 'unknown-header-type'
	list icmp_type 'router-solicitation'
	list icmp_type 'neighbour-solicitation'
	list icmp_type 'router-advertisement'
	list icmp_type 'neighbour-advertisement'
	option limit '1000/sec'
	option family 'ipv6'
	option target 'ACCEPT'

config rule
	option name 'Allow-ICMPv6-Forward'
	option src 'wan'
	option dest '*'
	option proto 'icmp'
	list icmp_type 'echo-request'
	list icmp_type 'echo-reply'
	list icmp_type 'destination-unreachable'
	list icmp_type 'packet-too-big'
	list icmp_type 'time-exceeded'
	list icmp_type 'bad-header'
	list icmp_type 'unknown-header-type'
	option limit '1000/sec'
	option family 'ipv6'
	option target 'ACCEPT'

config rule
	option name 'Allow-IPSec-ESP'
	option src 'wan'
	option dest 'lan'
	option proto 'esp'
	option target 'ACCEPT'

config rule
	option name 'Allow-ISAKMP'
	option src 'wan'
	option dest 'lan'
	option dest_port '500'
	option proto 'udp'
	option target 'ACCEPT'

config zone
	option name 'guest'
	option input 'ACCEPT'
	option output 'ACCEPT'
	option forward 'ACCEPT'
	list network 'guest'

config forwarding
	option src 'guest'
	option dest 'wan'

config redirect
	....

I don't see any obvious issues with the config.

It is possible that there is a typo or syntax issue in the dhcp file related to the hosts. For example, 25.12 doesn't accept dashes in the MAC addresses. (I'm not sure if this causes dnsmasq to crash upon startup in general, or only when the respective MAC address sends a DHCP request.)

In a terminal with an active ssh session, simply issue this:

logread -f

Leave that running (make sure the host running the terminal doesn't go to sleep or otherwise disconnect) and make sure that the terminal app has a sufficiently long scroll-back in case you come back to it much later.

Alternatively, setup a syslog server and send everything there. Or, open your router and connect serial (and then do the same thing -- logread -f on the serial terminal)

Keep in mind that odhcpd can restart dnsmasq as needed.

I checked the IP/MACs and there's no issue with dashes, dnsmasq will start and work normally. It's just that once in a while something restarts it which then causes about 30 - 60 seconds of no internet (which is fine most of the time but annoying if you're watching video or in a meeting).

Maybe just to clarify by seeing "nothing" in the syslog / kernel log - I meant nothing relevant I could see. Will logread -f print more verbose log than in syslog in luci or is there some change needed in config to make it more verbose?

The portion of the syslog is here, but there's nothing saying why dnsmasq got SIGTERM on Apr 15, 2026 at 11:06:44 PM PDT.

...
[Apr 12, 2026 at 9:28:16 AM PDT] daemon.info: dnsmasq[1]: read /etc/hosts - 12 names
[Apr 12, 2026 at 9:28:16 AM PDT] daemon.info: dnsmasq[1]: read /tmp/hosts/dhcp.cfg01411c - 52 names
[Apr 12, 2026 at 9:28:16 AM PDT] daemon.info: dnsmasq-dhcp[1]: read /etc/ethers - 0 addresses
[Apr 15, 2026 at 11:06:44 PM PDT] daemon.info: dnsmasq[1]: exiting on receipt of SIGTERM
[Apr 15, 2026 at 11:06:44 PM PDT] daemon.info: dnsmasq[1]: started, version 2.91 cachesize 1000
[Apr 15, 2026 at 11:06:44 PM PDT] daemon.info: dnsmasq[1]: DNS service limited to local subnets
[Apr 15, 2026 at 11:06:44 PM PDT] daemon.info: dnsmasq[1]: compile time options: IPv6 GNU-getopt no-DBus UBus no-i18n no-IDN DHCP no-DHCPv6 no-Lua TFTP no-conntrack no-ipset no-nftset no-auth no-DNSSEC no-ID loop-detect inotify dumpfile
[Apr 15, 2026 at 11:06:44 PM PDT] daemon.info: dnsmasq[1]: UBus support enabled: connected to system bus
[Apr 15, 2026 at 11:06:44 PM PDT] daemon.info: dnsmasq-dhcp[1]: DHCP, IP range 10.0.0.10 -- 10.0.0.254, lease time 12h
[Apr 15, 2026 at 11:06:44 PM PDT] daemon.info: dnsmasq-dhcp[1]: DHCP, IP range 192.168.0.100 -- 192.168.0.249, lease time 12h
[Apr 15, 2026 at 11:06:44 PM PDT] daemon.info: dnsmasq[1]: using only locally-known addresses for test
[Apr 15, 2026 at 11:06:44 PM PDT] daemon.info: dnsmasq[1]: using only locally-known addresses for onion
[Apr 15, 2026 at 11:06:44 PM PDT] daemon.info: dnsmasq[1]: using only locally-known addresses for localhost
[Apr 15, 2026 at 11:06:44 PM PDT] daemon.info: dnsmasq[1]: using only locally-known addresses for local
[Apr 15, 2026 at 11:06:44 PM PDT] daemon.info: dnsmasq[1]: using only locally-known addresses for invalid
[Apr 15, 2026 at 11:06:44 PM PDT] daemon.info: dnsmasq[1]: using only locally-known addresses for bind
[Apr 15, 2026 at 11:06:44 PM PDT] daemon.info: dnsmasq[1]: using only locally-known addresses for lan
[Apr 15, 2026 at 11:06:44 PM PDT] daemon.info: dnsmasq[1]: reading /tmp/resolv.conf.d/resolv.conf.auto
[Apr 15, 2026 at 11:06:44 PM PDT] daemon.info: dnsmasq[1]: using nameserver 75.75.75.75#53
[Apr 15, 2026 at 11:06:44 PM PDT] daemon.info: dnsmasq[1]: using nameserver 75.75.76.76#53
[Apr 15, 2026 at 11:06:44 PM PDT] daemon.info: dnsmasq[1]: using only locally-known addresses for test
[Apr 15, 2026 at 11:06:44 PM PDT] daemon.info: dnsmasq[1]: using only locally-known addresses for onion
[Apr 15, 2026 at 11:06:44 PM PDT] daemon.info: dnsmasq[1]: using only locally-known addresses for localhost
[Apr 15, 2026 at 11:06:44 PM PDT] daemon.info: dnsmasq[1]: using only locally-known addresses for local
[Apr 15, 2026 at 11:06:44 PM PDT] daemon.info: dnsmasq[1]: using only locally-known addresses for invalid
[Apr 15, 2026 at 11:06:44 PM PDT] daemon.info: dnsmasq[1]: using only locally-known addresses for bind
[Apr 15, 2026 at 11:06:44 PM PDT] daemon.info: dnsmasq[1]: using only locally-known addresses for lan
[Apr 15, 2026 at 11:06:44 PM PDT] daemon.info: dnsmasq[1]: read /etc/hosts - 12 names
[Apr 15, 2026 at 11:06:44 PM PDT] daemon.info: dnsmasq[1]: read /tmp/hosts/dhcp.cfg01411c - 52 names
...

You need to look in the logs around the SIGTERM message to see what's happening at the time. A couple of packages restart dnsmasq if there's a fw4 reload or restart, since that flushes nft sets and dnsmasq won't recreate them unless its cache is cleared to force a new resolution that populates the nft set.

Just getting the dnsmasq logs doesn't give enough context even to speculate. Post what's immediately before and after the SIGTERM log entry.

That said, are you using pbr? I've seen this exact signature in my logs when applying a config change to pbr. You only see the verbose log output if you enable it in pbr's config settings.

root@openwrt:~# logger -t dnsmasq "HERE BEFORE PBR RESTART"

Immediately apply config change to pbr:

Apr 16 18:51:26 openwrt dnsmasq[29774]: HERE BEFORE PBR RESTART
Apr 16 18:51:30 openwrt pbr[29851]: [29799]: Forwarding is disabled
Apr 16 18:51:31 openwrt pbr[30130]: [29799]: Using uplink interface (on_start): wan [✓]
Apr 16 18:51:31 openwrt pbr[30135]: [29799]: Found uplink gateway (on_start): [redacted] [✓]
Apr 16 18:51:31 openwrt pbr[30453]: [29799]: Processing environment (on_start) [✓]
Apr 16 18:51:31 openwrt pbr[30553]: [29799]: Setting up routing for 'wan/eth1/[redacted]' [✓]
Apr 16 18:51:32 openwrt pbr[30648]: [29799]: Setting up routing for 'wan2/eth0/[redacted]' [✓]
Apr 16 18:51:32 openwrt pbr[30751]: [29799]: Setting up routing for 'wg0/[redacted]' [✓]
Apr 16 18:51:32 openwrt pbr[30854]: [29799]: Setting up routing for 'wg1/[redacted]' [✓]
Apr 16 18:51:32 openwrt pbr[31045]: [29799]: Routing 'repro_test' via wg0 [✓]
Apr 16 18:51:32 openwrt pbr[31056]: [29799]: Installing fw4 nft file [✓]
Apr 16 18:51:32 openwrt pbr[31096]: [29799]: Setting interface trigger for wan [✓]
Apr 16 18:51:32 openwrt pbr[31103]: [29799]: Setting interface trigger for wan2 [✓]
Apr 16 18:51:32 openwrt pbr[31110]: [29799]: Setting interface trigger for wg0 [✓]
Apr 16 18:51:32 openwrt pbr[31117]: [29799]: Setting interface trigger for wg1 [✓]
Apr 16 18:51:32 openwrt pbr[31129]: [29799]: pbr dev-test monitoring interfaces: wan wan2 wg0 wg1
Apr 16 18:51:32 openwrt pbr[31166]: [29799]: Forwarding is enabled
Apr 16 18:51:32 openwrt dnsmasq[27748]: exiting on receipt of SIGTERM
Apr 16 18:51:36 openwrt pbr[31560]: [29799]: Restarting dnsmasq [✓]
Apr 16 18:51:36 openwrt pbr[31569]: [29799]: pbr dev-test started with gateways:
wan/eth1/[redacted] [✓]
wan2/eth0/[redacted]
wg0/[redacted]
wg1/[redacted]
Apr 16 18:51:36 openwrt dnsmasq[31545]: started, version 2.91 cachesize 1000