ALL-U-NEED Ad Blocking

Discussion in 'Tomato Firmware' started by srouquette, Nov 6, 2010.

  1. Rocky Grim

    Rocky Grim Networkin' Nut Member

    Oh so I have to upload it to the router? Where can i find steps to do that? I have no clue how to do that =( Is there an easy way to load it from a thumb drive? I have one I can format and use if someone could tell me how to do it.
  2. WaLLy3K

    WaLLy3K Networkin' Nut Member

    I'd help, but I only run this adblock script so I'm not familiar with how this one works. Generally speaking though, you would upload pixelserv to the same folder which the adblock script is installed to, SSH in and run "chmod 755 pixelserv", then try running the adblock script.

    If that makes little sense to you (if so, that's fine!), I suppose I should ask: Have you installed Entware onto your USB drive and/or are you familiar with SSH'ing into your router?
  3. Rocky Grim

    Rocky Grim Networkin' Nut Member

    Sorry I don't know anything about running scripts and logging into the router and all that stuff. I have been using tomato for a long time but never got into running scripts and uploading things to the router and all that. This is all new to me unfortunately. Its all stuff I would like to learn but it seams so hard to find the right info on how to start from a complete noob. All I want to do is be able to block ads for my 11 year old son who plays games on his android tablet. I have tried every single program I can find for android to block ads in his games but they don't work right. By pasting in this adblock script into my router alot of the ads are now blocked but it shows an image saying they are blocked so I need to get pixelserv working so it won't show that.

    Is it pretty easy to get the other script running and does it work well?
  4. WaLLy3K

    WaLLy3K Networkin' Nut Member

    No worries, we all need to start somewhere!

    If you've already got this one running, it's easiest to stick with that. You'll want to start by enabling the built in FTP server (Router Webpage > USB & NAS > FTP Server) and configure it:
    - Enable FTP: 'Yes, LAN only'
    - FTP Port: 21
    - Anon User Access: Disabled
    - Allow Admin Login: Disabled
    - Everything else: Leave as default
    - Save changes

    You can then login via a FTP app such as FileZilla using the credentials of user: "Root", password: "RouterWebpagePassword" and browse to the location where the adblock script is installed (Which if I read this script correctly, apparently it's stored in /tmp? I have no idea lol) and drop Pixelserv into /tmp. You now need to give Pixelserv permission to run. The quickest way is to go to your Router webpage and select Tools > System Commands. Run "chmod 755 /tmp/pixelserv" without quotes and restart the router (This is sloppy since I have no idea how the script normally starts itself or what parameters it's able to pass :p).

    Hopefully that gives you a point to start off with, or preferably actually does the whole job!
    Rocky Grim likes this.
  5. Rocky Grim

    Rocky Grim Networkin' Nut Member

    Thanks a lot for your help bro. I really appreciate it. I think I should be able to figure it out now. My biggest problem was fingering out how the hell to get the file on the router. Then, knowing what to type in to get the script to point to where the file is located. I actually have another computer sitting around with a Intel core 2 duo and likee 4gb of ram. I been doing some reading and if I can get things figured out I might turn that into my dedicated ad block server. I like to help devs out by paying to remove ads on our android devices but the problem is some of the games we play don't have the option to do so and have big obstructive ads right in the middle of the screen. It makes playing difficult. Thanks again for your help. I am going to give this a whirl and will post back and let ya know how it goes.

    Okay I got pixelserv transferred to tmp on the router. I did everything you said to do including running the command to execute it. I believe pixelserve is started with the script when you change the "N" to a "Y" like this in the pixserve part of the script.


    Its not working. Ads are blocked the same way as when I just have the script in the router. It shows a blocked add and says cannot connect to server. When I FTP back into the router the pixelserve file is gone for some reason.
    Last edited: Oct 30, 2014
  6. mstombs

    mstombs Network Guru Member

    The /tmp/ folder is the router ram disk, so the file will be lost on reboot/ power cycle.
    As you have an RTN-66U I'd stick a usb stick in and store the pixelserv binary there, mine mounts local to the router as /mnt/usb4gb/ and is also accessible from a windows PC on my local network - I can see the file there on

    Last edited: Oct 30, 2014
    Rocky Grim likes this.
  7. Rocky Grim

    Rocky Grim Networkin' Nut Member

    I'm pretty sure I finally figured it out fellas. I ended up uploading it through jffs. I had to use the FTP server with SCP protocol so I could chmod pixelserv. I ended up fallowing this guide. Settings are sticking after reboot. So far so good. I just hope these default adblock servers block the ads we need to block in android games because this took me all day to figure out lmao. Thanks for all your help guys. I would of never figured this crap out on my own lol.

    In the pixelserv zip what are the other pixelserv files for? There is like pixelservfast etc?
    Last edited: Oct 30, 2014
  8. mstombs

    mstombs Network Guru Member

    The different versions of pixelserv have different compiler options, normally you remove the extension of the one you want, v35-HZ10 included a, compiled with options for speed, I happen to still be using this one, not following every later development build - because this works fine for me!

    Use a browser to connect to the pixelserv IP with filename servstats, in my case:

    /mnt/usb4gb/ version: V35.HZ10 compiled: Sep 14 2014 22:08:48
    3932152 uts, 96533 req, 1340 avg, 56822 rmx, 6 err, 10516 tmo, 205 cls, 1 nou, 1 pth, 3284 nfe, 37518 ufe, 839 gif, 795 bad, 0 txt, 13 jpg, 7 png, 28 swf, 8 ico, 38269 ssl, 88 sta, 14 stt, 4937 rdr
    .tiny was compiled with minimal options, some folk used to store it in nvram, but now considered obsolete.

    HunterZ intends only to distribute on a .static in latest versions, which should work on many different firmwares. Dynamic builds are much smaller, because they assume compatible libraries already exist on the router.
    If included pixelserv.c (later versions have multiple smaller files) and is the full source code and buld script.

    NB the actual blocking is done by the adblock script which 'poisons' the router DNS server, pixelserv just provides a dumb target for redirected requests, attempting not to cause browser hangs and broken image symbols...

    A more recent adblock script, which is no longer too 'lean' has more options to add/merge multiple source blocklists and adds a web gui is under active development ...
  9. Rocky Grim

    Rocky Grim Networkin' Nut Member

    Thanks for your reply mstombs. I pulled up the log files on my router and all the host files are being loaded properly as well as pixelserv. I'm still seeing a decent amount of ads still on my android Google Nexus 5. Its definitely blocking ads on there but there is just a good bit still coming through. Is there a better block list I could possibly use?
  10. pharma

    pharma Network Guru Member

  11. mstombs

    mstombs Network Guru Member

    personally I find the very effective, sort of 80% of hits for 20% size. I also use an android app called PersonalHttpProxy with the list when away from home wifi connection. Do make sure your mobile device is using the router dns server. Do you get the null pixel with
    Last edited: Nov 1, 2014
  12. Rocky Grim

    Rocky Grim Networkin' Nut Member

    When I click on that link the page actually loads and it takes me to the website. It is not blocked. This is weird because when I go into the router logs I am showing that pixelserv is being loaded and so are the block lists.

    On my PC I am getting the null pixel. Not on my phone though and I am connected to my home network.

    Here is a little information about my home network. I have the modem/wireless router combo from Comcast. I had them put it into bridge mode so I could use my own wireless router. I am using the RT-N66U as my main router with Tomato installed. I then have it connected to a Netgear R6300v2 which is acting as a access point in my bedroom. Even still my wireless connection speeds are very slow and none of my PC's, tablets, or phones are more than 10 feet from the router or access point. Therefore, my phone tries to connect to a faster internet source which ends up being Comcast's wireless internet they give for free in my area. This seams to be the reason my ad blocking is not working as it should on my phone.
    Last edited: Nov 1, 2014
  13. mstombs

    mstombs Network Guru Member

    Your mobile device not using your router and its adblock then.

    Here's the link for the Android app I use, which uses similar blocklists, and even includes the pixelserv null gif I use (3rd party not approved by Google, use at own risk etc, does not need rooted phone)

    The way I use it the proxy has to be defined in each wireless or the Mobile Internet APN setting connection advanced properties - and you must be prepared to disable if things stop working!
  14. Rocky Grim

    Rocky Grim Networkin' Nut Member

    Thanks for your help. I went into the wireless settings on my Nexus 5 and confirmed it was using my routers DNS. However, it was still not blocking ads. It was Google Chrome causing the problem. I switched to Firefox and now the link you posted above shows the 1x1 pixel on my phone. I am going to install the problem you linked to on my phone as well. That way like you said when I am away from home I will still have adblocking. Thanks again for all your help. I really appreciate it.
  15. mstombs

    mstombs Network Guru Member

    Google Chrome is either using its own cached DNS lookups, or ignoring phone DNS settings and connecting straight to Google DNS servers, could do this via secure protocols bypassing router. I don't use Google Chrome on mobile since it still doesn't have proper fullscreen on my device, but with Firefox you can also use the great adblockplus!
    Rocky Grim likes this.
  16. remlei

    remlei Networkin' Nut Member

    well its been known that Chrome is using its own DNS server ( and so you could just enable Port 53 Interception under DHCP/DNS configuration in tomato.
    Rocky Grim and pharma like this.
  17. Rocky Grim

    Rocky Grim Networkin' Nut Member

    Anyone know if this adblock configuration will work for dd-wrt? My Netgeat R6300v2 doesn't have tomato so I would like to have both routers running the same firmware. The only firmware I found they can both run is dd-wrt.
  18. mstombs

    mstombs Network Guru Member

  19. MichaelNC

    MichaelNC Network Newbie Member

    Hi Folks, this is dummy post so I can actually post a question with some information.
  20. MichaelNC

    MichaelNC Network Newbie Member

    Hi Folks.

    I've recently upgrade my Netgear R7000 to the 130 shibby build of Tomato primarily for the OpenVPN client for Private Internet Access. I then found this article on setting up Ad blocking via the router and have spent the last several days reviewing the info and have just about got it working.

    I just have one problem, PixelServ does not appear to be working yet all the test I know about indicate it is. Sites still come up with the missing document graphic instead of a 1x1 pixel. In my log you can see it's running via USB and an NSlookup shows blacklisted sites as remapping to the Pixelserv IP. Running the PixelServ IP on both 80 and 433 gives a blank page as expected.

    Script configuration is set as:



    Any ideas as to what could be the problem? Here's a dump of my log, I had to omit several lines due this being my first post but these are the two key I believe that indicate both Pixelserv and dnssec are running.

    Aug 5 10:58:35 R7000 pixelserv[1714]: /tmp/mnt/sda1/pixelserv version: V35.HZ12WIP1 compiled: Jul 6 2015 19:20:09 options: -n br0
    Aug 5 10:58:35 R7000 daemon.notice pixelserv[1715]: Listening on br0:
    Aug 5 10:58:35 R7000 daemon.notice pixelserv[1715]: Listening on br0:
    Aug 5 10:59:32 R7000 user.notice root: ADBLOCK: dnsmasq is running

    Thanks in advance
  21. mstombs

    mstombs Network Guru Member

    Check adblock/pixelserv with (try also changing the extension to swf, bmp, jpg etc). Many ads are now served by scripts or https for which you will not get a blank pixel, adblockplus on chrome or firefox or Android does do a better job because they are embedded in you client browser.
  22. Bill_S

    Bill_S Network Guru Member

    Looking at the information above would there be a carriage return after each of the entries in the "Black" or can you place multiple domains on one line with a space or comma between them?
  23. infekto

    infekto Reformed Router Member

    Might as well use the hosts file from "stevenblack" on github since I can't post links.... it truncates all these hostfiles for you automatically...
  24. chrisanthropic

    chrisanthropic Addicted to LI Member

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice