Autostart Stubby Using Monit

Hi All,

I'm wondering if anyone could help me achieving this relatively easy to do task.
Thing is that for some odd reason Stubby will crash and not start again, or even if one wireless interface is off, Stubby can also stop, even better, rebooting the router will not start Stubby up for some reason, and manual reload is needed.

I've installed Monit, in order to achieve the monitoring and reloading of Stubby, but I'm stuck on the actual configs. What am I supposed to monitor to notice the crash? 127.0.0.1 on port 5354?
My DNS is set to 127.0.0.1#5354
Currently this is what I have in monitrc for Stubby:

check process stubby with pidfile /var/run/stubby.pid
start program = "/etc/init.d/stubby start"
stop program = "/etc/init.d/stubby stop"

The rest is unknown for me, anyone had this issue before, or could assist in setting up Monit?:slight_smile:

Thanks in advance,
Mark

uci show dhcp

Add that to the config and run Monit?

No, post the output here for diagnostics.

Gotcha

You shouldn't push external DNS servers for LAN clients, it may result in DNS leak.

1 Like

Gotcha, I’ll stop that.Thank you! What about running Monit to restart Stubby in case of a crash? :slight_smile:

There should be no issues in the first place if Stubby is configured properly.
So, I recommend to continue the diagnostics:

cat /etc/resolv.conf

By the way, have you considered using cron as a workaround?

But how would I configure a cronjob to detect if Stubby is down?

You shouldn't have to -- First off, it shouldn't be crashing. Secondly, procd should be supervising it.

Using Stubby for local system is troublesome and may lead to race condition and deadlock state if there're services which depend on DNS at system startup such as Adblock.
You should not disable DNS on the WAN interface.

1 Like

Im using this for auto start stubby

#!/bin/sh

if [ "$ACTION" = "ifup" ]; then
sleep 5 && /etc/init.d/stubby restart &
fi

Put in /etc/hotplug.d/iface

3 Likes

Thank you for the suggestion!
Maybe I should just reconfigure everything and start off the config as brand new to overrule these issues. I've probably enabled way too much crap which I shouldnt need.