OpenWrt - Adblock
OpenWrt offers an adblock tool and extensive block lists. It blocks adds on DNS basis like a Pi-hole. The service easy to install and to configure.
All articles of the OpenWrt blog series
Powerful adblock script to block ad/abuse domains via dnsmasq, unbound, named or kresd.
The script supports many domain blacklist sites plus manual black- and whitelist overrides.
opkg install adblock luci-i18n-adblock-en luci-app-adblock luci-i18n-adblock-de tcpdump-mini
Start the adblock service after the package installation.
/etc/init.d/adblock start
A new menu will appear Services --> Adblock
General Settings
Additional Settings
The adblock files can get stored on an USB storage device.
Follow this manual to mount the external storage.
โก๏ธ OpenWrt - USB Storage Device
Create the folders for tmp
and backup
on the CLI.
mkdir /mnt/sda1/adblock
mkdir /mnt/sda1/adblock/tmp
mkdir /mnt/sda1/adblock/backup
mkdir /mnt/sda1/adblock/adb_list
mkdir /mnt/sda1/adblock/reports
Advanced Settings
Advanced DNS Settings
Advanced Report Settings
Create the report directory.
mkdir /mnt/sda1/adblock/reports
Advanced E-Mail Settings
Blocklist Sources
The lists are maintained on GitHub
Automtic Restart
You can enter a cron toe restart adblock regularly in LuCi System - Scheduled Tasks
or you use the built-in Refresh Timer ...
.
Create your own restart job using the LuCi interface.
The Line in Scheduled Tasks
looks as following.
# Adblock Reload
45 06 * * * /etc/init.d/adblock restart
You can easily create you own cron job using this web service
- ๐ https://crontab.guru
AdBlock Report
You can check the adblock report for details.
In the section Lastest DNS Requests you can add websites to the black or white list.
Links
- ๐ https://OpenWrt.org/docs/guide-user/services/ad-blocking
- ๐ https://www.linuxscrew.com/OpenWrt-adblock-ad-blocking
Logrotate
To avoid too many log files on the USB storage device you can use logrotate
to remove the files automatically.
opkg install logrotate
No LuCi app for logrotate
is available everything must be setup on CLI.
The directory where logrotate scripts are maintained is /etc/logrotate.d
.
You can easily add a new logrotate script for adblock
nano adblock-log
/mnt/sda1/adblock/reports {
rotate 4
daily
missingok
notifempty
compress
delaycompress
sharedscripts
endscript
}
All articles of the OpenWrt series
Gib mir gerne einen Kaffee ☕ aus โ๏ธ
Wenn dir meine Beitrรคge gefallen und geholfen haben, dann kannst du mir gerne einen Kaffee โ๏ธ ausgeben.
Follow Meโ๏ธ
Source
Official OpenWrt Logo - https://OpenWrt.org/_media/docs/guide-graphic-designer/OpenWrt-logo-usage-guidelines.pdf