In this quick guide we will see how to setup adblocker on OpenWrt router. I tested this on PandoraBox (OpenWrt based firmware for Xiaomi Mi3 router) and it works beautifully.
Installing necessary packages
We need to install some packages before setting up adblocker. First SSH into your router then execute the below commands (execute those commands one by one)
wget --no-check-certificate https://gist.githubusercontent.com/k4mrul/6d0e395e5a332c2a2c27756d0d3b4c51/raw/dba9996ff7a0cd5973fe5ef93dbb0909d49cc180/ssl-in-wget.sh
chmod +x ssl-in-wget.sh
Setting up adblocker
Execute those below commands to download my custom adblocker script into /etc directory. The script will block ads and porn sites. You can modify the script if you want
Now give proper permission to adblock.sh script and execute
chmod +x adblock.sh
Done! If you need to add a website to whitelist, simply open
/etc/white.list file and add your website. Then execute the below command.