Ad blocking

From DD-WRT Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 11:10, 4 January 2008 (edit)
Denied (Talk | contribs)

← Previous diff
Revision as of 11:11, 4 January 2008 (edit) (undo)
Denied (Talk | contribs)

Next diff →
Line 17: Line 17:
echo "45 23 * * 5 root /tmp/dlhosts" >> /tmp/crontab echo "45 23 * * 5 root /tmp/dlhosts" >> /tmp/crontab
-</pre></code>+</code></pre>
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:11, 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:


<code>
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 

</code>

Enable DNSMasq and Local DNS in Services tab; no Additional DNSMasq options necessary.

Ensure cron is enabled.