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.
Go to all articles of this series and the description of the test setup:

- Ad Block
- General Settings
- Additional Settings
- Advanced Settings
- Advanced DNS Settings
- Advanced Report Settings
- Advanced E-Mail Settings
- Blocklist Sources
- Automtic Restart
- AdBlock Report
- Links
- Logrotate
Ad Block
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.
➡ https://github.com/openwrt/packages/tree/master/net/adblock/files
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
Gib mir gerne einen Kaffee ☕ aus!
Wenn dir meine Beiträge gefallen und geholfen haben, dann kannst du mir gerne einen Kaffee ☕ ausgeben.
bc1qfuz93hw2fhdvfuxf6mlxlk8zdadvnktppkzqzj
Advanced E-Mail Settings

Blocklist Sources

The lists are maintained on GitHub
➡ https://github.com/StevenBlack/hosts
Automtic Restart
You can enter a cron to 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
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 ne logrotate script for adblock
nano adblock-log
/mnt/sda1/adblock/reports {
rotate 4
daily
missingok
notifempty
compress
delaycompress
sharedscripts
endscript
}
See all articles of this series …
… on strobelstefan.org
➡ Overview of all OpenWRT Articles/
Gib mir gerne einen Kaffee ☕ aus!
Wenn dir meine Beiträge gefallen und geholfen haben, dann kannst du mir gerne einen Kaffee ☕ ausgeben.
bc1qfuz93hw2fhdvfuxf6mlxlk8zdadvnktppkzqzj
Source:
– https://openwrt.org/
– https://openwrt.org/_media/docs/guide-graphic-designer/openwrt-logo-usage-guidelines.pdf

ist absolut technik-begeistert und großer Fan von Linux und Open Source. Raspberry Pi Bastler der ersten Stunde und nach wie vor begeistert von dem kleinen Stück Hardware, auf dem er tolle Projekte umsetzt. Teilt hier seine Erfahrungen mit Nextcloud, Pi-hole, YubiKey, Synology und openmediavault und anderen spannenden IT-Themen. Nutzt Markdown und LaTeX zum Dokumentieren seiner Projekte und Gitea zum Versionieren. Sitzt vor einem 49“ Monitor, nutzt Windows und MacOS zum Arbeiten, Linux auf seinen Servern und virtuellen Maschinen und hört dabei Spotify und MP3s und Radio-Streams über seinen RadioPi.