OpenWRT Raspberry Pi 4b WiFi Router with adblock

Not a question, but a "how to". I had a difficult time finding good instructions for how to build a basic wifi router with adblocker.

Here is what I did, and it is easily repeatable, in my opinion. I hope this helps others to get started.

OpenWRT Raspberry Pi 4b WiFi Router with adblock.

Flash OpenWRT image to a micro SD card.

Use gparted to expand the rootfs partition to fill the micro SD card.

Turn off (disable) wifi on your computer.
Unplug Ethernet cable coming from your router to your computer.
Verify that you are not connected to any other network.
Connect Raspberry Pi to your computer via Ethernet cable.
Insert the CF card into your Raspberry Pi.
Power on and boot up the Raspberry Pi.
Raspberry Pi will assign your computer an IP 192.168.1.x.
There's no password yet. Click Login.

System > Administration
Router Password password
Click Save

Network > Wireless
Enable Wireless
Edit Network
Device Configuration
Advanced Settings
Country Code - US - United States
Interface Configuration
Wireless Security
Encryption WPA2-PSK (strong security)
Cipher auto
Key password
Click Save

Network > Interfaces
Add new interface...
Name - wan
Protocol - DHCP client
Device - Ethernet Adapter: "eth0"
Click Create interface
Firewall Settings
Create / Assign firewall-zone - wan
Click Save
Edit lan interface
General Settings
Device - Wireless Network: Master "OpenWrt" (lan)
Click Save
Click Save & Apply

Within 90 seconds...
Disconnect Ethernet cable from Raspberry Pi
Turn on (enable) wifi on your computer
Connect to OpenWRT SSID with the password
This will apply the changes made to the interfaces.

Connect Ethernet cable from ISP Modem/Router to the Raspberry Pi.

System > Reboot
Perform reboot

Use a browser without an adblocker extension installed.
Use incognito mode so that you have no browser cache.

You will see ads Left, Right and Top on screen.

System > Software
Update lists...
Install adblock
Install luci-app-adblock
Install tcpdump
Install ddns-scripts
Install luci-app-ddns
Install openvpn-openssl
Install luci-app-openvpn

System > Reboot
Perform reboot

Services > Adblock
Enabled - (check)
Startup Trigger Interface - wan
Force Local DNS - (check)
Forced Zones - lan wan
Forced Ports - 53 853 5353
This will add 6 entries in the Firewall Port Forwards
DNS Report - (check)
Click Save & Apply

Network > Firewall
Port Forwards
Verify Adblock DNS Port Forwards are listed

System > Reboot
Perform reboot

Open browser without adblocker extension installed.
Use incognito mode so that you have no browser cache.

You may see boxes where ads were located before, but no ads.

Try other sites like or or

Let me know if this was helpful.

1 Like

I don't think this is necessary now in retrospect. I saw a YouTuber do it when I was learning how install OpenWRT, so I did it to mine. I haven't seen any other instruction saying to do that. Maybe later I'll make a partition for something else if I decide what to do with the extra space on the card.

I did not know what the difference between SquashFS and ext4 before I built my first working OpenWRT Pi Router. But now that I've read the differences between them, I went with SquashFS and rebuilt my router at this early stage instead of waiting. I knew, I would always want to change it, and If I keep tweaking my setup, it just gets harder to redo it in the future.