Dnsmasq restarts with all settings lost

Post new topic   Reply to topic    DD-WRT Forum Index -> General Questions
Author Message
jujo_si
DD-WRT Novice


Joined: 21 Mar 2017
Posts: 10

PostPosted: Tue Mar 21, 2017 12:03    Post subject: Dnsmasq restarts with all settings lost Reply with quote
Hello,

I am doing the Ad-Blocking in DDWRT using a script in Administration>Commands>Firewall

After router is rebooted and/or
after I run the script, so I run /tmp/.rc_firewall, I get

root@Bambi:~# ps | grep dns
1069 root 1256 S inadyn -u USER_ID -p USER_PASSWORD --input_file /tmp/ddns/
2684 nobody 1972 S /usr/sbin/dnsmasq --conf-file=/tmp/dnsmasq.conf
2743 root 1116 S grep dns


And all Ad blocking works. But after 30 minutes if I check again I get


root@Bambi:~# ps | grep dns
1069 root 1256 S inadyn -u jujo_si -p alabama --input_file /tmp/ddns/
2785 root 1136 S dnsmasq -u root -g root --conf-file=/tmp/dnsmasq.con
3154 root 1116 S grep dns
root@Bambi:~#

It may happen in 30 minutes or may happen in a few hours, but very often when I check in the morning my Ad blocking doesn't work.

So somebody is killing my /usr/sbin/dnsmasq and is starting a new command which doesn't have my custom Ad blocking settings anymore.
Who is killing my /usr/sbin/dnsmasq and how to prevent this?

Why is the user nobody and not root, I did start the script as root?

My Firewall script is like this:

Code:

#!/bin/sh
logger WAN up script executing

     
logger Downloading http://www.mvps.org/winhelp2002/hosts.txt
echo "Downloading http://www.mvps.org/winhelp2002/hosts.txt"
wget -O - http://www.mvps.org/winhelp2002/hosts.txt | grep 0.0.0.0 |
      sed 's/[[:space:]]*#.*$//g;' |
      grep -v localhost | tr ' ' '\t' |
      tr -s '\t' | tr -d '\015' | sort -u >/tmp/hosts1

if [[ -s /tmp/hosts1 ]]; then
   logger Success downloading file
   echo "Success downloading file"

   echo "0.0.0.0 ads.youtube.com" >> /tmp/hosts1
   echo "0.0.0.0 s0.2mdn.net" >> /tmp/hosts1
   echo "0.0.0.0 s1.2mdn.net" >> /tmp/hosts1
   echo "0.0.0.0 googleads.g.doubleclick.net" >> /tmp/hosts1
   echo "0.0.0.0 pubads.g.doubleclick.net" >> /tmp/hosts1
   echo "0.0.0.0 ad.doubleclick.net" >> /tmp/hosts1
   echo "0.0.0.0 static.doubleclick.net" >> /tmp/hosts1

   mv /tmp/hosts1 /tmp/hosts0
fi

      
grep addn-hosts /tmp/dnsmasq.conf ||
echo "addn-hosts=/tmp/hosts0" >>/tmp/dnsmasq.conf
grep address=/ /tmp/dnsmasq.conf ||
echo -e "address=/applovin.com/0.0.0.0\n\
address=/adcolony.com/0.0.0.0\n\
address=/unity3d.com/0.0.0.0\n\
address=/chartboost.com/0.0.0.0\n\
address=/vungle.com/0.0.0.0\n\
address=/inmobi.com/0.0.0.0\n\
address=/appnext.com/0.0.0.0\n\
address=/mobilecore.com/0.0.0.0\n\
address=/mopub.com/0.0.0.0\n\
address=/revmobmobileadnetwork.com/0.0.0.0\n\
address=/revmob.com/0.0.0.0\n\
address=/playhaven.com/0.0.0.0\n\
address=/leadbolt.com/0.0.0.0\n\
address=/mopub.com/0.0.0.0\n\
address=/admob.com/0.0.0.0\n\
address=/applifier.com/0.0.0.0\n\
address=/gameanalytics.com/0.0.0.0\n\
address=/supersonic.com/0.0.0.0\n\
address=/supersonicads.com/0.0.0.0\n\
# address=/graph.facebook.com/0.0.0.0\n\
address=/airpush.com/0.0.0.0\n\
address=/mydas.mobi/0.0.0.0\n\
address=/mobfox.com/0.0.0.0\n\
address=/millennialmedia.com/0.0.0.0\n\
address=/smaato.net/0.0.0.0\n\
address=/flurry.com/0.0.0.0\n\
address=/manage.com/0.0.0.0\n\
address=/realzeit.io/0.0.0.0\n\
address=/startapp.com/0.0.0.0" >>/tmp/dnsmasq.conf
   logger Restarting dnsmasq
   echo "Restarting dnsmasq"
   killall dnsmasq
/usr/sbin/dnsmasq --conf-file=/tmp/dnsmasq.conf
   
Sponsor
h8red
DD-WRT Guru


Joined: 28 Jun 2011
Posts: 580
Location: Vilnius, Lithuania

PostPosted: Mon Mar 27, 2017 15:03    Post subject: Re: Dnsmasq restarts with all settings lost Reply with quote
jujo_si wrote:
killall dnsmasq
/usr/sbin/dnsmasq --conf-file=/tmp/dnsmasq.conf
Code:
killall -HUP dnsmasq

Better way to restart service IMO (if config file is default)

_________________
[Ramips] Nexx WT3020F Openwrt @kernel #4.14.167 (OpenVPN server, Wireguard server, AD blocking, SQM QOS, USB)
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> General Questions All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum