Block adware and malware on DDWRT routers

jfish

VIP Member
VIP Member
Joined
Sep 21, 2007
Messages
3,204
Reaction score
699
The following will block addware and maleware via the use of DNSMasq on a DDWRT router. It uses a host file that is updated on a daily.

1 - you will need a DDWRT router - will also work on Tomato based router but not tested

2 - in DHCP settings on your router ensure following are enabled

Use DNSMasq for DHCP
Use DNSMasq for DNS

Save and Apply settings

3 - In the DNSMasq settings found under Services tab, ensure following is enabled

DNSMasq
Enable Disable
Local DNS

in the Additional DNSMasq settings enter following

addn-hosts=/tmp/malwaredomain

Save and Apply settings

4 - Go into Administration tab and in the commands window enter following and save as start up

sleep 10
cd /tmp
rm malwaredomain
wget -qO /tmp/malwaredomain http://sbc.io/hosts/hosts
stopservice dnsmasq && startservice dnsmasq

Save and Apply settings

Reboot the router

so what does this do, the script will download a host file - more info here StevenBlack/hosts
the host file is then used when you do a DNS query and if the hostname is in the list of suspicious sites, DNS will return 0.0.0.0, a non-routable meta-address used to designate an invalid, unknown or non-applicable target.

To update the list you will need to reboot the router, when I get time I will do a cron job to run every 12 hours
 
makes me want to install DDWRT on my night hawk router.
 
i installed DDWRT on my router and tested this and it DOES work.
 
Back
Top