Page 1 of 1

Ad blocking implementation

Posted: Tue May 28, 2013 7:25 am
by foreverstorm
Hi, I have tried to make a universal adblock on my gargoyle WR1043ND router running the latest 1.5.10-ar71xx firmware, but I haven't got it working quite right yet and need some help.

I got a block list from and added it to the etc/hosts file using WinSCP. That works fine - but I find the messages saying url cannot be found in place of the ads still annoying.

I wanted to implement a pixelserv from, but I can't get it to run. In /etc/init.d/pixelserv I have the (set to be executable) code

Code: Select all

#!/bin/sh /etc/rc.common



start() {
       service_start /sbin/

and in usr/sbin/ I have the (1.0 daemon) code

Code: Select all

#! /usr/bin/perl -Tw

use IO::Socket::INET;

$pixel=pack("C*",qw(71 73 70 56 57 97 1 0 1 0 128 0 0 255 255 255 0 0 0 33 249 4 1 0 0 0 0 44 0 0 0 0 1 0 1 0 0 2 2 68 1 0 59));

$sock = new IO::Socket::INET (  LocalHost => '',
                                LocalPort => '80',
                                Proto => 'tcp',
                                Listen => 30,
                                Reuse => 1);

if (!defined($sock)) {
        print "error : cannot bind : $! exit\n";

while ($new_sock = $sock->accept()) {
       while (<$new_sock>) {
#             print "$_\n";
              if ($_ eq '') { last; }
        print $new_sock "HTTP/1.1 200 OK$crlf";
        print $new_sock "Content-type: image/gif$crlf";
        print $new_sock "Accept-ranges: bytes$crlf";
        print $new_sock "Content-length: 43$crlf$crlf";
       print $new_sock $pixel;


It doesn't make a difference, however.

If it's too difficult to setup on the router - I also have a synology nas that might be able to host it, but I'm not sure how that would be done.

Any ideas?

Re: Ad blocking implementation

Posted: Tue May 28, 2013 9:05 am
by powerlogy
Done that with a second ip interface on router,firewall rule and a web server.

There was a openwrt topic about that on openwrt forums.
Here is the link : ... 51#p197151

Re: Ad blocking implementation

Posted: Tue May 28, 2013 11:06 am
by foreverstorm
Thanks, that looks like what I'm after. But I'm stuck at the second block of commands; as soon as I enter uci add uhttpd uhttpd I get the message uci: Entry not found. Is there something else I need to do first?

Re: Ad blocking implementation

Posted: Sun Jun 02, 2013 12:44 pm
by lakyljuk
I would like to have this solution working as well, because I have the same router and would like to get rid of adblock chrome extension in every computer behind router. If some one experienced could advice, how to make it work, it would be appreciated, thanks.