{"id":42,"date":"2021-09-04T15:28:00","date_gmt":"2021-09-04T09:58:00","guid":{"rendered":"http:\/\/satvikpatwardhan.codelogistics.net\/?p=42"},"modified":"2024-08-16T18:11:06","modified_gmt":"2024-08-16T12:41:06","slug":"pi-hole-network-wide-ad-blocking-is-the-best-thing-i-didnt-know-about","status":"publish","type":"post","link":"https:\/\/satvikpatwardhan.codelogistics.net\/index.php\/2021\/09\/04\/pi-hole-network-wide-ad-blocking-is-the-best-thing-i-didnt-know-about\/","title":{"rendered":"Pi-hole: Network-Wide Ad Blocking is the Best Thing I Didn\u2019t Know About"},"content":{"rendered":"\n<p>My Raspberry Pi Zero W from two years ago, which was, for the best part of the aforementioned two years, sitting in my cupboard finally has a purpose: its a Pi-hole Network-Wide Ad Blocker!<\/p>\n\n\n\n<p>I should mention that that Raspberry Pi has been through a LOT of projects. Initially bought for making a smart TV (fate: can\u2019t run videos as its too weak), it went through projects for becoming an internet printer server (fate: neither the Pi nor the printer had ethernet), web server (fate: too weak), robot (fate: too complex, lack of parts, lack of knowledge, lack of interest), Minetest server (fate: too weak) and Nextcloud server (fate: too weak).<\/p>\n\n\n\n<!--more-->\n\n\n\n<p>Anyways\u2026<\/p>\n\n\n\n<p><a href=\"http:\/\/pi-hole.net\">Pi-hole<\/a> works by pretending to be a DNS server, which in reality just blocks known ad\/malware related domains and sends the rest to an actual DNS server for resolving (see&nbsp;<a href=\"https:\/\/satvikpatwardhan.codelogistics.net\/index.php\/2020\/01\/27\/how-to-set-up-your-own-website-extreme-hardcore-version\/\" data-type=\"post\" data-id=\"66\">my first blog post<\/a> for details on how DNS works). If your router is configured to use the Pi-hole as its DNS server, all the devices connected to that router will see less\/no ads without actually installing an adblocker on every browser on every device. (many devices do not even support adblockers.)<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"512\" height=\"512\" src=\"https:\/\/satvikpatwardhan.codelogistics.net\/wp-content\/uploads\/2023\/03\/Vortex-R.webp\" alt=\"\" class=\"wp-image-43\" srcset=\"https:\/\/satvikpatwardhan.codelogistics.net\/wp-content\/uploads\/2023\/03\/Vortex-R.webp 512w, https:\/\/satvikpatwardhan.codelogistics.net\/wp-content\/uploads\/2023\/03\/Vortex-R-300x300.webp 300w, https:\/\/satvikpatwardhan.codelogistics.net\/wp-content\/uploads\/2023\/03\/Vortex-R-150x150.webp 150w\" sizes=\"auto, (max-width: 512px) 100vw, 512px\" \/><\/figure>\n\n\n\n<p>Setup is super easy:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Get a Raspberry Pi. I am using a Raspberry Pi Zero W as I said, and its seems to be powerful enough to handle Pi-hole, according to online sources.<\/li>\n\n\n\n<li>Get a supported distro. I did Raspbian, as most Raspberry Pi guides are written for it. I tried Debian (which I run everywhere, its the best distro in my opinion) but I couldn\u2019t get to ssh into it via USB as the guide seemed to be dependent on a Raspbian-exclusive default. I probably could have gotten it to run, but it doesn\u2019t matter that much I guess, as Raspbian is also based on Debian.<\/li>\n\n\n\n<li>Run the Pi after connecting it to a monitor and keyboard. You need to do this at least once to set up WiFi. (I had to look up an online <a href=\"https:\/\/raspberrypihq.com\/how-to-connect-your-raspberry-pi-to-wifi\/\">tutorial<\/a> for this.)<\/li>\n\n\n\n<li>Run their one line setup script. It isn\u2019t mentioned on their site, but use it via root or sudo, or else it won\u2019t be able to install dependencies or edit system files.<\/li>\n\n\n\n<li>In the setup, I used my router\u2019s default DNS servers, but you can use any other DNS servers as the Pi-hole\u2019s DNS servers. It provides a list of popular ones to choose from easily as well.<\/li>\n\n\n\n<li>Set the Pi-hole\u2019s local IP address as the default DNS server in your router, or set the Pi-hole\u2019s local IP address manually in the settings of the devices you want to use adblock with as the DNS server. (I went network-wide, as some devices do not support this functionality.) It is listed under DHCP settings, or something similar. (I wish there was some sort of coordination between router companies as to naming conventions, but&nbsp;<em>nooooo.<\/em> I wonder how these guys manage to basically run the internet.)<\/li>\n\n\n\n<li>???<\/li>\n\n\n\n<li>Profit. (See Linus Tech Tips\u2019 video <a href=\"https:\/\/www.youtube.com\/watch?v=KBXTnrD_Zs4\">here<\/a> for additional details.)<\/li>\n<\/ol>\n\n\n\n<p>Setup was super easy: I didn\u2019t have access to a HDMI screen so I had to ssh into it through USB and set it up. I advise anyone using Raspbian to&nbsp;<strong>not use network-manager &#8211; Raspbian doesn\u2019t like it<\/strong>. I did have the usual hitches in the way of any project, like the Debian thing I mentioned and WiFi not working initially. But not much else caused trouble. I soon added several more blacklists (they are available online), and it seems to work really good at the moment. I will make it a point to keep this post updated with any further issues I may get, and how I fix it.<\/p>\n\n\n\n<p>It should be noted that if your Raspberry Pi shuts down unexpectedly or faces some other issue, either the entire network (if you go network-wide) or the devices configured to use Pi-hole will not have internet unless to DNS settings are changed. Connect the Pi to an inverter\/ generator\/ UPS powered plug point.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>My Raspberry Pi Zero W from two years ago, which was, for the best part of the aforementioned two years, sitting in my cupboard finally has a purpose: its a Pi-hole Network-Wide Ad Blocker! I should mention that that Raspberry Pi has been through a LOT of projects. Initially bought for making a smart TV &hellip; <a href=\"https:\/\/satvikpatwardhan.codelogistics.net\/index.php\/2021\/09\/04\/pi-hole-network-wide-ad-blocking-is-the-best-thing-i-didnt-know-about\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Pi-hole: Network-Wide Ad Blocking is the Best Thing I Didn\u2019t Know About<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":3,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"federate","footnotes":""},"categories":[6,5],"tags":[],"class_list":["post-42","post","type-post","status-publish","format-standard","hentry","category-projects","category-tutorials"],"_links":{"self":[{"href":"https:\/\/satvikpatwardhan.codelogistics.net\/index.php\/wp-json\/wp\/v2\/posts\/42","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/satvikpatwardhan.codelogistics.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/satvikpatwardhan.codelogistics.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/satvikpatwardhan.codelogistics.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/satvikpatwardhan.codelogistics.net\/index.php\/wp-json\/wp\/v2\/comments?post=42"}],"version-history":[{"count":3,"href":"https:\/\/satvikpatwardhan.codelogistics.net\/index.php\/wp-json\/wp\/v2\/posts\/42\/revisions"}],"predecessor-version":[{"id":95,"href":"https:\/\/satvikpatwardhan.codelogistics.net\/index.php\/wp-json\/wp\/v2\/posts\/42\/revisions\/95"}],"wp:attachment":[{"href":"https:\/\/satvikpatwardhan.codelogistics.net\/index.php\/wp-json\/wp\/v2\/media?parent=42"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/satvikpatwardhan.codelogistics.net\/index.php\/wp-json\/wp\/v2\/categories?post=42"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/satvikpatwardhan.codelogistics.net\/index.php\/wp-json\/wp\/v2\/tags?post=42"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}