Also added preliminary check for internet connection.
Code:
#!/bin/sh
logger WAN up script executing
sleep 2
if test ! -s /tmp/dlhosts
then
cat >/tmp/dlhosts <<"EOF"
# Uncomment to enable waiting for internet connection to come up
#while ! ping www.google.com -c 1 > /dev/null ; do
# logger "waiting for the internet connection to come up"
# sleep 5
#done
Donny:
This should run on all builds.
What is does is takes any request from a system and checks it against the list of URLS. If the URL matches, it returns the IP 0.0.0.0 instead of passing it though and getting the ad.
This is incorrect information. It does NOT run on micro builds. Runs on mini or standard.
The Wiki has been updated with new instructions on ad-blocking with the DD-WRT Micro build.
If you go to the 1st page it describes how to test it. _________________ Home Network on Telus 1Gb PureFibre - 10GbE Copper Backbone
2x R7800 - Gateway & WiFi & 3xWireGuard - DDWRT r53562 Std k4.9
Off Site 1
R7000 - Gateway & WiFi & WireGuard - DDWRT r54517 Std
E3000 - Station Bridge - DDWRT r49626 Mega K4.4
Off Site 2
R7000 - Gateway & WiFi - DDWRT r54517 Std
E2000 - Wired ISP IPTV PVR Blocker - DDWRT r35531
Posted: Sun Dec 08, 2013 18:37 Post subject: No Longer Working With Lastest Update of MVPS Hosts
I have verified that with the newest update of the mvps hosts file, my to routers no longer block ads.
I have a WRT310N and a WZR-600DHP and neither are doing any redirects. I have not changed a thing. I did notice some new tags in the hosts file that I have not seen before with reference to IPV6.
I have been using this for years without fault until now. Running the mvps hosts file locally works fine.
Posted: Sun Dec 08, 2013 23:45 Post subject: Re: No Longer Working With Lastest Update of MVPS Hosts
RCShadows wrote:
I have verified that with the newest update of the mvps hosts file, my to routers no longer block ads.
I have a WRT310N and a WZR-600DHP and neither are doing any redirects. I have not changed a thing. I did notice some new tags in the hosts file that I have not seen before with reference to IPV6.
I have been using this for years without fault until now. Running the mvps hosts file locally works fine.
Yep. I changed the Startup script and replaced 127.0.0.1 to 0.0.0.0 in two places and it works now. I posted another thread with my change if you want to have a look. I hope it is correct but seems to have solved the problem.
Posted: Wed Jul 16, 2014 6:19 Post subject: Thank you
Thank you sir. I updated my DD-WRT build due to some old bugs I was sick and tired of. The new build is awesome and bug-free, but the trade-off was lack of flash space to make a jffs partition like the small one I had before(need big build for features I value like IPv6 support). Combined with a previously tested compile script to compile pixelserv on the fly and this script, my router is happily blocking ads with pixelserv, despite having no jffs partition available. Was considering cifs but I don't want my PC to have to run when it does not have to for any other purpose.
Posted: Mon Jul 28, 2014 7:03 Post subject: This works very well!
I took the man's original format and modded it. I have not enough room for jffs on my lowly E2000 but plenty of RAM. His method does work on this shiny new build, unlike what's in the wiki. Of course, if you want to exactly copy me, grab the custom.txt from this thread https://secure.dd-wrt.com/phpBB2/viewtopic.php?p=434120&highlight= and save it as a custom script.
Replace anywhere I put 192.168.1.1 with the IP you wish to redirect to. In my case, pixelserv compiled by that custom.txt when router boots. Uncheck http and https for the router admin if you run pixelserv or it will interfere.
You can put httpd -p 81 after the killall httpd and sleep 1 if you want to have the GUI. I personally admin over ssh and leave off the heavy GUI to let it do what it does best-routing. I call the GUI as needed by going in with ssh and typing httpd -p 81 More secure I feel as I only use RSA keys for ssh and no password authentication is possible for getting in to my router. Just make sure you can ssh in first lol.
In your DNSMasq config under Services, put addn-hosts=/tmp/dlhosts
Now if you run pixelserv, it will hang a lot, at least for my router though there have been other reports too. So in cron, put * * * * * root /bin/sh /tmp/pixelserv.sh as my quick and dirty fix.
Reboot and watch the magic. Give it a few minutes then try some domains in the lists.
Yes, I really hate ads and probably some overlap in all these files. Still not as overkill as the hphosts file, which likely would only fit in a 64MB model comfortably. Hope this helps
Posted: Mon Mar 30, 2015 23:53 Post subject: Re: This works very well!
selenia wrote:
I took the man's original format and modded it. I have not enough room for jffs on my lowly E2000 but plenty of RAM. His method does work on this shiny new build, unlike what's in the wiki. Of course, if you want to exactly copy me, grab the custom.txt from this thread https://secure.dd-wrt.com/phpBB2/viewtopic.php?p=434120&highlight= and save it as a custom script.
Replace anywhere I put 192.168.1.1 with the IP you wish to redirect to. In my case, pixelserv compiled by that custom.txt when router boots. Uncheck http and https for the router admin if you run pixelserv or it will interfere.
You can put httpd -p 81 after the killall httpd and sleep 1 if you want to have the GUI. I personally admin over ssh and leave off the heavy GUI to let it do what it does best-routing. I call the GUI as needed by going in with ssh and typing httpd -p 81 More secure I feel as I only use RSA keys for ssh and no password authentication is possible for getting in to my router. Just make sure you can ssh in first lol.
In your DNSMasq config under Services, put addn-hosts=/tmp/dlhosts
Now if you run pixelserv, it will hang a lot, at least for my router though there have been other reports too. So in cron, put * * * * * root /bin/sh /tmp/pixelserv.sh as my quick and dirty fix.
Reboot and watch the magic. Give it a few minutes then try some domains in the lists.
Yes, I really hate ads and probably some overlap in all these files. Still not as overkill as the hphosts file, which likely would only fit in a 64MB model comfortably. Hope this helps