There are many discussions on the forum and it takes some time to get overview about adblock possibilities. I found Adblock working configuration in this post - https://forum.turris.cz/t/adblock-package-release-for-turris-omnia/4912/23. It works on Turris Omnia router with OS 3.9.2 and Adblock 3.4.3.
Link to the latest adblock online documentation: https://github.com/openwrt/packages/blob/master/net/adblock/files/README.md
[optional] Change current dir to /tmp, so you do not write to the Turris’ (precious) internal Flash memory. But you can use any directory you like…
Download the adblock packages: adblock and luci-app-adblock. You will always find the latest versions on these pages: adblock package and luci-app-adblock. It is OK to use the x86_64 packages, because they are not binaries. Use proper links in wget commands below, e.g.:
wget https://downloads.openwrt.org/snapshots/packages/x86_64/packages/adblock_3.4.3-1_all.ipk wget https://downloads.openwrt.org/snapshots/packages/x86_64/luci/luci-app-adblock_git-18.020.50283-194e429-1_all.ipk
Install both packages:
opkg install adblock_3.4.3-1_all.ipk opkg install luci-app-adblock_git-18.020.50283-194e429-1_all.ipk
Enable the module. First of all, check the present state by running:
/etc/init.d/adblock enabled; echo $? 1
Please note that the script returned 1, which means the module is NOT enabled (or maybe some other problem).
Enable adblock and check the state again:
/etc/init.d/adblock enable /etc/init.d/adblock enabled; echo $? 0
Note that adblock will have to be 'enabled' again, elsewhere (in /etc/config/adblock: see below).
Now, go to the LuCI web interface, Services → Adblock page and make the following changes from the 'default' pre-set:
Finally, hit “Save & Apply” button to save all changes and start adblock processing.
Rather than use LuCI, you can configure adblock via the command line, for example:
uci set adblock.global.adb_enabled='1' uci set adblock.global.adb_dns='kresd' uci set adblock.global.adb_trigger='timed' uci set adblock.global.adb_fetchutil='wget' uci commit
Finally start adblock processing with:
Check the adblock status with the following command or in LuCI in Section “Runtime Information”:
/etc/init.d/adblock status ::: adblock runtime information + adblock_status : enabled + adblock_version : 3.4.3 + overall_domains : 22747 (normal mode) + fetch_utility : /usr/bin/wget (built-in) + dns_backend : kresd (/etc/kresd) + last_rundate : 16.01.2018 13:05:43 + system_release : Turris Omnia, OpenWrt omnia 15.05/3.9.2
View log file:
grep "adblock-" /var/log/messages
Check the existence of new definitions-file for kresd:
ls -lh /etc/kresd/adb_list.overall -rw-r--r-- 1 root root 1.0M Sep 16 23:51 /etc/kresd/adb_list.overall
Let’s try to resolve some Ad-domain:
nslookup securepubads.g.doubleclick.net localhost Server: 127.0.0.1 Address 1: 127.0.0.1 localhost
nslookup: can't resolve 'securepubads.g.doubleclick.net': Name does not resolve
If you get “Name does not resolve”, the AdBlocking is working correctly.
Well, and that’s all! Happy ad-blocking! :slight_smile:
Add a cronjob for regular block list updates (/etc/crontabs/root), e.g. list update every day 6 o'clock in the morning:
0 06 * * * /etc/init.d/adblock reload
rm -rf /tmp/luci-*
Follow instruction in Download and install latest packages section.
After installation apply changes in configs (merge adblock-opkg into adblock). After this reload configuration:
Stop all adblock related services with
/etc/init.d/adblock stop; /etc/init.d/adblock disable
Remove the adblock package (and the LuCI page, which depends on it)
opkg remove adblock --force-removal-of-dependent-packages