Ad blocking
From DD-WRT Wiki
(Difference between revisions)
Revision as of 11:04, 4 January 2008 (edit) Denied (Talk | contribs) (New page: This script, courtesy of several people on the forums who probably should be named, will enable host-based ad blocking; I tested this on my WRT54GS v4 and WRT54GL v1.0 both running dd-wrt ...) ← Previous diff |
Revision as of 11:05, 4 January 2008 (edit) (undo) Denied (Talk | contribs) m Next diff → |
||
Line 5: | Line 5: | ||
- | + | <pre> | |
- | + | logger WAN UP Script Executing | |
sleep 5 | sleep 5 | ||
test -s /tmp/dlhosts | test -s /tmp/dlhosts | ||
Line 17: | Line 17: | ||
echo "45 23 * * 5 root /tmp/dlhosts" >> /tmp/crontab | echo "45 23 * * 5 root /tmp/dlhosts" >> /tmp/crontab | ||
- | + | </big> | |
- | + | ||
Enable DNSMasq and Local DNS in Services tab. No Additional DNSMasq options necessary. | Enable DNSMasq and Local DNS in Services tab. No Additional DNSMasq options necessary. | ||
Ensure cron is enabled. | Ensure cron is enabled. |
Revision as of 11:05, 4 January 2008
This script, courtesy of several people on the forums who probably should be named, will enable host-based ad blocking; I tested this on my WRT54GS v4 and WRT54GL v1.0 both running dd-wrt RC5 std.
Current uptime is 11 days, memory hovers around 700kb free (14108 avail), was approximately 2000kb free before the script:
logger WAN UP Script Executing sleep 5 test -s /tmp/dlhosts if [ $? == 1 ] ; then echo -e "#!/bin/sh\nwget -O - http://www.mvps.org/winhelp2002/hosts.txt | grep 127.0.0.1 | sed -e '2,\$s/127.0.0.1/0.0.0.0/g' -e 's/[[:space:]]*#.*$//' > /tmp/hosts\nlogger DOWNLOADED http://www.mvps.org/winhelp2002/hosts.txt\nkillall -1 dnsmasq" > /tmp/dlhosts chmod 777 /tmp/dlhosts /tmp/dlhosts fi ln -s /tmp/hosts /etc/hosts echo "45 23 * * 5 root /tmp/dlhosts" >> /tmp/crontab </big> Enable DNSMasq and Local DNS in Services tab. No Additional DNSMasq options necessary. Ensure cron is enabled.