ad blocking on the router

Discussion in 'Asuswrt-Merlin' started by Txdk, Jan 7, 2013.

  1. Txdk

    Txdk Occasional Visitor

    Joined:
    Dec 2, 2012
    Messages:
    49
    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
     
    Last edited: Jan 7, 2013
  2. Log in / Register to remove this ad

  3. Apex

    Apex Occasional Visitor

    Joined:
    Nov 11, 2012
    Messages:
    10
    Location:
    UK
    Have you thought about using OpenDNS in order to block ad-sites etc ? (It's my own choice over any other method)
     
  4. mromero

    mromero Regular Contributor

    Joined:
    Nov 25, 2012
    Messages:
    137
    But don't they also serve up their own ads when the URL is wrong?

    Also, unless you are located in the country where it operates it may make the lookup even longer I think.
     
  5. Txdk

    Txdk Occasional Visitor

    Joined:
    Dec 2, 2012
    Messages:
    49
    OpenDNS is not an option as they serve there own ads and redirect you if you type wrong and they are slow as hell and blocks access to some pages that they are forced to block.

    i don't want that.
    why do that if what i want is no ads when surfing the net as it stands now im using ad-block plus on all my computers but it would be more easy if it was done by the router
     
  6. ryzhov_al

    ryzhov_al Very Senior Member

    Joined:
    Jul 23, 2012
    Messages:
    531
    Location:
    Russia
    Hosts-based blacklist, resolved to 127.0.0.1

    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.
     
    Last edited: Jan 12, 2013
  7. AnthonyArmato

    AnthonyArmato Senior Member

    Joined:
    Apr 13, 2012
    Messages:
    264
    If I can figure out how to do this it would be great considering I have several iPads and a MacBook on my network.

    Any chance you could create the files and attach them in a zip ? Then I assume we just run those commands ?
     
  8. RogerSC

    RogerSC Very Senior Member

    Joined:
    Oct 18, 2009
    Messages:
    1,653
    It looks like the wan-start command that goes out on the internet and downloads the host blacklist gets run when the router boots (assuming that you put it where it is suggested to put it).

    Seems like it'll be fun to play with, might give it a go and see if can improve things for devices that don't have ad blocking, like my Android phone. Curious if it'll slow things down much.

    Anthony, I did get the "Atomic" browser for my iPad that does have an ad blocker, cost $0.99 as I recall *smile*. Works well for that, the only problem is that when you click on a URL in email, etc., it brings up Safari. But when I read this forum on my iPad, or go looking for stuff, I use the "Atomic" browser, and it blocks most all ads. I don't know if Safari for MacBook has an ad blocker or not, but it might.
     
  9. ryzhov_al

    ryzhov_al Very Senior Member

    Joined:
    Jul 23, 2012
    Messages:
    531
    Location:
    Russia
    As for me, I redirect all http traffic from Android tablet to privoxy transparent proxy on router with original AdBlock rules.
    For what? The embedded browser is real fast but can't use plugins, a firefox got AdBlock plugin but it's slow as hell.

    If someone interested, I'll write How-to about that. This solution is quite universal: no matter iOS or Android devices will be used.

    Yes, all DNS "improvements" needs to be benchmarked. As for DD-WRT variant above, there is
    strings in blacklist. It will not slow down dnsmasq. But if blacklist will be greater, taken from adsuck for example:
    then dnsmasq will consume +8MB RAM and will add delays to DNS resolving.

    The second disadvantage of dnsmasq + hosts blacklist is following: every time browser "asks" for blacklisted domain, dnsmasq returns "127.0.0.1", which means "this PC" so every time browser will wait for answer from local PC, where no web server is installed.

    There is another solution for hosts-based blacklists: adsuck. Adsuck is a DNS server which immediately returns NXDOMAIN (non existent domain) answer for black listed domains. So browser caches it's answer and not trying to get blocked elements again and again.
     
    Last edited: Jan 13, 2013
  10. Txdk

    Txdk Occasional Visitor

    Joined:
    Dec 2, 2012
    Messages:
    49

    i cant make that work

    first of all i dont think that wan-start is even run when the router boots
    in the log it says that there is no file or folder /tmp/hosts0

    and if i run wan-start manually it downloads the hostfile and then says something about wrong paramaters for dnsmasq and to look in --help

    im a total noob dealing with linux but i did what you said these is the files i created adblock
    do i need to create the files on the router with the vi editor.
    i created them under windows and notepad with copy paste.


    if there is i better way to block ads i dont mind if you post a how to for that

    adsuck sounds promising
     
    Last edited: Jan 13, 2013
  11. Txdk

    Txdk Occasional Visitor

    Joined:
    Dec 2, 2012
    Messages:
    49
    it seens adblock can be installed from entware so a toturial about how to do that at set it up would be great
     
  12. RogerSC

    RogerSC Very Senior Member

    Joined:
    Oct 18, 2009
    Messages:
    1,653
    Yes, I'd be interested in this. Don't need it for iOS, since as I said I got the "Atomic" browser, but for my Android phone this would be worthwhile.

    And thanks for the note about the slowdown with the first method you mentioned, that's helpful to steer me away from bothering with that one *smile*.
     
  13. Thank you for your tutorial on the usage of privoxy to block ads.
    Could you please put up a tutorial for adsuck?
    -Sebastian
     
  14. mromero

    mromero Regular Contributor

    Joined:
    Nov 25, 2012
    Messages:
    137
    I know this thread is about blocking ads on the router.

    But so far I cannot figure out all those Linux scripts and how to run them on the router.

    What works for me is SquidGuard on a PfSense box.

    You drop Shalla's Blacklist on it and the box will block bad sites as per your selection, INCLUDING blocking most all ads.
     
    Last edited: Jan 22, 2013
  15. neo387

    neo387 New Around Here

    Joined:
    Feb 3, 2013
    Messages:
    1
    Is it possible for someone to make a tutorial for adsuck, installed it (entware) but no idea what to do :p
     
  16. dopefish

    dopefish Occasional Visitor

    Joined:
    Sep 18, 2012
    Messages:
    32
    yes, i am also interested!
     
  17. ryzhov_al

    ryzhov_al Very Senior Member

    Joined:
    Jul 23, 2012
    Messages:
    531
    Location:
    Russia
    Oh, my! I forgot it, sorry!

    Will do ASAP.
     
  18. ryzhov_al

    ryzhov_al Very Senior Member

    Joined:
    Jul 23, 2012
    Messages:
    531
    Location:
    Russia
    [HOW-TO] adsuck — blocking ads by DNS

    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!
     
    Last edited: Feb 3, 2013
  19. amdoou

    amdoou New Around Here

    Joined:
    Dec 10, 2012
    Messages:
    4
    no luck

    No luck, configured as above, after reboot no internet.
     
  20. ryzhov_al

    ryzhov_al Very Senior Member

    Joined:
    Jul 23, 2012
    Messages:
    531
    Location:
    Russia
    I think there is something wrong with jffs scripts or configs. Let's try to run adsuck manually:
    • please, remove adsuck autostart:
    • reboot router and type:
    Is internet connection is up this way?
     
  21. tritius

    tritius Occasional Visitor

    Joined:
    Jan 3, 2013
    Messages:
    36
    Location:
    Milano, Italy
    Hi All,
    I'm completely new to this kind of modding and my experience is really limited.
    I'm also interested in improving my knowledge ...
    Is there a document already available that teaches how to install a package and run it ?

    Thanks for the support.
    Luca
     

Share This Page