What
@Adamm did was update the installer script with a prompt to ask the user if you want to force LAN clients to use Stubby DNS. The instructions to manually add the lines to firewall-start were removed from the README.md since the script has been updated to add this feature. If you chose yes, the line
sh /jffs/scripts/install_stubby.sh iptables is placed inside of nat-start. Whenever nat-start is called, the line will run install_stubby.sh and pass the parameter
iptables. If install_stubby.sh detects it was called using the
iptables parameter, the script will issue the following iptables commands to force lan clients to use Stubby:
Code:
iptables -t nat -D PREROUTING -i br0 -p udp --dport 53 -j DNAT --to "$(nvram get lan_ipaddr)" 2>/dev/null
iptables -t nat -D PREROUTING -i br0 -p tcp --dport 53 -j DNAT --to "$(nvram get lan_ipaddr)" 2>/dev/null
iptables -t nat -A PREROUTING -i br0 -p udp --dport 53 -j DNAT --to "$(nvram get lan_ipaddr)" 2>/dev/null
iptables -t nat -A PREROUTING -i br0 -p tcp --dport 53 -j DNAT --to "$(nvram get lan_ipaddr)" 2>/dev/nul
I know OpenVPN up/down events call nat-start. That is why I initially recommended placing in firewall-start. But there are also events that can cause firewall-start to be invoked when I looked at the system log file. I don't have a good reason at this time to say firewall-start or nat-start is a better place to place the rules. The -D lines will purge any existing rules that exist to prevent duplicate rules from being created. So, that is probably why you see more messages in the system log file. Perhaps the log message can be revised to make it clear when the install_stubby.sh script is run when called from nat-start vs when run from a command line. Thinking out loud on this one.