What's new

Testing adblock install

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

gatorback

Regular Contributor
I am interested in tests that can diagnose the 'advance method' adblock procedure:

http://www.snbforums.com/threads/adblocking-with-combined-hosts-file.15309/

Per the procedure, these files were installed:

Code:
root@ROUTER:/tmp/home/root# ls -l /jffs/scripts/services-start
-rwxr-xr-x    1 root  root           141 Oct 13 23:49
/jffs/scripts/services-start
root@ROUTER:/tmp/home/root# ls -l /jffs/configs/dnsmasq.conf.add
-rw-r--r--    1 root  root           168 Oct 13 23:52
/jffs/configs/dnsmasq.conf.add
root@ROUTER:/tmp/home/root# ls -l  /jffs/scripts/update-hosts.sh
-rwxr-xr-x    1 root  root           946 Oct 13 23:54
/jffs/scripts/update-hosts.sh
root@ROUTER:/tmp/home/root# ls -l  /tmp/mnt/sda1/hosts/whitelist.txt
-rw-rw-rw-    1 root  root            11 Oct 14 00:07
/tmp/mnt/sda1/hosts/whitelist.txt
root@ROUTER:/tmp/home/root# ls -l  /tmp/mnt/sda1/hosts/blacklist.txt
-rw-rw-rw-    1 root  root             0 Oct 14 00:07
/tmp/mnt/sda1/hosts/blacklist.txt

root@ROUTER:/tmp/home/root# ls -l /jffs/configs/dnsmasq.conf.add
-rw-r--r--    1 root  root           168 Oct 13 23:52

The last entry, dnsmasq.conf.add is not executable so I added execute permissions and restarted the dnsmasq service:

Code:
root@ROUTER:/tmp/home/root# chmod 755 /jffs/configs/dnsmasq.conf.add
root@ROUTER:/tmp/home/root# ls -l /jffs/configs/dnsmasq.conf.add
-rwxr-xr-x  1 root  root  168 Oct 13 23:52
/jffs/configs/dnsmasq.conf.add
root@ROUTER:/tmp/home/root# service restart_dnsmasq

I flushed the DNS cache in my win7 box:
Code:
ipconfig  /flushdns

I assume that the blocked sites are listed here and are redirected 0.0.0.0

Code:
tail -n 11 /tmp/mnt/sda1/hosts/hosts.blocked

ping or nslookup did not resolve to 0.0.0.0 I did reboot the device however, no improvement.

Diagnostic Questions
1) Is my expectation of nslookup or ping resolving to 0.0.0.0 correct?
2) Is there a command that can verify that dnsmasq.conf.add has entered the hosts.blocked entries to the DNS memory table? Maybe there is a command to display what is in the DNS memory table?
3) Are there any other diagnostics that can be performed to isolate / identify the issue?
4) Is there any other info I can provide?

Thank you for actionable and constructive suggestions.
 
Last edited:
The last entry, dnsmasq.conf.add is not executable so I added execute permissions and restarted the dnsmasq service:
Only files in /jffs/scripts need that permission. No need to make files in /jffs/configs/ executable.
 
2) Is there a command that can verify that dnsmasq.conf.add has entered the hosts.blocked entries to the DNS memory table? Maybe there is a command to display what is in the DNS memory table?
Just restart dnsmasq and look at the log. It says something like this:
Code:
Oct  9 23:23:01 dnsmasq[908]: read /etc/hosts - 5 addresses
Oct  9 23:23:01 dnsmasq[908]: read /tmp/mnt/sda1/hosts/blacklist.txt - 51 addresses
Oct  9 23:23:07 dnsmasq[908]: read /tmp/mnt/sda1/hosts/hosts.blocked.txt - [a lot of] addresses
Oct  9 23:23:07 dnsmasq[908]: read /etc/hosts.dnsmasq - 4 addresses
 
You may need to run update.hosts.sh first to create hosts.blocked.txt
 
@thelonelycoder : Thanks for commenting and providing the excellent diagnostic example. I'm sure that other students will benefit from this. I have found that when testing does not go as expected rebooting the router can (sometimes) save a lot of time and advance to the finish line.

Recent changes include:

1) Change Merlin Firmware Setting:
Code:
Administration -> Setting ->"Enable JFFS custom scripts and configs'  = yes

It is unclear to me if this setting was preventing /tmp/mnt/sda1/hosts/hosts.blocked from being read into memory. Any insight is appreciated.

2) restart dnsmasq
Code:
root@ROUTER:/tmp# service restart_dnsmasq
root@ROUTER:/tmp# tail -n 20 /tmp/syslog.log
Oct 14 15:17:03 rc_service: service 7511:notify_rc restart_dnsmasq
Oct 14 15:17:03 dnsmasq[485]: exiting on receipt of SIGTERM
Oct 14 15:17:03 custom config: Appending content of /jffs/configs/dnsmasq.conf.add.
Oct 14 15:17:04 dnsmasq[7515]: started, version 2.73rc9 cachesize 1500
Oct 14 15:17:04 dnsmasq[7515]: warning: interface ppp1* does not currently exist
Oct 14 15:17:04 dnsmasq[7515]: asynchronous logging enabled, queue limit is 5 messages
Oct 14 15:17:04 dnsmasq-dhcp[7515]: DHCP, IP range 192.168.8.230 -- 192.168.8.254, lease time 1d
Oct 14 15:17:04 dnsmasq[7515]: using local addresses only for domain T-mobile.com
Oct 14 15:17:04 dnsmasq[7515]: read /etc/hosts - 5 addresses
Oct 14 15:17:04 dnsmasq[7515]: read /tmp/mnt/sda1/hosts/blacklist.txt - 0 addresses
Oct 14 15:17:04 dnsmasq[7515]: read /tmp/mnt/sda1/hosts/hosts.blocked - 71886 addresses
Oct 14 15:17:04 dnsmasq[7515]: read /etc/hosts.dnsmasq - 4 addresses
Oct 14 15:17:04 dnsmasq-dhcp[7515]: read /etc/ethers - 4 addresses
Oct 14 15:17:04 dnsmasq[7515]: using nameserver 209.18.47.62#53 for domain local
Oct 14 15:17:04 dnsmasq[7515]: using nameserver 209.18.47.62#53 for domain nyc.rr.com
Oct 14 15:17:04 dnsmasq[7515]: using nameserver 209.18.47.61#53 for domain local
Oct 14 15:17:04 dnsmasq[7515]: using nameserver 209.18.47.61#53 for domain nyc.rr.com
Oct 14 15:17:04 dnsmasq[7515]: using local addresses only for domain T-mobile.com
Oct 14 15:17:04 dnsmasq[7515]: using nameserver 209.18.47.61#53
Oct 14 15:17:04 dnsmasq[7515]: using nameserver 209.18.47.62#53

This was the first time I could find an instance of:

Oct 14 15:17:04 dnsmasq[7515]: read /tmp/mnt/sda1/hosts/hosts.blocked - 71886 addresses

I accept this log as an indicator that the blocked hosts are loaded into memory. I am assuming that these addresses are read into RAM: if this is true, I wonder if this a command to list these addresses to the command console?

Testing from the router command-line indicates success:
Code:
root@ROUTER:/tmp# nslookup zs.dhl.de
Server:  127.0.0.1
Address 1: 127.0.0.1 localhost.localdomain
Name:  zs.dhl.de
Address 1: 0.0.0.0 0.0.0.0

root@ROUTER:/tmp# nslookup zz.zeroredirect1.com
Server:  127.0.0.1
Address 1: 127.0.0.1 localhost.localdomain
Name:  zz.zeroredirect1.com
Address 1: 0.0.0.0 0.0.0.0

root@ROUTER:/tmp# ping  zz.zeroredirect1.com
PING zz.zeroredirect1.com (0.0.0.0): 56 data bytes
64 bytes from 127.0.0.1: seq=0 ttl=64 time=0.303 ms
64 bytes from 127.0.0.1: seq=1 ttl=64 time=0.168 ms
 
Last edited:
1) Change Merlin Firmware Setting
This is in the instructions, please read again.

The rest looks good to me and the scripts do the job. Problem solved.
 

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!

Members online

Top