Dnsmasq - no external conf files?

I'm trying to use the conf-file option in dnsmasq. I also tried conf-dir. Neither of them work. I don't know if there are log files to look for errors but the options from my file are never loaded.

Edit:

To clarify, I am using OpenWrt 23.05.0 and /etc/dnsmasq.conf for the options.

The correct option is confdir, e.g. option confdir '/etc/dnsmasq.d' (default is /tmp/dnsmasq.d). You can also use /etc/dnsmasq.conf to add custom options using the native dnsmasq syntax.

https://openwrt.org/docs/guide-user/base-system/dhcp#all_options

5 Likes

Thanks. I should have specified that I'm using /etc/dnsmasq.conf. In that case, the option should be conf-dir but it doesn't work.

Also, the official docs for dnsmasq allow for conf-file but I don't see that on the OpenWRT page you linked to.

Multiple files may be specified by repeating the option [conf-dir] either on the command line or in configuration files.

Is it different in OpenWRT? If I run dnsmasq --help, I see both --conf-file and --conf-dir.

OpemWrt configures dnsmasq to use any text file you put in the /tmp/dnsmasq.d directory as a conf file (except files which have their name start with . and some additional exceptions). So you could simply put your conf files there, issue the /etc/init.d/dnsmasq restart command, and voila.

1 Like