router_settings.sh 644 B

123456789101112131415161718192021
  1. #!/bin/sh
  2. # Just copy and paste in your command subtab in the
  3. # administration tab in your dd-wrt router.
  4. #logger WAN up script executing
  5. if test -s /tmp/hosts0
  6. then
  7. rm /tmp/hosts0
  8. fi
  9. #logger Downloading http://www.mvps.org/winhelp2002/hosts.txt
  10. wget -O - http://www.mvps.org/winhelp2002/hosts.txt | grep 0.0.0.0 |
  11. sed 's/[[:space:]]*#.*$//g;' |
  12. grep -v localhost | tr ' ' '\t' |
  13. tr -s '\t' | tr -d '\015' | sort -u >/tmp/hosts0
  14. grep addn-hosts /tmp/dnsmasq.conf ||
  15. echo "addn-hosts=/tmp/hosts0" >>/tmp/dnsmasq.conf
  16. #logger Restarting dnsmasq
  17. killall dnsmasq
  18. dnsmasq --conf-file=/tmp/dnsmasq.conf