Zum Inhalt

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.

OpenWrt - Adblock

/etc/init.d/adblock start

A new menu will appear Services --> Adblock

OpenWrt - Adblock

General Settings

OpenWrt - Adblock

Additional Settings

OpenWrt - Adblock

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

OpenWrt - Adblock

Advanced DNS Settings

OpenWrt - Adblock

Advanced Report Settings

OpenWrt - Adblock

Create the report directory.

mkdir /mnt/sda1/adblock/reports

Advanced E-Mail Settings

OpenWrt - Adblock

Blocklist Sources

OpenWrt - Adblock

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 ....

OpenWrt - Adblock

Create your own restart job using the LuCi interface.

OpenWrt - Adblock

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.

OpenWrt - Adblock

In the section Lastest DNS Requests you can add websites to the black or white list.

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.

Donation via PayPalDonation via LiberaPay

Donation via Bitcoin
Bitcoin Address: bc1qfuz93hw2fhdvfuxf6mlxlk8zdadvnktppkzqzj

Source

Official OpenWrt Logo - https://OpenWrt.org/_media/docs/guide-graphic-designer/OpenWrt-logo-usage-guidelines.pdf