WinCoder Blog

Adblock for Buffalo WHR-G54 running DD-WRT

You can install and run adblock on your devices at home and create an ad-free experience for users of those devices, or you can block ads at the router level and block ads for every device on your network.  Using a WHR-G54 router flashed with DD-WRT I was able to implement such a solution in bash that executes on the router during boot.  As would be expected, this consists of hacks upon hacks upon hacks.

High-level overview:  Create script and house in ram, call script to download and parse adblock list to hostsfile, append hosts in hostsfile to dnsmasq config, restart web portal on port 81, redirect port 80 traffic to gateway ip to webserver on port 81 via firewall rules so things appear vanilla, download pixelserv from remote location, store in ram and initiate on current ip block ending in 254, then deploy cron job to refresh adblock list during router uptime every Friday at 11:45 PM.

To install simply copy and paste the script below into  the window  @ Administration=>Command and click “Save Startup”

WHRG54

Get the script @ Github

 

 


3 comments for “Adblock for Buffalo WHR-G54 running DD-WRT

  1. Justin
    October 15, 2014 at 9:25 pm

    Would this work with the Buffalo WZR-HP-G300NH?

    • Paul DeCarlo
      October 29, 2014 at 3:13 am

      Justin, it very well could, perhaps you could try and report your results?

  2. Saskia Zegwaard
    February 13, 2015 at 1:09 pm

    This works fine with my Buffalo WZR-HP-G450H, thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *