dnsmasq settings get overwritten at restart

I’ve tried to setup the DNS forwardings option via LuCi, as shown in the picture:

This way, all the requests for my local services (that are behind the domain mydomain.xyz in this example) is handled by a pihole istance hosted at 192.168.8.110. This solution works perfectly, even after i activate the Override DNS Settings of All Clients option under DNS.

However, when the router is restarted, the option is lost! To my understanding, after looking at the scripts run by the router at startup, it seems that the dnsmasq.conf files get re-build at startup and so this setting from the LuCi interface is overwritten.

The router i’m using is a Flint 2.

Is there a way to set this option and keep it after restart?

1 Like

Maybe use the startup script option in System - startup - local startup and add something like that before the exit 0.

(…)

uci add dhcp domain
uci set dhcp.@domain[-1].name='mydomain.xyz'
uci set dhcp.@domain[-1].ip='192.168.8.110'
uci commit dhcp
/etc/init.d/dnsmasq restart

exit 0

so after reading your answer I think the right commands for what i need are:

uci add_list dhcp.wgclient1.server="/mydomain.xyz/192.168.8.110"
uci commit dhcp
service dnsmasq restart

if i run them in the terminal, the right parameter gets set and everything works as i wish.

However, when i set them in the local startup script, they dont take effects! they are again overwritten by some other startup script.

My suspect is the script init.d/init-dnsmasq-conf

Hi

The startup script for the VPN client is /etc/init.d/vpn-client.

You might consider adding your command after it.

#!/bin/sh /etc/rc.common

START=95

start() {
    rtp2.sh

    sleep 10
    uci add_list dhcp.wgclient1.server="/mydomain.xyz/192.168.8.110"
    uci commit dhcp
    service dnsmasq restart

}
1 Like