Dnsmasq very chatty

  • I see "warn" not "error."
  • BTW, DHCPv6 is ran by odhcpd (as you can see); not dnsmasq.
  • Also, since I don't see DHCP leases, I would say you successfully suppressed the logging.

Can you show us this config?

  • What errors?
  • Also, is this the result of reloading dnsmasq; and if so, for what reasons are you reloading?

Sorry, I meant 'warn' rather than error. I wouldn't expect a DHCP routine solicit/request/release action to trigger a 'warn'.

I'm not reloading dnsmasq so perhaps there is something wrong here.

/etc/init.d/dnsmasq restart

It was changed to use "LOG_NOTICE" since 2019-04-16. What's your OpenWrt version?

There is a script /usr/sbin/odhcpd-update that can cause SIGHUP to be sent to dnsmasq. Dnsmasq will kill cache and reload. odhcpd-update . This was controlled by uci option dhcp.odhcpd.leasetrigger

1 Like

I rebooted the router last night to make sure it wasn't something transient. This morning the log file is completely full, just those messages repeated, over and over.

I'm on OpenWrt 18.06.2 r7676-cddd7b4c77

config odhcpd 'odhcpd'
	option maindhcp '0'
	option leasefile '/tmp/hosts/odhcpd'
	option leasetrigger '/usr/sbin/odhcpd-update'
	option loglevel '4'
config dnsmasq
	option domainneeded '1'
	option localise_queries '1'
	option rebind_protection '1'
	option rebind_localhost '1'
	option local '/lan/'
	option domain 'lan'
	option expandhosts '1'
	option authoritative '1'
	option readethers '1'
	option leasefile '/tmp/dhcp.leases'
	option resolvfile '/tmp/resolv.conf.auto'
	option nonwildcard '1'
	option localservice '1'
	option quietdhcp '1'

Is there something unusual about that DHCPv6 client? The files are getting reloaded immediately after DHCPv6 packets from that client.

It's a long standing thing with dnsmasq and IPv6: some devices trigger a reload of dnsmasq. I see this every time my PS4 powers up and shuts down.

I posted about it recently: Dnsmasq restart

2 Likes

Thanks! Interesting that the bug report has been open for a year and hasn't even been commented on.

I would think (assuming the config reload is a required, benign and not exploitable through DoS) the fix would be to have these messages suppressed by the UCI 'quietdhcp' flag. I would certainly not call this behaviour 'quiet' it makes trying to trace actual problems in the log very difficult.

Yes, as I noted in my posted: I'm using a pretty large adblock list, so the system load during the reload is not insignificant and /could/ be used as a DoS attack :thinking:

I've updated the Bug report with a comment... maybe it will bump it up and get some attention.

It is strange that only certain DHCPv6 clients trigger this behavior (and resulting 'Warn' level log entries for odhcp)

1 Like

2 ways to get around this

  • use only 1 dhcp server for both v4 and v6 instead of the mix
  • deploy syslog-ng to filter those.

I am seeing the same "odhcpd" messages in my system, but they do not trigger a "dnsmasq" reload.

I do not have a "config odhcpd 'odhcpd'" section at "/etc/config/dhcp" (do I need one?), and browsing the contents of "/usr/sbin/odhcpd-update", I see a suspicious "procd_send_signal dnsmasq" command there.

1 Like

I must admit to not knowing the internals of DHCP on linux all that well, particularly for IPv6. I'm running davidc502's build for WRT32X and with IPv6 enabled it seems to be the standard config to dnsmasq and odhcpd both running and I have the " config odhcpd 'odhcpd' " entry in my " /etc/config/dhcp "

If it's possible to do v4 and v6 DHCP from the same daemon, it would make sense to do so, I imagine!

Are you sure you don't have an odhcp section? Mine was way down the file, mixed in with static IP reservations for some reason.

Contents of that script are the same for me.

So my understanding is that dnsmasq was the 'original' combined DNS and DHCP server for OpenWRT because it had a smaller footprint than odhcp. However odhcp was introduced to allow DHCPv6 support.

Was there any logic to the decision of keeping dnsmasq doing DHCP(v4) instead of moving it all to odhcp?

Well, dnsmasq also (primarily?) handles DNS and RA, of course, so those functions would need to be replaced, too, if you wanted rid of dnsmasq :thinking:

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

There is a guide here on how to make dnsmasq do DNS/RA only and setup odhcp to service DHCPv4 and DHCPv6

edit - well actually they are two separate guides, one on disabling dnsmasq's DHCP function and one on removing dnsmasq and installing odhcp for DHCPv4 and v6. With a bit of mix and match it should be possible to have dnsmasq do DNS only and odhcp do all DHCP.

I can't try this right now, but generally it should go...

uci set dhcp.lan.ignore="1"
uci commit dhcp
service dnsmasq restart
service odhcpd restart

Then

opkg update
opkg remove odhcpd-ipv6only
opkg install odhcpd
uci set dhcp.lan.dhcpv4="server"
uci set dhcp.odhcpd.maindhcp="1"
uci commit dhcp
service odhcpd restart
2 Likes

On my node unbound handles DNS and odhcpd dhcp4/6 with one


dnsmasq can also handle dhcp6 if you prefer to get rid of odhcpd.

How can you make dnsmasq do DHCPv6? If this is possible, why did OpenWRT end up with this weird hybrid model with dnsmasq and odhcp?

perhaps there are some (performance?) benefits to deploy odhcpd for downstream dhcp6. Notwithstanding odhcp6c handling upstream dhcp6.


else web search https://hveem.no/using-dnsmasq-for-dhcpv6

Mainly because dnsmasq does not allow for dynamic IPv6 prefix management. You either need to let it handle everything autonomously, breaking many system integrations or you have to frequently pregenerate updated configs for it and restart the process, leading to a loss of state.

4 Likes