Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
router:adblock [2024/02/13 09:25] – willy | router:adblock [Unknown date] (current) – removed - external edit (Unknown date) 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Ads Blocking ====== | ||
- | |||
- | Today' | ||
- | |||
- | Why? | ||
- | * ADs are useless bytes that needs to be downloaded **in addition** to the content you want to see, and they are usually many times more bytes that the content iself. Specially with video-ads, you might be downloading megabytes of useless data. This is a concern on data-caps but also on the environment (wasted power and such) | ||
- | * ADs can carry malwares and viruses, even //safe// web sites cannot control which ADs are server by the ADs networks | ||
- | * ADs can make a mess of a webpage and seriously disrupt it's content flow | ||
- | * ADs can and will track you and your browsing habits | ||
- | |||
- | ===== How ADs are served ===== | ||
- | |||
- | Back in times ads where mostly some text-only links provided by Google (when it was still close to the **don' | ||
- | |||
- | There are different kinds of ads: | ||
- | * Browser ads: easy filtered at DNS level | ||
- | * App's ads (like in mobile apps): easily filtered at DNS level | ||
- | * Embedded ads (like in YouTube videos): cannot be filtered at DNS level | ||
- | |||
- | I will show you how to filter out all ads at DNS level. This will not get rid of **embedded** ads, but luckly those are very limited. You can solve also that issue by using things like [[https:// | ||
- | |||
- | ===== DNS based ADs block ===== | ||
- | |||
- | You have installed [[selfhost: | ||
- | |||
- | First of all you need a good, comprehensive and up-to-date **block list**. I suggest you using the official [[https:// | ||
- | |||
- | DnsMasq support two different ways to add blocklist. One is via custon **hosts** files, the other is via custom **configuration** files. OISD blocklists are in // | ||
- | |||
- | To use **hosts** format, just download your file and put it somewhere (i will assume **/ | ||
- | < | ||
- | addn-hosts=/ | ||
- | </ | ||
- | and reload dnsmasq. | ||
- | |||
- | To use **configuration** format, create a folder called **/ | ||
- | < | ||
- | conf-dir=/ | ||
- | </ | ||
- | this will load any file with **.conf** extension in that folder. | ||
- | |||
- | Now you need to download the OISD blocklist in that folder. | ||
- | <code bash> | ||
- | mkdir / | ||
- | wget ' | ||
- | / | ||
- | </ | ||
- | |||
- | This will work in addition to the AdGuard DNS you have already setup, but this will prevent any query going out to AdGuard for those domain. This is even more efficient. | ||
- | |||
- | ===== Automatic Updates ===== | ||
- | |||
- | Just add a cron task to daily update your blocklist. Add the following line: | ||
- | < | ||
- | 0 0 * * * wget ' | ||
- | </ | ||
- | |||
- | to root's crontab: | ||
- | <code bash> | ||
- | crontab -e | ||
- | </ | ||
- | |||
- | and you are all set. | ||