What's new

AdBlocking with combined hosts file

  • 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!

The problem is none of the above. You need to look at your PC and find out how/why it's getting the wrong DNS server address. Have you set it manually?

This PC is configured to get 192.168.1.111 from the router. I do see in the tables 8.8.8.8 for primary DNS and 8.8.4.4 for alt. This is my problem?
 
I changed to obtain DNS server address automatically, flushed dns, cleared browser cache,rebooted and it works!! Thank you very much to all that helped me through the process, I did take notes.
 
I'm currently using the advanced method but there are still advertisements being missed that I want blocked, how do I go about adding those extra addresses in without losing them after a reboot?
 
I'm currently using the advanced method but there are still advertisements being missed that I want blocked, how do I go about adding those extra addresses in without losing them after a reboot?
Thats what the blacklist does in your chosen method. Read that part again.
 
Hi thelonelycoder,

I'm just curious about something in post #1, the advanced method.

Here is the code for /jffs/scripts/services-start:
Code:
sleep 10
cru a UpdateHosts "00 00 * * 5 /jffs/scripts/update-hosts.sh"

#!/bin/bash
sleep 5
source  /jffs/scripts/update-hosts.sh

I'm wondering what the point of "#!/bin/bash" is. bash isn't installed by default, and because it isn't on line 1 will be treated as a comment. So it seems pointless.

Am I missing something subtle?
 
Am I missing something subtle?
A subtle reminder to be careful when copy-pasting content from various sources perhaps?
Removed. Thanks Colin.
 
On that bit of services-start, it might be better to run the update script only if hosts.blocked doesn't exist, and leave the updating to the chron job. Sounds like you are going that direction with the automated script.
 
On that bit of services-start, it might be better to run the update script only if hosts.blocked doesn't exist, and leave the updating to the chron job. Sounds like you are going that direction with the automated script.
I have that update at startup long since omitted on my router as it eats up too many resources during boot. But since I have no idea where the files are stored on other systems I can't just add a check now to the tutorial without doing a search of the file on the router. Too much hassle.

With the difficulties some of the users had installing this simple method I decided a few weeks ago to automate it. I am about 60% done with what I want for the first release. Beta testing will start as soon as all components work. Stay tuned...
 
I have that update at startup long since omitted on my router as it eats up too many resources during boot. But since I have no idea where the files are stored on other systems I can't just add a check now to the tutorial without doing a search of the file on the router. Too much hassle.
Ah, yes. Maybe, though, you leave it out of the startup script, but run update.hosts as a last step of the install script to create the file, leaving updates to the cron.
 
i need some help getting this working ---- i edditd the original script from /tmp/mnt/sda1 to sda because it doesn't list my usb as sda1

Jul 31 17:00:20 custom config: Appending content of /jffs/configs/dnsmasq.conf.add.
Jul 31 17:00:20 dnsmasq[436]: warning: interface ppp1* does not currently exist
Jul 31 17:00:20 dnsmasq[436]: failed to load names from /tmp/mnt/sda/hosts/blacklist.txt: No such file or directory --i double checked and its there, i made an empty file named blacklist.txt
Jul 31 17:00:20 dnsmasq[436]: failed to load names from /tmp/mnt/sda/hosts/hosts.blocked: No such file or directory -- i dont see any instructions of manually making this file, since i dont know what its supposed to contain, i didnt create it myself

Jul 31 17:00:23 custom script: Running /jffs/scripts/services-start
Jul 31 17:00:23 dnsmasq[436]: failed to load names from /tmp/mnt/sda/hosts/blacklist.txt: No such file or directory
Jul 31 17:00:23 dnsmasq[436]: failed to load names from /tmp/mnt/sda/hosts/hosts.blocked: No such file or directory

Jul 31 17:00:24 rc_service: udhcpc 522:notify_rc start_firewall
Jul 31 17:00:24 dnsmasq[436]: failed to load names from /tmp/mnt/sda/hosts/blacklist.txt: No such file or directory
Jul 31 17:00:24 dnsmasq[436]: failed to load names from /tmp/mnt/sda/hosts/hosts.blocked: No such file or directory

Jul 31 17:00:28 usb: USB vfat fs at /dev/sda mounted on /tmp/mnt/sda.

any help is appreciated
 
The "no such file" messages are because the drive isn't mounted yet. I put mine in post-mount.

To be clearer, when dnsmasq restarts, it reads in the hosts file, which is on the thumb drive. In post #1, for the advanced method, the restart command is in the services-start script. I find that is too early, before the drive is mounted, so my services-start script only has the line to set up the chron job. I've moved the restart dnsmasq line to the post-mount script, so it is called after the drive mounts.

And, I only run the update-hosts script as part of the chron job, not in services-start.

You don't need Entware, so if this is all you have, services-start just sets up the chron job, and post-mount just has the restartline (plus the shebangs to start).
 
Last edited:
how do I put it as a post mount? i am reading thru the thread, and it shows to do a post mount with entware... i dont have entware installed...i did the advanced method


so i did the standard method and it seems to work fine

weird
 
Last edited:
This is amazing, and something that all routers need.
Can this not be added to the firmware?

Who wouldn't want a nice simple easy way to enable this in the GUI?

I am a bit hesitant to get this going with all the command line stuff.

*EDIT* Also I have to run my router with a usb stick in it now all the time to use this?
Also do I need to do anything to the usb stick before plugging it into the router?
Format it with a specific partition system?

Sorry I have just started to use Merlin's firmware and not ever tinkered with my router, so help would be awesome :)
 
Last edited:
Can anyone help with my questions above?

You have to be patient. ;)

And use search.

RMerlin has already stated that he will not implement any form of Adblocking for respect to this site's owner.
 
> Jul 31 17:00:20 dnsmasq[436]: failed to load names from /tmp/mnt/sda/hosts/blacklist.txt: No such file ordirectory

Make sure you've got your path correct. You say your using sda1, but the log says it's looking for the file in sda.
 
Not sure about that TLC. He snips this from his log eight seconds later:

Jul 31 17:00:28 usb: USB vfat fs at /dev/sda mounted on /tmp/mnt/sda.

So his thumb drive is sda. And the July 31 stamp looks like it is before the time sync, so it is early in the process.
 
Similar threads

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!
Top