Last active
September 4, 2023 18:28
-
-
Save bsodmike/1d9da5ff882ea6c95381fd1c1d97bcea to your computer and use it in GitHub Desktop.
Revisions
-
bsodmike revised this gist
Sep 11, 2017 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,9 @@ # Ubiquity EdgeMAX Ad Blocking Content Filtering using EdgeRouter This is [based on a guide on the Ubnt forums](https://help.ubnt.com/hc/en-us/articles/205223340). Log into your Edgerouter and run the following - `sudo -i && vi /config/user-data/update-adblock-dnsmasq.sh` This will switch you to the root user and open up `vi`. ``` -
bsodmike created this gist
Sep 11, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,44 @@ # Ubiquity EdgeMAX Ad Blocking Content Filtering using EdgeRouter This is [based on](https://help.ubnt.com/hc/en-us/articles/205223340) `sudo -i && vi /config/user-data/update-adblock-dnsmasq.sh` ``` #!/bin/bash ad_list_url="http://pgl.yoyo.org/adservers/serverlist.php?hostformat=dnsmasq&showintro=0&mimetype=plaintext" #The IP address below should point to the IP of your router or to 0.0.0.0 pixelserv_ip="0.0.0.0" ad_file="/etc/dnsmasq.d/dnsmasq.adlist.conf" temp_ad_file="/etc/dnsmasq.d/dnsmasq.adlist.conf.tmp" curl -s $ad_list_url | sed "s/127\.0\.0\.1/$pixelserv_ip/" > $temp_ad_file if [ -f "$temp_ad_file" ] then #sed -i -e '/www\.favoritesite\.com/d' $temp_ad_file mv $temp_ad_file $ad_file else echo "Error building the ad list, please try again." exit fi /etc/init.d/dnsmasq force-reload ``` ``` sudo -i chmod a+x /config/user-data/update-adblock-dnsmasq.sh sh /config/user-data/update-adblock-dnsmasq.sh (crontab -l ; echo "56 4 * * 6 /config/user-data/update-adblock-dnsmasq.sh") | crontab - ``` Visit the following sites to confirm the ad-blocker is working: - https://thepcspy.com/blockadblock/ - https://ads-blocker.com/testing/ # References This is based on a [YouTube video by Willie Howe](https://www.youtube.com/watch?v=KrAwg1inp2E).