[Solved] Ad Blocking for "dummies".

Post new topic   Reply to topic    DD-WRT Forum Forum Index -> General Questions
Goto page 1, 2  Next
Author Message
thoase
DD-WRT Novice


Joined: 01 Dec 2021
Posts: 14
Location: Sweden

PostPosted: Fri Jan 14, 2022 13:36    Post subject: [Solved] Ad Blocking for "dummies". Reply with quote
Hi!
Here's a question from a ddwrt-newbie.

I have read about Ad Blocking in the wiki, https://wiki.dd-wrt.com/wiki/index.php/Ad_blocking. And that looks really great instead of having adblocksaddons in the webbrowsers and there's no adblock for iPhones as far as I know.

I see many question/answers in the forum about Ad Blocking and I wounder, which is the newest/best/most-up-to-date script a newbie like me should use? My router(ASUS RT-AC66U) have v3.0-r47745 giga (12/04/21 installed.


Last edited by thoase on Mon Jan 17, 2022 15:16; edited 1 time in total
Sponsor
eibgrad
DD-WRT Guru


Joined: 18 Sep 2010
Posts: 8997

PostPosted: Fri Jan 14, 2022 22:55    Post subject: Reply with quote
There are quite a few scattered around the forum. As far as the ones in the wiki, the problem there is that they're quite old, and depend on the older wget utility (rather than curl), which in many cases still doesn't support TLS (e.g., my own ASUS RT-AC68U). And as time has gone by, many of these blacklisting sites have moved from http to https. Plus, there are quite a few other blacklisting sites besides the one(s) typically referenced, some of which now block cryptomining and other annoyances. I don't even know if the urls referenced are current.

FWIW, I have my own script. The urls it uses are based on those found in FT (FreshTomato) 2021.7, so it should be reasonably current. If you use ALL the urls, you'll come close to 240,000 unique domains! Realize the longer the list, the more processing demands it places on DNSMasq.

ddwrt-blacklist-domains.sh

_________________
ddwrt-ovpn-split-basic.sh * ddwrt-ovpn-split-advanced.sh * ddwrt-ovpn-kill-switch.sh * ddwrt-ovpn-watchdog.sh * ddwrt-ovpn-remote-access.sh * ddwrt-ovpn-client-backup.sh * ddwrt-mount-usb-drives.sh * ddwrt-blacklist-domains.sh * ddwrt-wol-port-forward.sh * ddwrt-dns-monitor.sh (NEW!)
thoase
DD-WRT Novice


Joined: 01 Dec 2021
Posts: 14
Location: Sweden

PostPosted: Mon Jan 17, 2022 15:18    Post subject: Reply with quote
eibgrad wrote:
There are quite a few scattered around the forum. As far as the ones in the wiki, the problem there is that they're quite old, and depend on the older wget utility (rather than curl), which in many cases still doesn't support TLS (e.g., my own ASUS RT-AC68U). And as time has gone by, many of these blacklisting sites have moved from http to https. Plus, there are quite a few other blacklisting sites besides the one(s) typically referenced, some of which now block cryptomining and other annoyances. I don't even know if the urls referenced are current.

FWIW, I have my own script. The urls it uses are based on those found in FT (FreshTomato) 2021.7, so it should be reasonably current. If you use ALL the urls, you'll come close to 240,000 unique domains! Realize the longer the list, the more processing demands it places on DNSMasq.

ddwrt-blacklist-domains.sh


Thanks a lot!!
Fried Chicken
DD-WRT User


Joined: 12 Jun 2019
Posts: 110

PostPosted: Mon Jan 17, 2022 19:28    Post subject: Reply with quote
eibgrad wrote:
There are quite a few scattered around the forum. As far as the ones in the wiki, the problem there is that they're quite old, and depend on the older wget utility (rather than curl), which in many cases still doesn't support TLS (e.g., my own ASUS RT-AC68U). And as time has gone by, many of these blacklisting sites have moved from http to https. Plus, there are quite a few other blacklisting sites besides the one(s) typically referenced, some of which now block cryptomining and other annoyances. I don't even know if the urls referenced are current.

FWIW, I have my own script. The urls it uses are based on those found in FT (FreshTomato) 2021.7, so it should be reasonably current. If you use ALL the urls, you'll come close to 240,000 unique domains! Realize the longer the list, the more processing demands it places on DNSMasq.

ddwrt-blacklist-domains.sh


This is awesome, how do I uninstall this if I have to?

_________________
So you’re a DD-WRT Expert? Figure this out: https://forum.dd-wrt.com/phpBB2/viewtopic.php?p=1168315
eibgrad
DD-WRT Guru


Joined: 18 Sep 2010
Posts: 8997

PostPosted: Mon Jan 17, 2022 19:54    Post subject: Reply with quote
Fried Chicken wrote:
This is awesome, how do I uninstall this if I have to?


Just delete it.

Code:
rm -f /jffs/etc/config/ddwrt-blacklist-domains.startup


Then reboot.

P.S. And delete the cron job as well if you decided to use the scheduler.

_________________
ddwrt-ovpn-split-basic.sh * ddwrt-ovpn-split-advanced.sh * ddwrt-ovpn-kill-switch.sh * ddwrt-ovpn-watchdog.sh * ddwrt-ovpn-remote-access.sh * ddwrt-ovpn-client-backup.sh * ddwrt-mount-usb-drives.sh * ddwrt-blacklist-domains.sh * ddwrt-wol-port-forward.sh * ddwrt-dns-monitor.sh (NEW!)
thoase
DD-WRT Novice


Joined: 01 Dec 2021
Posts: 14
Location: Sweden

PostPosted: Tue Jan 18, 2022 10:40    Post subject: Reply with quote
Two questions:
- At https://pastebin.com/aySi7RhY I can read the comment "version: 3.0.0, 15-jan-2022". Does that mean that you are updating the script now and then?
- What exactly does the cronjob do?
eibgrad
DD-WRT Guru


Joined: 18 Sep 2010
Posts: 8997

PostPosted: Tue Jan 18, 2022 13:26    Post subject: Reply with quote
thoase wrote:
- At https://pastebin.com/aySi7RhY I can read the comment "version: 3.0.0, 15-jan-2022". Does that mean that you are updating the script now and then?


Yes. Just depends on whether I happen to find a bug, decide I want to enhance it, or in this particular case, whether the URLs need updating (which is why you see a very recent update; I hadn't updated in quite some time until you asked about these types of scripts).

Quote:
- What exactly does the cronjob do?


The script is installed as a autostarting startup script. IOW, when the system sees the script, it knows to execute it during the bootup process. And that's always necessary since the blacklist is NOT persistent across a reboot. The purpose of the cronjob (i.e., scheduled task) is to allow updating of the blacklist on a periodic basis (every 4 hours, once a day, once a week, whatever you prefer), since the contents of these URLs are updated quite frequently. But the cronjob is optional. If you're happy w/ relying on whatever is established on the blacklist following a reboot, you can just leave it at that.

Note, as specified in the instructions, the cronjob runs every morning @ 4:00 AM.

_________________
ddwrt-ovpn-split-basic.sh * ddwrt-ovpn-split-advanced.sh * ddwrt-ovpn-kill-switch.sh * ddwrt-ovpn-watchdog.sh * ddwrt-ovpn-remote-access.sh * ddwrt-ovpn-client-backup.sh * ddwrt-mount-usb-drives.sh * ddwrt-blacklist-domains.sh * ddwrt-wol-port-forward.sh * ddwrt-dns-monitor.sh (NEW!)
MesMurized
DD-WRT Novice


Joined: 08 Aug 2017
Posts: 40

PostPosted: Thu Jan 20, 2022 4:17    Post subject: Reply with quote
Glad I thoroughly read this (and it's links) ...
When DNS IP blocking 1st appeared years and years ago it used 0.0.0.0 for redirection. Appx 10-15 yrs later it changed to 127.0.0.1 for efficiency. And now it's back to 0.0.0.0 again due to a Windows update.

_________________
Current: NetgearR9000 r48865
Retired: Linksys WRT32X r39296, TP-Link Archer C7 v2, LinkSys WRT54G v5
forkup
DD-WRT Novice


Joined: 31 Jan 2022
Posts: 1

PostPosted: Tue Feb 01, 2022 15:57    Post subject: Reply with quote
Thanks for the info guys.
ph1dft
DD-WRT Novice


Joined: 08 Apr 2022
Posts: 5

PostPosted: Fri Apr 08, 2022 18:40    Post subject: how to troubleshoot Reply with quote
Hi all,
I found this great article and followed all the steps on my Netgear R-7000 with dd-wrt v3.0-r46329.
I enabled jffs2 -> 68 mb free space, next
I enabled syslogd, follow by starting a cmd and
executing curl -kLs bit.ly/ddwrt-installer|tr -d '\r'|sh -s aySi7RhY startup. The output is 'info: script installed: /jffs/etc/config/ddwrt-blacklist-domains.startup'.
I then added 'addn-hosts=/tmp/blacklisted_domains' to the dnsmasq options -> /tmp contains the file 'blacklisted_domains'. When I open it it says 'blacklisted_domains 1/61192 0%'.
After that I set the cron job and rebooted.

Now 2 hours later I still get ads in youtube app on my Samsung TV.

The syslog shows
Apr 8 20:42:50 DD-WRT user.notice ddwrt-blacklist-domains[2147]: info: total blacklisted domains: 61192
Apr 8 20:42:51 DD-WRT daemon.info dnsmasq[1259]: read /tmp/blacklisted_domains - 61192 addresses
So that seems fine.

How to troubleshoot this?
Thanks in advance.
the-joker
DD-WRT Developer/Maintainer


Joined: 31 Jul 2021
Posts: 791
Location: All over YOUR webs

PostPosted: Fri Apr 08, 2022 19:45    Post subject: Reply with quote
That's some ancient CVE here and there build you have there, also unsupported. Meaning dont ask for help with that build, bugs have been fixed, patches have been added kernels upgraded, libraries updated, and no fixes will go into that build.

Please upgrade to the latest DD-WRT build. http://ftp.dd-wrt.com/dd-wrtv2/downloads/betas/2022/

r46329 is nearly a year old, many security issues have been patched since then, IMO you should be upgrading your DD-WRT every month (minimum) and nvram resetting once a year (minimum) and re-configuring from scratch.

Dont forget to nvram reset, nvram version is now superior and much changed since then.

Or stick with it, freedom is a great thing.

_________________
Saving your retinas from the burn!🔥
DD-WRT Inspired themes for routers
DD-WRT Inspired themes for the phpBB Forum
DD-WRT Inspired themes for the SVN Trac & FTP site
Join in for a chat @ #style_it_themes_public:matrix.org or #style_it_themes:discord

DD-WRT UI Themes Bug Reporting and Discussion thread

Router: ANus RT-AC68U E1 (recognized as C1)
ph1dft
DD-WRT Novice


Joined: 08 Apr 2022
Posts: 5

PostPosted: Sat Apr 09, 2022 6:51    Post subject: Reply with quote
I understand and will upgrade my router first, and will try again.
I report back later.... Thanks
Alozaros
DD-WRT Guru


Joined: 16 Nov 2015
Posts: 5009
Location: UK, London, just across the river..

PostPosted: Sat Apr 09, 2022 8:05    Post subject: Reply with quote
some smart devices(TV, tablets and ect.), have their own DNS baked and they use it instead of your router DNS and they go around the ad blocker...in this case you have to use forced DNS settings (from basic set up page)...moreover youtube ads are very difficult to avoid this days, as they are made up against adblocker tricks...so, some of them are blended in...

if you do a deep search in the DDWRT forum, you will find some ad blockers that are more efficient for youtube

_________________
Atheros
TP-Link WR740Nv1 ---DD-WRT 48646 WAP
TP-Link WR1043NDv2 -DD-WRT 48865 Gateway,DNS,AP Isolation,Ad-Block,Firewall,Forced DNS,DoT,VPN,VLAN
TP-Link WR1043NDv2 -DD-WRT 48886 Gateway,DNS,Ad-Block,Firewall,Forced DNS,DoT,VPN,VLAN
TP-Link WR1043NDv2 -Gargoyle OS 1.13.0b AP,DNS,QoS,Quotas
Qualcomm-Atheros
Netgear R7800 --DD-WRT 48886 Gateway,DNS,AD-Block,AP&Net Isolation,VLAN's,Firewall,DoT,Vanilla
Netgear R9000 --DD-WRT 48886 Gateway,DNS,AD-Block,AP Isolation,Firewall,Forced DNS,DoT,2,4Ghz only,Vanilla
Broadcom
Netgear R7000 ---DD-WRT 48886 Gateway,DNS,AD-Block,Firewall,Forced DNS,VLAN's,DoT,VPN
------------------------------------------------------
Stubby for DNS over TLS I DNSCrypt v2 by mac913
ph1dft
DD-WRT Novice


Joined: 08 Apr 2022
Posts: 5

PostPosted: Sat Apr 09, 2022 9:27    Post subject: Reply with quote
Dear Alozaros,
I found many articles, some very old and some very difficult for me.
Which article do you recommend these days?
the-joker
DD-WRT Developer/Maintainer


Joined: 31 Jul 2021
Posts: 791
Location: All over YOUR webs

PostPosted: Sat Apr 09, 2022 10:16    Post subject: Reply with quote
Youtube ads are gone in a regular browser using ublock origin desktop side and android side the same (Firefox + ublock origin, as Chrome on android doesn't support addons afaik), I see no ads for sure in that scenario, while using the YouTube app (on e.g.my phone android 11) most of the content is flooded with ads. Smart TV's official YouTube apps will again have different protections to ensure you cant do way with ads, so consider the alternative of using a browser with ublock origin on TV if at all possible.

Smart TV's indeed do their own thing, TBH I dont own any Smart TV's because I dont think their particularly smart at anything, just a security breach waiting to happen like becoming part of some botnet, If I owned one I would block WAN access to them and upgrade the FW manually, since their OS's/FW are developed by companies who dont care and as part of their planned obsolesce nonsense.

So try indeed to force DNS way with a DNS that blocks such ads.

Also on Router you would need to check the option to ignore WAN DNS, with a bit of luck, then it would use the routers Static DNS (you would need to add some DNS entries there on routers setup page) and test and see if then the situation persists.

Another option would be to root the smart TV and alter these DNS servers, but this is something advanced and root would need to be disabled after changing files, and process rinsed and repeated after each smart TV FW upgrade. But this wont make any difference to Youtube app for instance.

On regular android its possible to define own DNS, Im unsure what the situation is these days with modern smart TV OS, which is android TV based (in some cases or it was, idk if its changed), still could be a custom offshoot as opposed to regular phone android OS, that doesn't have certain features like ability to define own DNS.

I think only LG (WebOS) and Samsung use their own OS's at least it was so in the past.
Again old information I use to know on who used android AOSP were: B&O, Hisense, Haier, Iris, Philips. LeEco, Sharp, Sony, TCL, Toshiba, Grundig and Beko.

Who knows, see what your TV is running but dont trust it for security in any cases.

My experience with smart TV's is limited to Android TV OS's and only to do some customization back 2 years while I was in lovely rainy GB and installed several Home automation systems and Media Centers where hacking in to the Android TV was necessary to make it play nice with certain equipment on the automation side.

_________________
Saving your retinas from the burn!🔥
DD-WRT Inspired themes for routers
DD-WRT Inspired themes for the phpBB Forum
DD-WRT Inspired themes for the SVN Trac & FTP site
Join in for a chat @ #style_it_themes_public:matrix.org or #style_it_themes:discord

DD-WRT UI Themes Bug Reporting and Discussion thread

Router: ANus RT-AC68U E1 (recognized as C1)
Goto page 1, 2  Next Display posts from previous:    Page 1 of 2
Post new topic   Reply to topic    DD-WRT Forum 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