Categories
Planning

How to remove advertisements with pixelserv on dd-wrt

The Internet is flooded populated with advertisements today. There are AdBlock plugins for browsers. But what about mobile devices like non-rooted or non-jailbroken Androids and iOS devices?

Recently, I chanced upon a Kickstarter project called AdTrap. It introduces a small zero configuration device that removes advertisements from your Internet connection before they reach any of your home devices. This device is connected between your modem and home router. Sounds cool? Yes if you are willing to fork out US$132 (inclusive of US$12 shipping if outside US / Canada).

Do I need the AdTrap project to achieve that? No!

So I gave it a thought – with dnsmasq on the TomatoUSB-enabled router (e.g. ASUS RT-N66U, Linksys E4200), I could probably achieve ad blocking with DNS Cache Poisoning on the TomatoUSB-enabled router. Too geek? In simpler terms, I can make the TomatoUSB-enabled router resolve known advertisement domain names / hostnames to invalid addresses like 0.0.0.0.

As a result, I will be able to filter advertisements from the Internet before they reach any of my devices at home.

I started to google around to see if anybody has used the DNS Cache Poisoning technique (using dnsmasq) and found that somebody actually did the scripts (http://goo.gl/mhykQ)! Did a little modification to it and here it is.

29 Apr 2014

Added Pixelserv for ASUS RT-AC68U. Download Pixelserv (ARM) v43-2.

28 Apr 2014

Pixelserv does not work on ASUS RT-AC68U as it was originally compiled for Broadcom architecture. The ASUS RT-AC68U is based on ARM architecture. Instead of using Pixelserv, I decided to use NGINX web server to perform the role of pixelserv. Check out AdBlocking with NGINX: Serving 1 pixel GIF and 204 No Content.

7 Dec 2013

Updated the script to use pixelserv V31. The changes are in the base64 encoded block. Previous version of pixelserv requires a parameter “-n br0” which is no longer required in V31. Updated the base64 block to reflect that.

Pre-requisites

  1. TomatoUSB-enabled router like ASUS RT-N66U, RT-N16, Linksys E4200. ASUS RT-AC66U
  2. Flashed to TomatoUSB firmware (I am using TomatoUSB on my RT-N66U and RT-AC66U)
  3. Geeky mind to do some troubleshooting

Inserting the AdBlocking script

  1. Using a web browser, login to the TomatoUSB web administration page
  2. Navigate to Administration -> Scripts -> WAN Up tab
  3. Copy and paste the contents below. Then save and reboot the router