Switch + Local DNS Ad Blocking?

Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking
Author Message
YoItsTrev
DD-WRT Novice


Joined: 19 Feb 2016
Posts: 4

PostPosted: Fri Feb 19, 2016 18:33    Post subject: Switch + Local DNS Ad Blocking? Reply with quote
My brother-in-law had a Netgear R6300 (non-v2) for many years. Yesterday the WAN port "died." He went to Best Buy and got a new router (Netgear R6400 aka AC1750). I asked him if I could play around with the other router. After putting DD-WRT on it, the WAN port works again. I want to be able to use this script to be able to do router based ad blocking:

http://www.dd-wrt.com/wiki/index.php/Ad_blocking

My brother-in-law is unwilling to install DD-WRT on a brand new router, so I am trying to find a way to use the router with DD-WRT to both rely on the main router for DHCP like a switch, but also be able to use DNS for ad blocking. Is this possible?
Sponsor
jsebean
DD-WRT User


Joined: 01 Dec 2015
Posts: 183
Location: Canada

PostPosted: Fri Feb 19, 2016 20:01    Post subject: Re: Switch + Local DNS Ad Blocking? Reply with quote
YoItsTrev wrote:
My brother-in-law had a Netgear R6300 (non-v2) for many years. Yesterday the WAN port "died." He went to Best Buy and got a new router (Netgear R6400 aka AC1750). I asked him if I could play around with the other router. After putting DD-WRT on it, the WAN port works again. I want to be able to use this script to be able to do router based ad blocking:

http://www.dd-wrt.com/wiki/index.php/Ad_blocking

My brother-in-law is unwilling to install DD-WRT on a brand new router, so I am trying to find a way to use the router with DD-WRT to both rely on the main router for DHCP like a switch, but also be able to use DNS for ad blocking. Is this possible?

Install Ad Block Plus and be done with it rather than hijacking DNS or messing with proxies... way cleaner Wink

_________________
Want to get ahold of me? Contact me via one of the links here: http://jse.io/ or via discord at https://discord.gg/NmYX6enh
---
Current Router Setup:
OEM Satellite internet -- I'll likely get back to DD-WRT again when I get better internet
YoItsTrev
DD-WRT Novice


Joined: 19 Feb 2016
Posts: 4

PostPosted: Fri Feb 19, 2016 20:05    Post subject: Re: Switch + Local DNS Ad Blocking? Reply with quote
jsebean wrote:
YoItsTrev wrote:
My brother-in-law had a Netgear R6300 (non-v2) for many years. Yesterday the WAN port "died." He went to Best Buy and got a new router (Netgear R6400 aka AC1750). I asked him if I could play around with the other router. After putting DD-WRT on it, the WAN port works again. I want to be able to use this script to be able to do router based ad blocking:

http://www.dd-wrt.com/wiki/index.php/Ad_blocking

My brother-in-law is unwilling to install DD-WRT on a brand new router, so I am trying to find a way to use the router with DD-WRT to both rely on the main router for DHCP like a switch, but also be able to use DNS for ad blocking. Is this possible?

Install Ad Block Plus and be done with it rather than hijacking DNS or messing with proxies... way cleaner Wink


I have Ad Block Plus.... that isn't the point. Ad block plus does NOTHING for things like killing ads on Roku's Youtube app. That is what this about.
Alozaros
DD-WRT Guru


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

PostPosted: Fri Feb 19, 2016 21:07    Post subject: Reply with quote
dd-wrt AD blocking doesn't stop yoptube adverts at all
but it does the job for the rest ... Wink

_________________
Atheros
TP-Link WR740Nv1 ---DD-WRT 55630 WAP
TP-Link WR1043NDv2 -DD-WRT 55723 Gateway/DoT,Forced DNS,Ad-Block,Firewall,x4VLAN,VPN
TP-Link WR1043NDv2 -Gargoyle OS 1.15.x AP,DNS,QoS,Quotas
Qualcomm-Atheros
Netgear XR500 --DD-WRT 55779 Gateway/DoH,Forced DNS,AP Isolation,4VLAN,Ad-Block,Firewall,Vanilla
Netgear R7800 --DD-WRT 55819 Gateway/DoT,AD-Block,Forced DNS,AP&Net Isolation,x3VLAN,Firewall,Vanilla
Netgear R9000 --DD-WRT 55779 Gateway/DoT,AD-Block,AP Isolation,Firewall,Forced DNS,x2VLAN,Vanilla
Broadcom
Netgear R7000 --DD-WRT 55460 Gateway/SmartDNS/DoH,AD-Block,Firewall,Forced DNS,x3VLAN,VPN
NOT USING 5Ghz ANYWHERE
------------------------------------------------------
Stubby DNS over TLS I DNSCrypt v2 by mac913
YoItsTrev
DD-WRT Novice


Joined: 19 Feb 2016
Posts: 4

PostPosted: Fri Feb 19, 2016 21:10    Post subject: Reply with quote
Alozaros wrote:
dd-wrt AD blocking doesn't stop yoptube adverts at all
but it does the job for the rest ... Wink


The script I linked does. I know. I used it for years on a Buffalo router with DD-WRT. Blocked Youtube AND Pandora ads, just to name a few.
Alozaros
DD-WRT Guru


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

PostPosted: Sun Feb 21, 2016 6:23    Post subject: Reply with quote
first or the second ? Smile i tried them both yes few of the adverts but no such a success as you reported with youtube, i had to develop my own at the end !!
_________________
Atheros
TP-Link WR740Nv1 ---DD-WRT 55630 WAP
TP-Link WR1043NDv2 -DD-WRT 55723 Gateway/DoT,Forced DNS,Ad-Block,Firewall,x4VLAN,VPN
TP-Link WR1043NDv2 -Gargoyle OS 1.15.x AP,DNS,QoS,Quotas
Qualcomm-Atheros
Netgear XR500 --DD-WRT 55779 Gateway/DoH,Forced DNS,AP Isolation,4VLAN,Ad-Block,Firewall,Vanilla
Netgear R7800 --DD-WRT 55819 Gateway/DoT,AD-Block,Forced DNS,AP&Net Isolation,x3VLAN,Firewall,Vanilla
Netgear R9000 --DD-WRT 55779 Gateway/DoT,AD-Block,AP Isolation,Firewall,Forced DNS,x2VLAN,Vanilla
Broadcom
Netgear R7000 --DD-WRT 55460 Gateway/SmartDNS/DoH,AD-Block,Firewall,Forced DNS,x3VLAN,VPN
NOT USING 5Ghz ANYWHERE
------------------------------------------------------
Stubby DNS over TLS I DNSCrypt v2 by mac913
YoItsTrev
DD-WRT Novice


Joined: 19 Feb 2016
Posts: 4

PostPosted: Tue Feb 23, 2016 1:28    Post subject: Reply with quote
Alozaros wrote:
first or the second ? Smile i tried them both yes few of the adverts but no such a success as you reported with youtube, i had to develop my own at the end !!


The second one. The really long one.
tweakradje
DD-WRT Novice


Joined: 25 Sep 2008
Posts: 34

PostPosted: Sun May 01, 2016 22:03    Post subject: Reply with quote
You can do it with /tmp/hosts file or with dnsmasq options. Easiest is with hosts file (dnsmasq is local dns must be activated)

Add this to your startup script:

#wait for router to initialize network
sleep 20

# get hosts file with unix EOL
wget -qO- http://adaway.org/hosts.txt|grep "^127.0.0.1" >> /tmp/hosts

# re-read hosts file
killall -HUP dnsmasq

Cheers
drdedus
DD-WRT User


Joined: 31 Dec 2013
Posts: 171
Location: Greece

PostPosted: Mon Dec 19, 2016 7:17    Post subject: Reply with quote
Alozaros wrote:
first or the second ? Smile i tried them both yes few of the adverts but no such a success as you reported with youtube, i had to develop my own at the end !!

when you mean developed what you done?
YoItsTrev wrote:

The second one. The really long one.


are the results different between the first and the second method?
drdedus
DD-WRT User


Joined: 31 Dec 2013
Posts: 171
Location: Greece

PostPosted: Mon Dec 19, 2016 7:28    Post subject: Reply with quote
tweakradje wrote:
You can do it with /tmp/hosts file or with dnsmasq options. Easiest is with hosts file (dnsmasq is local dns must be activated)

Add this to your startup script:

#wait for router to initialize network
sleep 20

# get hosts file with unix EOL
wget -qO- http://adaway.org/hosts.txt|grep "^127.0.0.1" >> /tmp/hosts

# re-read hosts file
killall -HUP dnsmasq

Cheers


can you be more detailed for me because i do not have it?
I just have to enable local dns and put this in startup or I have to use and something from the link in the first post?
Alozaros
DD-WRT Guru


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

PostPosted: Mon Dec 19, 2016 8:51    Post subject: Reply with quote
ADblocking
Startup Script:
Code:


_rogue=0.0.0.0
echo -e "n=1\nwhile ! wget -q -O /tmp/hsts http://winhelp2002.mvps.org/hosts.txt ; do\n\t[ \$n -gt 5 ] && break\n\tlet n+=1\n\tsleep 60\ndone\ngrep \"^0.0.0.0\" /tmp/hsts | grep \"^0.0.0.0\" | grep -v localhost | awk '{print \"$_rogue\\\t\"\$2}' | tr -d '\\\015' >/tmp/dlhosts\nrm /tmp/hsts\nkillall -HUP dnsmasq" >/tmp/wh
sh /tmp/wh &

Put Additional DNS Masquerade option:
addn-hosts=/tmp/dlhosts

cronjob
0 12 * * * root /tmp/.rc_startup

_________________
Atheros
TP-Link WR740Nv1 ---DD-WRT 55630 WAP
TP-Link WR1043NDv2 -DD-WRT 55723 Gateway/DoT,Forced DNS,Ad-Block,Firewall,x4VLAN,VPN
TP-Link WR1043NDv2 -Gargoyle OS 1.15.x AP,DNS,QoS,Quotas
Qualcomm-Atheros
Netgear XR500 --DD-WRT 55779 Gateway/DoH,Forced DNS,AP Isolation,4VLAN,Ad-Block,Firewall,Vanilla
Netgear R7800 --DD-WRT 55819 Gateway/DoT,AD-Block,Forced DNS,AP&Net Isolation,x3VLAN,Firewall,Vanilla
Netgear R9000 --DD-WRT 55779 Gateway/DoT,AD-Block,AP Isolation,Firewall,Forced DNS,x2VLAN,Vanilla
Broadcom
Netgear R7000 --DD-WRT 55460 Gateway/SmartDNS/DoH,AD-Block,Firewall,Forced DNS,x3VLAN,VPN
NOT USING 5Ghz ANYWHERE
------------------------------------------------------
Stubby DNS over TLS I DNSCrypt v2 by mac913
drdedus
DD-WRT User


Joined: 31 Dec 2013
Posts: 171
Location: Greece

PostPosted: Sat Dec 24, 2016 7:49    Post subject: Reply with quote
Yes I have this I found it on another topic and is workin really great.
Thank you.
But what's the difference with @tweakradje proposition?
Alozaros
DD-WRT Guru


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

PostPosted: Sat Dec 24, 2016 12:12    Post subject: Reply with quote
ok with first script there are no additional dnsmasq options
and if you need to add anything to additional dnsmasq options it breaks down saved adblocking script and its not working, obviously with second script you can use it with conjunction with additional dnsmasq options and it works well Wink

also script 1 has all the hosts added to /tmp/dlhosts
while the other one script 2 are going to /tmp/hosts and they are from different site in different format i guess Smile

you can use whatever you decide and works well with your set up....

_________________
Atheros
TP-Link WR740Nv1 ---DD-WRT 55630 WAP
TP-Link WR1043NDv2 -DD-WRT 55723 Gateway/DoT,Forced DNS,Ad-Block,Firewall,x4VLAN,VPN
TP-Link WR1043NDv2 -Gargoyle OS 1.15.x AP,DNS,QoS,Quotas
Qualcomm-Atheros
Netgear XR500 --DD-WRT 55779 Gateway/DoH,Forced DNS,AP Isolation,4VLAN,Ad-Block,Firewall,Vanilla
Netgear R7800 --DD-WRT 55819 Gateway/DoT,AD-Block,Forced DNS,AP&Net Isolation,x3VLAN,Firewall,Vanilla
Netgear R9000 --DD-WRT 55779 Gateway/DoT,AD-Block,AP Isolation,Firewall,Forced DNS,x2VLAN,Vanilla
Broadcom
Netgear R7000 --DD-WRT 55460 Gateway/SmartDNS/DoH,AD-Block,Firewall,Forced DNS,x3VLAN,VPN
NOT USING 5Ghz ANYWHERE
------------------------------------------------------
Stubby DNS over TLS I DNSCrypt v2 by mac913
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking 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 cannot attach files in this forum
You cannot download files in this forum