What's new

[How-to] Adblock Plus filters right on router

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Thanks spalife, I'll check the setup when I get home later. The odd thing is that the setup instructions use wget and they worked up until the point I got stuck.

Also, is there a way to block https ads like those on youtube on the Chromecast? I'll be happy to pay to get rid of them when I have the opportunity, but that facility is not available in the UK yet.


It can be done but it requires a bit of technical savvy and patience.

Follow @kvic posts in this thread and other posts by him about ad blocking with combined hosts file, pixel serv, setting up certificates etc.,
 
Privoxy on router is meant for mobile devices like Phones/Tablets etc.,.

You maybe encountering issues with Privoxy filters when trying to
access/modify ASUS WebUI through Phone/Tablet which are utilizing
Privoxy for Adblocking.

Have you tried accessing WebUI through a Laptop/Desktop or any machine which
is not utilizing privoxy for adblocking?
 
Privoxy on router is meant for mobile devices like Phones/Tablets etc.,.

You maybe encountering issues with Privoxy filters when trying to
access/modify ASUS WebUI through Phone/Tablet which are utilizing
Privoxy for Adblocking.

Have you tried accessing WebUI through a Laptop/Desktop or any machine which
is not utilizing privoxy for adblocking?
I want to add all my phones and tablets to privoxy. Some of the devices connected via OpenVPN. How can I edit the seetings to add all openvpn connections? And can I use privoxy with optware-ng? or privoxy run only on entware?
 
Someone else can chime in on optware-ng & privoxy
or you can browse through this thread and see if someone else has tried it.

I use entware-ng privoxy and it works fine.

You can add all your devices similarly through assigned IP in admin panel.

Router Admin UI->Lan->DHCP Server->Manually Assigned IP and
adding the ip-tables routing in firewall as mentioned in the How-To at the beginning
of this guide.

If some of the devices you are connecting are browsing through VPN (with SSL)
you might find privoxy not effective, as it does not apply it's filter's on encrypted (SSL) content.
 
"Some of the devices connected via OpenVPN"

You aren't clear but there are two scenarios. If the devices connected to router as OpenVPN server, it's easy to redirect web traffic through Privoxy.

A second scenario (which I guess it's ur case) is you route some devices on your LAN through VPN where your router as OpenVPN client. It's a bit tricky to route web traffic through Privoxy in this case.

I added back Privoxy to my adblock arsenal :p but I only have two custom rules and run in scenario #1. I believe it's superior to any iOS based adblock apps!
 
Hi @ryzhov_al , I need to ask you one thing by PM but I'm unable to write you...
 
I've turned off private messages because most of users do not use it for private messages, sorry. If subject of discussion is not private, please, ask on forum.
 
Thank you ryzhov for the swift reply; I post a new thread on General Wireless Discussion
 
Hi,

This is a great script and thread. I have followed the instructions on the Merlin Wiki very carefully and it all seems to be configured correctly, however, I am still seeing ads.

The privoxy log shows a few errors

Code:
2016-01-21 19:03:09.309 400c5000 Info: Privoxy version 3.0.23
2016-01-21 19:03:09.312 400c5000 Info: Program name: privoxy
2016-01-21 19:03:09.313 400c5000 Info: Loading filter file: /opt/etc/privoxy/default.filter
2016-01-21 19:03:09.341 400c5000 Info: Loading filter file: /opt/etc/privoxy/easylistgermany.script.filter
2016-01-21 19:03:09.359 400c5000 Error: Adding re_filter job 'input[onclick[/&:?=_]="window\.open('http://www\.firstload\.de/affiliate/"]' to filter easylistgermany failed: (pcrs:) Synta$
2016-01-21 19:03:09.361 400c5000 Info: Loading filter file: /opt/etc/privoxy/easylist.script.filter
2016-01-21 19:03:09.408 400c5000 Error: Adding re_filter job 's|<([a-zA-Z0-9]+)\s+.*id=.?\5f _mom_ad_12.*>.*</\1>||g' to filter easylist failed: Unknown error. Privoxy out of sync with P$
2016-01-21 19:03:09.409 400c5000 Error: Adding re_filter job 's|<([a-zA-Z0-9]+)\s+.*id=.?\5f _mom_ad_2.*>.*</\1>||g' to filter easylist failed: Unknown error. Privoxy out of sync with PC$
2016-01-21 19:03:56.199 400c5000 Error: Adding re_filter job '[lazy-ad="lefttop_banner"]' to filter easylist failed: (pcrs:) Syntax error while parsing command
2016-01-21 19:03:56.204 400c5000 Error: Adding re_filter job 's|onclick[/&:?=_]="window\.open('http://adultfriendfinder\.com/search/">||g' to filter easylist failed: Unknown error. Privo$
2016-01-21 19:03:56.487 400c5000 Error: Adding re_filter job 's|<a.*href[/&:?=_]="http://api\.taboola\.com/"][href*="/recommendations\.notify-click?app\.type=".*>.*</a>||g' to filter eas$
2016-01-21 19:03:56.736 400c5000 Error: Adding re_filter job 's|<a.*href[/&:?=_]="http://games\.ucoz\.ru/"][target="_blank".*>.*</a>||g' to filter easylist failed: Unknown error. Privoxy$
2016-01-21 19:03:57.004 400c5000 Error: Adding re_filter job 's|<a.*href[/&:?=_]="http://taboola-"][href*="/redirect\.php?app\.type=".*>.*</a>||g' to filter easylist failed: Unknown erro$
2016-01-21 19:03:57.710 400c5000 Error: Adding re_filter job 's|<a.*onmousedown[/&:?=_]="this\.href='http://paid\.outbrain\.com/network/redir?"][target="_blank".*>.*</a>||g' to filter ea$
2016-01-21 19:03:57.715 400c5000 Error: Adding re_filter job 's|<a.*onmousedown[/&:?=_]="this\.href='http://paid\.outbrain\.com/network/redir?"][target="_blank".*>.*</a>||g + \.ob_source$
2016-01-21 19:03:57.721 400c5000 Error: Adding re_filter job 's|<a.*onmousedown[/&:?=_]="this\.href='http://staffpicks\.outbrain\.com/network/redir?"][target="_blank".*>.*</a>||g' to fil$
2016-01-21 19:03:57.726 400c5000 Error: Adding re_filter job 's|<a.*onmousedown[/&:?=_]="this\.href='http://staffpicks\.outbrain\.com/network/redir?"][target="_blank".*>.*</a>||g + \.ob_$
2016-01-21 19:03:57.732 400c5000 Error: Adding re_filter job 's|<a.*onmousedown[/&:?=_]="this\.href='https://paid\.outbrain\.com/network/redir?"][target="_blank".*>.*</a>||g' to filter e$
2016-01-21 19:03:57.737 400c5000 Error: Adding re_filter job 's|<a.*onmousedown[/&:?=_]="this\.href='https://paid\.outbrain\.com/network/redir?"][target="_blank".*>.*</a>||g + \.ob_sourc$
2016-01-21 19:03:57.750 400c5000 Error: Adding re_filter job 'div[id[/&:?=_]="MarketGid"]' to filter easylist failed: Unknown error. Privoxy out of sync with PCRE?
2016-01-21 19:03:57.755 400c5000 Error: Adding re_filter job 'div[id[/&:?=_]="YFBMSN"]' to filter easylist failed: (pcrs:) Syntax error while parsing command
2016-01-21 19:03:57.761 400c5000 Error: Adding re_filter job 'div[id[/&:?=_]="acm-ad-tag-"]' to filter easylist failed: (pcrs:) Syntax error while parsing command
2016-01-21 19:03:57.767 400c5000 Error: Adding re_filter job 'div[id[/&:?=_]="dfp-ad-"]' to filter easylist failed: (pcrs:) Syntax error while parsing command
2016-01-21 19:03:57.772 400c5000 Error: Adding re_filter job 'div[id[/&:?=_]="div-gpt-ad-"]' to filter easylist failed: Unknown error. Privoxy out of sync with PCRE?
2016-01-21 19:03:57.778 400c5000 Error: Adding re_filter job 'div[id[/&:?=_]="dmRosAdWrapper"]' to filter easylist failed: (pcrs:) Syntax error while parsing command
2016-01-21 19:03:57.784 400c5000 Error: Adding re_filter job 'div[itemtype="http://schema\.org/WPAdBlock"]' to filter easylist failed: (pcrs:) Syntax error while parsing command
2016-01-21 19:03:57.790 400c5000 Error: Adding re_filter job 'div[itemtype="http://www\.schema\.org/WPAdBlock"]' to filter easylist failed: (pcrs:) Syntax error while parsing command
2016-01-21 19:03:57.795 400c5000 Error: Adding re_filter job 'iframe[id[/&:?=_]="google_ads_frame"]' to filter easylist failed: (pcrs:) Syntax error while parsing command
2016-01-21 19:03:57.801 400c5000 Error: Adding re_filter job 'iframe[id[/&:?=_]="google_ads_iframe"]' to filter easylist failed: (pcrs:) Syntax error while parsing command
2016-01-21 19:03:57.806 400c5000 Error: Adding re_filter job 'iframe[src[/&:?=_]="http://ad\.yieldmanager\.com/"]' to filter easylist failed: (pcrs:) Syntax error while parsing command
2016-01-21 19:03:57.812 400c5000 Error: Adding re_filter job 'iframe[src[/&:?=_]="http://cdn1\.adexprt\.com/"]' to filter easylist failed: (pcrs:) Syntax error while parsing command
2016-01-21 19:03:57.818 400c5000 Error: Adding re_filter job 'iframe[src[/&:?=_]="http://cdn2\.adexprt\.com/"]' to filter easylist failed: (pcrs:) Syntax error while parsing command
2016-01-21 19:03:57.824 400c5000 Error: Adding re_filter job 'img[alt[/&:?=_]="frackbook"]' to filter easylist failed: (pcrs:) Syntax error while parsing command
2016-01-21 19:03:58.547 400c5000 Info: Loading filter file: /opt/etc/privoxy/user.filter
2016-01-21 19:03:58.552 400c5000 Info: Loading actions file: /opt/etc/privoxy/match-all.action
2016-01-21 19:03:58.563 400c5000 Info: Loading actions file: /opt/etc/privoxy/default.action
2016-01-21 19:03:58.593 400c5000 Info: Loading actions file: /opt/etc/privoxy/easylistgermany.script.action
2016-01-21 19:03:58.663 400c5000 Info: Loading actions file: /opt/etc/privoxy/easylist.script.action
2016-01-21 19:03:58.959 400c5000 Info: Loading actions file: /opt/etc/privoxy/user.action
2016-01-21 19:03:58.968 400c5000 Info: Listening on port 3128 on IP address 0.0.0.0

My config

Code:
confdir /opt/etc/privoxy
logdir /opt/var/log
filterfile default.filter
logfile privoxy
actionsfile match-all.action # Actions that are applied to all sites and maybe overruled later on.
actionsfile default.action   # Main actions file
actionsfile easylistgermany.script.action
actionsfile easylist.script.action
actionsfile user.action
filterfile easylistgermany.script.filter
filterfile easylist.script.filter
filterfile user.filter
listen-address  0.0.0.0:3128
toggle  1
enable-remote-toggle  1
enable-remote-http-toggle  0
enable-edit-actions 1
enforce-blocks 0
buffer-limit 4096
forwarded-connect-retries  0
accept-intercepted-requests 1
allow-cgi-request-crunching 0
split-large-forms 0
keep-alive-timeout 300
socket-timeout 300
#permit-access  192.168.1.0/24
debug   1    # show each GET/POST/CONNECT request
debug   4096 # Startup banner and warnings
debug   8192 # Errors - *we highly recommended enabling this*
#admin-address privoxy-admin@example.com
#proxy-info-url http://www.example.com/proxy-service.html

My router log only shows one entry:
Code:
Jan 26 13:50:04 admin: Started privoxy from .

Could someone please advise on first steps in troubleshooting the config?

I am on the latest Merlin firmware 380.57 and an Asus RT-ac56u.

Many thanks!
 
Last edited:
1.
The errors in the privoxy log are normal, they occur when the translation script
fails to accurately translate few of the lists to privoxy filters and actions.

2.
Privoxy logging is not visible in syslog (i.e., web ui).
You can use below command when you are browsing through your privoxy enabled device in a seperate shell/terminal/ssh window to see whether privoxy is working on ad blocking
tail -f /tmp/mnt/YOURUSBDRIVEMOUNTNAME/logs/privoxy

3.
After Point 2 you will get more accurate information whether privoxy is working
on adblocking and perhaps you can add few more blocking filters to the privoxy blocklist shell script
- https://easylist-downloads.adblockplus.org/adwarefilters.txt
- https://easylist-downloads.adblockplus.org/easyprivacy.txt
- https://easylist-downloads.adblockplus.org/antiadblockfilters.txt
 
Hello world, first post. A long one at that, my apologies.

I'm using the good Mr. Ryzhov's guide on GitHub to setup privoxy for blocking ads, but I'm having trouble getting all this set up properly. I can run through it all with no error messages, but it either refuses to block any ads, or in the case of my desktop, refuse to do anything (even connect to my router locally!). I had never used SSH/Telnet, but I have a tad bit of experience with linux and a decent amount with windows CMD, so I believe I've adjusted all right.

First off, I'm running the latest version of merlin as of this post on my RT-AC66U. I can get entware up and running, and install all the packages with no problem EXCEPT for wget-ssl. I can install wget though, and after doing so the rest will run with no errors, aside from not actually doing anything when it's finished.

Second, I'm not ENTIRELY sure if I did this correctly, but I edited the "privoxy-blocklist_0.2.sh" using NANO, and honestly have no idea if I did it as I needed. I have tried it once before with the default ones that the guide uses, to no avail, and then did a clean format of my jffs and storage device to remove any possible configuration errors, and tried again from a clean slate, with no success.

Any help would be greatly appreciated. I've removed everything except merlin at this point, so everything is stable.
I can post more info on my setup if anyone needs it, I just don't know what all is relevant here.

EDIT: Forgot to mention, I've looked through this thread from the beginning, and haven't found someone with an issue like mine or advice applicable to my problem.
 
I followed the guide in post#1 and have 2 problems:

1. After "opkg install bash wget-ssl sed privoxy" I get this error: "Cannot install package wget-ssl"
2. I continued anyway, but got stuck at "Mark the script as executable so we can run it: chmod +x ./privoxy-blocklist_0.2.sh"
How do I edit the script?

Sorry, I'm not very good with this, I can follow step by step but may not understand all the terminology...
I'm using a Mac's terminal to do this.
 
I followed the guide in post#1 and have 2 problems:

1. After "opkg install bash wget-ssl sed privoxy" I get this error: "Cannot install package wget-ssl"
2. I continued anyway, but got stuck at "Mark the script as executable so we can run it: chmod +x ./privoxy-blocklist_0.2.sh"
How do I edit the script?

Sorry, I'm not very good with this, I can follow step by step but may not understand all the terminology...
I'm using a Mac's terminal to do this.


I am assuming you have ssh'd into the router using Mac's Terminal
(i.e., ssh admin@192.168.1.1)

1. the below command lists out all the packages installed using
opkg install (make sure wget is installed, if not run opkg install wget)
opkg list-installed

(wget-ssl should not stop you from your privoxy installation/configuration)

2. Recommend using nano to editing files (much easier)
opkg install nano

3. You need to go to the Privoxy installation folder to update the file permissions
cd /opt/etc/privoxy
chmod +x privoxy-blocklist_0.2.sh

4. To edit the privoxy block list shell script file
nano privoxy-blocklist_0.2.sh
 
I am assuming you have ssh'd into the router using Mac's Terminal
(i.e., ssh admin@192.168.1.1)

1. the below command lists out all the packages installed using
opkg install (make sure wget is installed, if not run opkg install wget)
opkg list-installed

(wget-ssl should not stop you from your privoxy installation/configuration)

2. Recommend using nano to editing files (much easier)
opkg install nano

3. You need to go to the Privoxy installation folder to update the file permissions
cd /opt/etc/privoxy
chmod +x privoxy-blocklist_0.2.sh

4. To edit the privoxy block list shell script file
nano privoxy-blocklist_0.2.sh

I finally have time to follow your steps.

Turns out "cd /opt/etc/privoxy" to enter the Privoxy installation folder is the step missing to run through the terminal scripts.

Thank you so much!
 
Hey guys, looking to set this up but I seem to be a bit clueless. I don't have much experience in linux but I mess around in windows command prompt, and am learning cisco ios so not too clueless for cli.
But I seem to have hit a wall. I formatted an 8gb usb as ext and trying to install entware and get these errors.
I tried ls and not seeing anything. I tried mkdir for opt and it works but running entware-setup.sh again still says no folder.
Any ideas where to go from here?



Code:
admin@RT-N66U-32B0:/tmp/home/root# entware-setup.sh
Info:  This script will guide you through the Entware installation.
Info:  Script modifies only "entware" folder on the chosen drive,
Info:  no other data will be touched. Existing installation will be
Info:  replaced with this one. Also some start scripts will be installed,
Info:  the old ones will be saved on partition where Entware is installed
Info:  like /tmp/mnt/sda1/jffs_scripts_backup.tgz

Info:  Looking for available partitions...
[1] --> /tmp/mnt/asusrout
=>  Please enter partition number or 0 to exit
[0-1]: 1
Info:  /tmp/mnt/asusrout selected.

* Warning:  Found previous installation, saving...
Info:  Creating /tmp/mnt/asusrout/entware folder...
Info:  Creating /tmp/opt symlink...
ln: /tmp/opt: File exists
Info:  Creating /jffs scripts backup...
tar: removing leading '/' from member names
Info:  Modifying start scripts...
Info:  Starting Entware deployment....

--2016-05-29 17:14:04--  http://entware.wl500g.info/binaries/entware/installer/entware_install.sh
Resolving entware.wl500g.info... 81.4.123.217
Connecting to entware.wl500g.info|81.4.123.217|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 781 [text/x-sh]
Saving to: 'entware_install.sh.5'

entware_install.sh.5          100%[===================================================>]     781  --.-KB/s   in 0s

2016-05-29 17:14:06 (8.06 MB/s) - 'entware_install.sh.5' saved [781/781]

Info: Creating folders...
mkdir: can't create directory '/opt/': No such file or directory
mkdir: can't create directory '/opt/': No such file or directory
mkdir: can't create directory '/opt/': No such file or directory
mkdir: can't create directory '/opt/': No such file or directory
mkdir: can't create directory '/opt/': No such file or directory
mkdir: can't create directory '/opt/': No such file or directory
mkdir: can't create directory '/opt/': No such file or directory
mkdir: can't create directory '/opt/': No such file or directory
mkdir: can't create directory '/opt/': No such file or directory
mkdir: can't create directory '/opt/': No such file or directory
Info: Opkg package manager deployment...
/opt/bin/opkg: No such file or directory
chmod: /opt/bin/opkg: No such file or directory
/opt/etc/opkg.conf: No such file or directory
Info: Basic packages installation...
./entware_install.sh: line 25: opkg: not found
./entware_install.sh: line 26: opkg: not found
Info: Congratulations! If there are no errors above then Entware successfully initialized.
 
Hey guys, looking to set this up but I seem to be a bit clueless. I don't have much experience in linux but I mess around in windows command prompt, and am learning cisco ios so not too clueless for cli.
But I seem to have hit a wall. I formatted an 8gb usb as ext and trying to install entware and get these errors.
I tried ls and not seeing anything. I tried mkdir for opt and it works but running entware-setup.sh again still says no folder.
Any ideas where to go from here?



Code:
admin@RT-N66U-32B0:/tmp/home/root# entware-setup.sh
Info:  This script will guide you through the Entware installation.
Info:  Script modifies only "entware" folder on the chosen drive,
Info:  no other data will be touched. Existing installation will be
Info:  replaced with this one. Also some start scripts will be installed,
Info:  the old ones will be saved on partition where Entware is installed
Info:  like /tmp/mnt/sda1/jffs_scripts_backup.tgz

Info:  Looking for available partitions...
[1] --> /tmp/mnt/asusrout
=>  Please enter partition number or 0 to exit
[0-1]: 1
Info:  /tmp/mnt/asusrout selected.

* Warning:  Found previous installation, saving...
Info:  Creating /tmp/mnt/asusrout/entware folder...
Info:  Creating /tmp/opt symlink...
ln: /tmp/opt: File exists
Info:  Creating /jffs scripts backup...
tar: removing leading '/' from member names
Info:  Modifying start scripts...
Info:  Starting Entware deployment....

--2016-05-29 17:14:04--  http://entware.wl500g.info/binaries/entware/installer/entware_install.sh
Resolving entware.wl500g.info... 81.4.123.217
Connecting to entware.wl500g.info|81.4.123.217|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 781 [text/x-sh]
Saving to: 'entware_install.sh.5'

entware_install.sh.5          100%[===================================================>]     781  --.-KB/s   in 0s

2016-05-29 17:14:06 (8.06 MB/s) - 'entware_install.sh.5' saved [781/781]

Info: Creating folders...
mkdir: can't create directory '/opt/': No such file or directory
mkdir: can't create directory '/opt/': No such file or directory
mkdir: can't create directory '/opt/': No such file or directory
mkdir: can't create directory '/opt/': No such file or directory
mkdir: can't create directory '/opt/': No such file or directory
mkdir: can't create directory '/opt/': No such file or directory
mkdir: can't create directory '/opt/': No such file or directory
mkdir: can't create directory '/opt/': No such file or directory
mkdir: can't create directory '/opt/': No such file or directory
mkdir: can't create directory '/opt/': No such file or directory
Info: Opkg package manager deployment...
/opt/bin/opkg: No such file or directory
chmod: /opt/bin/opkg: No such file or directory
/opt/etc/opkg.conf: No such file or directory
Info: Basic packages installation...
./entware_install.sh: line 25: opkg: not found
./entware_install.sh: line 26: opkg: not found
Info: Congratulations! If there are no errors above then Entware successfully initialized.


Try again as mentioned in the Guides by formatting and partitioning the USB Drive as ext2 or ext3.

https://github.com/RMerl/asuswrt-merlin/wiki/Entware

https://github.com/RMerl/asuswrt-me...to-provide-advertisement-filtering-to-devices
 
Try again as mentioned in the Guides by formatting and partitioning the USB Drive as ext2 or ext3.

https://github.com/RMerl/asuswrt-merlin/wiki/Entware

https://github.com/RMerl/asuswrt-me...to-provide-advertisement-filtering-to-devices
Ok, I omitted the specific detail, I did format it as ext2. I'll try again as ext3.
So the the USB needs to be present at all times? Approx how much space does it need?
Edit: formatted it to ext3 and same behavior.
I initially did the formatting on Windows 10 with EaseUS. This time I deleted the partition and then created it on the router following these steps, http://www.tldp.org/HOWTO/Flash-Memory-HOWTO/ext2.html
Mounted properly, same error about creating directories.
Edit2: I think i got it. I went to \tmp and saw an entry opt there as file type l. I removed it and tried setup again and its going through.
Were IP ranges included as mentioned on page 1? I havent had a chance to try 192.168.1.50-192.168.1.55 vs just one yet as router is in use and rather avoid multiple reboots until later if not necessary.
 
Last edited:

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top