What's new

ad blocking on the router

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

new HOSTS resource

The ad blocking method from tutorial is based on hosts blacklist. I'll describe how to do it, but IMHO, it's a simplest and worst one. Later I tell you why.

You'll need to create two files. A first one is /jffs/scripts/wan-start:

The second one is /jffs/configs/dnsmasq.conf.add with this content:

Make first one executable:

and reboot router.

here is a fresh one to use, including YouTube commercials blocking:

http://hosts.eladkarako.com/hosts.txt
 
So my question is, is what is causing the functions to fail downloading the country lists?

EDIT: ipdeny.com also is offering aggregated zones, is there a good way to incorporate that? I would assume just changing the script file to be '$country'-aggregate.zone would suffice?

The script runs fine on my router. Their server may have been down when you were testing.
Your suggestion for aggregate zones is fine.

I cleaned up the loading of the ipset modules in the code below;

Code:
# load ipset modules
for module in ip_set ip_set_nethash ip_set_iphash ipt_set
do
   if ! `/sbin/lsmod | /bin/grep -q "^$module "`; then
      /sbin/insmod $module
      if [ "$?" -ne 0 ]; then
         exit 1
      fi
   fi
done
 
dsuck is a small DNS server, that returns NXDOMAIN answer for blacklisted sites, so browser/OS will not wait for answer from blocked hosts. It's main advantage over DD-WRT solution.

Requirements to run adsuck are:
  • Asuswrt-Merlin driven RT-N16/RT-N66U/RT-AC66U router with USB-drive and jffs partition enabled.
  • Working Entware environment. Please, refer HOW-TO for details.

Installation:
  • Install adsuck package:
  • copy provider's DNS list to adsuck folder:
  • choose what type of sites you want to filter, all filter files is in the /opt/etc/adsuck/Hosts.*:
    • Hosts.blc - 1916 sites anti-phishing white list,
    • Hosts.mis - 566350 other potential dangerous sites (drugs, sects, spam, traps, violence)
    • Hosts.pub - 106338 advert. sites,
    • Hosts.rsk - 120033 sites with potencial dangerous contents, viruses mostly,
    • Hosts.sex - 905497 adult content sites,
    • Hosts.trc - 46584 anti tracker/counters list.
  • let adsuck to run at boot time:
and reboot router. In example, i've added three filters: Hosts.pub + Hosts.sex + Hosts.trc which gives over a million hosts to be blacklisted.

Feel free to ask any details you want to know!

I am going to have to give this a try, Thank you so much for this, I also used your Entware and Transmission guides WOW just amazing!!!
 
Hmm strange when I want to download this list on router I get:
Code:
admin@RT-AC68U:/tmp# wget http://hosts.eladkarako.com/hosts.txt
Connecting to hosts.eladkarako.com (118.139.185.1:80)
wget: server returned error: HTTP/1.1 403 Forbidden

specify a user agent, add:
--user-agent="I am a router" or something..

I block spiders by default,
but its easy to override (you have my permission :) )
 
First post!

I've been reading these forums for several weeks. I appreciate all that I learned here. Many questions I might have asked were answered by others. After learning all I could, I purchased two routers: a refurbished Netgear WNR3500L(v2) loaded with Shibby Tomato, and an ASUS RT-N66U which I loaded with ASUSWRT-Merlin 376.49_2. I applied Entware via a 8GB USB stick. I love ASUSWRT-Merlin! I add my voice to many others who say thank you to Eric (RMerlin) for all his hard work. I plan on donating through his web page very soon.

Eric wrote that he plans on reducing the number of new features going forward. My though, as a new ASUSWRT user, is that Ad Blocking On The Router is killer feature that lots of people might like, however line-level installation and maintenance is beyond the reach of many users. Wouldn't this be a compelling feature in a future ASUSWRT web GUI?

I am not trying to thread hijack here so much as learn how others feel about Ad Blocking as it now stands, versus coding it in the GUI.
 
Eric wrote that he plans on reducing the number of new features going forward. My though, as a new ASUSWRT user, is that Ad Blocking On The Router is killer feature that lots of people might like, however line-level installation and maintenance is beyond the reach of many users. Wouldn't this be a compelling feature in a future ASUSWRT web GUI?
RMerlin already said earlier in this thread and elsewhere on the forum that he won't add ad-blocking to his firmware. One reason being that this forum only exists because of the Ads.
 
RMerlin already said earlier in this thread and elsewhere on the forum that he won't add ad-blocking to his firmware. One reason being that this forum only exists because of the Ads.

Sorry, I read every page of this thread and I cannot see where he says that here nor in the sister thread:

http://forums.smallnetbuilder.com/showthread.php?t=9449

He may have written that somewhere, I don't doubt, but I never saw RMerlin's decision so clearly stated.

Could it be that Ad Blocking is not stable enough to move to the GUI? Reports of crashes needing router reboots, slowdowns on PCs, and the limitation of individual IP addresses in Privoxy all seems less than encouraging.

I wonder how ddWRT or Tomato firmware stack up against ASUSWRT with on-the-router ad blocking?
 
Sorry, I read every page of this thread and I cannot see where he says that here nor in the sister thread:

http://forums.smallnetbuilder.com/showthread.php?t=9449

He may have written that somewhere, I don't doubt, but I never saw RMerlin's decision so clearly stated.
The message tends to get lost in the noise of the forum, but it's a question that is frequently asked.

http://forums.smallnetbuilder.com/showpost.php?p=116906&postcount=218

http://forums.smallnetbuilder.com/showpost.php?p=62447&postcount=46
 
Thanks for the follow-up. Those posts are pretty definite. If the software is not stable enough, perhaps it is a good thing to keep ad-blocking out of the GUI.

Merlin keeps ryzhov_al's wiki, "How to use Adblock Plus filter subscriptions to provide advertisement filtering to devices," available on github for those who are interested. I am not sure I want to invest the hours needed to make it work and troubleshoot connectivity problems. As RMerlin often says about ASUSWRT, reliability trumps features.
 
Best ad blocking method with less performance impact?

Hi, is this procedure valid? now days what is the best way to block ads ? I already have entware installed, and using dnscrypt, I have read lots of posts, using privoxy, hosts, and adsuck, so I got a R66U, with the 378.50 Merlin, Entware and dnscrypt working, Thanks a lot for your help

dsuck is a small DNS server, that returns NXDOMAIN answer for blacklisted sites, so browser/OS will not wait for answer from blocked hosts. It's main advantage over DD-WRT solution.

Requirements to run adsuck are:
  • Asuswrt-Merlin driven RT-N16/RT-N66U/RT-AC66U router with USB-drive and jffs partition enabled.
  • Working Entware environment. Please, refer HOW-TO for details.

Installation:
  • Install adsuck package:
  • copy provider's DNS list to adsuck folder:
  • choose what type of sites you want to filter, all filter files is in the /opt/etc/adsuck/Hosts.*:
    • Hosts.blc - 1916 sites anti-phishing white list,
    • Hosts.mis - 566350 other potential dangerous sites (drugs, sects, spam, traps, violence)
    • Hosts.pub - 106338 advert. sites,
    • Hosts.rsk - 120033 sites with potencial dangerous contents, viruses mostly,
    • Hosts.sex - 905497 adult content sites,
    • Hosts.trc - 46584 anti tracker/counters list.
  • let adsuck to run at boot time:
and reboot router. In example, i've added three filters: Hosts.pub + Hosts.sex + Hosts.trc which gives over a million hosts to be blacklisted.

Feel free to ask any details you want to know!
 
something like this tutorial

is it possible to get some one to write a tutorial about how to do it on asuswrt-merlin as i dont know anything about linux commands or systems at all

or might it be possible to intergrate the function in the firmware so you only need to activate it if you want to use it

You mean post #1 in this thread is to difficult to follow? or this alternatve..

http://forums.smallnetbuilder.com/showthread.php?t=15309

and as RMerlin has previously stated, this extremely informative site relies on advertising, so no version of RMerlin's firmware will ever contain integrated adblocking.
 
and as RMerlin has previously stated, this extremely informative site relies on advertising, so no version of RMerlin's firmware will ever contain integrated adblocking.

None developed by me, at least...
 
hi

after reading all the posts in this thread I am actually a bit confused..

I'd love some ad-blocking on my ac66u.. but I am struggling between the different solutions suggested here....

which would be the best way to set up ad blocking on my router? meaning..which solution has the better performance etc. ?
 
You guys do know that SmallNetBuilder and these forums would not be possible without ad revenue?
 
You guys do know that SmallNetBuilder and these forums would not be possible without ad revenue?

Well said, Tim. And for that very reason this is one area RMerlin will not enter, as repeated earlier in this thread. I remember reading on Brian Krebs' website his interest in taking what he called "quality" ads. I'm using (limited) ad blocking via a Raspberry Pi attached to my Asus RT-AC68U but it struck me when I was setting it up, that there are quality ads, of the type I see here and on Krebs' site, and which could well be of interest to me, and there are the bad types that carry malware or drag you off to places you don't know you're being taken to. I'm happy to see the quality ads that make possible Krebs' site and wonderful forums like this one, because even if I don't buy what's on offer, the ad sometimes tell me something useful I didn't know beforehand.

I've recently been playing with Desktop Disconnect and Fiddler and had no idea just how many tracking connections there are on many websites as well as connections to other possible malware-dispensing websites.

Where possible, I think it helps to distinguish between quality ads and all these hidden connections and dodgy ads and not aim to block every ad in the ether, apart from the wasted effort through the law of diminishing returns.

Martin
 
Last edited:
I remember reading on Brian Krebs' website his interest in taking what he called "quality" ads

The AdBlock Plus plugin has a setting where some ads are allowed. Typically, that means non-intrusive ads such as those from AdWords are still allowed.

I think this shows that the core of the problem isn't the idea of advertisement itself. It's advertisers who started abusing the idea, totally TRASHING some websites in the process. Popovers that prevents you from even reading the web content until you locate the elusive (X) to close it, popup windows you have to hunt down on your desktop to close, flashing/animated "Punch the Monkey", ads with audio... Those have mostly (but not totally) disappeared by now, but the damage was done. A lot of people won't browse the web anymore unless they have some kind of ad blocker, which will typically block ALL of them.

A few years ago, there was an interesting article where someone took a few popular websites, and highlighted with coloured boxes the regions of a webpage devoted to the actual content, and those devoted to ads. Some were very reasonable, but others were as bad as having 2/3 of the webpage devoted strictly to ads, making it hard to actually use the content on the webpage.

Personally, I like the idea of having the worst cases blocked, but allowing through those that are reasonable. AdBlock Plus is taking an interesting (although slightly controversial) approach lately, by allowing some ad providers to pay for the right to be allowed through their default block rules, provided they also meet some guidelines. The idea of whitelisting those matching guidelines is nice, however what most people (like me) have a problem with is that there's money involved, which might make it seem like a racket. ("Pay us money, or else we'll have our millions of users block access to your ads!").

EDIT: Here are the rules AdBlock Plus applies to determine what counts as "acceptable":

https://adblockplus.org/en/acceptable-ads
 
Last edited:
The AdBlock Plus plugin has a setting where some ads are allowed. Typically, that means non-intrusive ads such as those from AdWords are still allowed.

I think this shows.........
.........EDIT: Here are the rules AdBlock Plus applies to determine what counts as "acceptable":

https://adblockplus.org/en/acceptable-ads

Thank you, Merlin. Very reassuring to read your views and analysis. as well as learning of the highly commendable attempts by AdblockPlus at regulation. Whilst they don't go into detail over the amounts they are paid, I feel I could give them the benefit of the doubt, especially if, as one might possibly infer from their statement, these are more like donations to cover costs rather than payments:

"Whitelisting is free for all small- and medium websites and blogs. However, managing this list requires significant effort on our side and this task cannot be completely taken over by volunteers as it happens with common filter lists. That's why we are being paid by some larger properties that serve non-intrusive advertisements that want to participate in the Acceptable Ads initiative. "

Many thanks for this information.

Martin
 

Similar 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