|
Have had a Raspberry Pi Model 1B gathering dust for ages in my room - unfortunately many uses I want (MAME, Media Server etc) would benefit from a newer model but I finally found a use for my lowly 512MB SDRAM, 700MHz CPU, 10/100Mbps ethernet version....
Pi-Hole. This thing is brilliant.
First, you only need to run it headlessly so you don't need the latest raspbian with desktop - just use the Raspbian-Lite version which easily fits on a 4GB SDcard leaving plenty of space to spare.
Once the OS image is installed on the FAT32 card, add an empty file called ssh to the root (no extension) and you can do all set up via FTP from your PC (SSH into the address it's assigned when on using the default username/password)
When it first runs (I had mine powered and plugged into a router port), the latest current raspbian (Sep '19) will commonly fail on "daily apt get-upgrade" so you can reboot to get to the prompt and run "sudo raspi-config" for the first time:
Only need to do a couple of things to the setup - 1) expand_rootfs to allow whole sd card to be used (inside Advanced Options, then first option) and 2) keep username Pi but change the password and allow auto-login (under boot options -> desktop/cli -> console autologin).
DO NOT overclock - I initially OC'd mine to 1000MHz but then got progressive read/write errors until the OS was so unreadable I couldn't even do basic things like log in and then couldn't boot.....wasn't the card, was the OC. Re-set it all up yesterday and left it at 700MHz and it copes fine (DNS serving isn't CPU intensive anyway so OC won't benefit me).
Now reboot and run sudo apt get update and then upgrade and clean (upgrade took 1.5hrs first time I ran it - be patient as subsequent ones will be quicker) then reboot..
When rebooted, ssh into it again and set ip to static (easy to do ... change part of sudo nano /etc/resolv.conf to this (removing # to lines you want):
# Example Static IP Configuration
interface eth0
static ip_address=192.168.1.XXX/24
#static ip6_address=fd61:42d9:cbae:i89e::ff/64
static routers=192.168.1.1
static domain_name_servers=192.168.1.1 1.1.1.1
where XXX is the static ip you choose....change the XXX for whatever number you want and the Pi will always be given this ip address.
That last bit after your router address of 192.168.1 is the backup DNS server for the Pi itself which I set as Cloudfront's (not Google's - see below)
I then rebooted to check it'd worked and ssh'd into it using my chosen ip
Once all done, final thing is to install PiHole with curl -sSL https://install.pi-hole.net | bash and follow the prompts (kept all mine as is apart from again the backup DNS where I chose cloudfront 1.1.1.1 instead of google 8.8.8.8 as CF is MUCH faster to serve requests).
That's it. You can point any devices DNS to 192.168.1.XXX and it'll use Pi-Hole as it's DNS server with high level ad blocking. The web interface allows for standard Whitelisting (for sites you want everything to run) and Blacklisting (additional addresses not caught by the blocklists) but the Blocklists themselves are only recognised as hosts files so won't recognise the normal regex rules in browser adblockers - I'm using the standard pihole ones but haven't yet found a complete Hosts file version of Easylist (currently running 3 based off of it (firebog, someonewhocares and adguardhosts) which pi-hole combines into one, discarding any duplicates).
Despite the fact I've got a very old Raspberry Pi model 1 B with the Lite version of Raspbian on a 4GB sdcard (slow, low and old), FTL serves blocked requests in <1ms and allows good requests in <20ms and stays at <44degC throughout.....so very fast and light weight.
You can therefore use this on "non-standard" devices like TVs and it even works in in-app ads on the iPhone.
With it running I am only using 1 filter on my safari adblocker (adguard) now (using the Adguard General list only in order to block the "on starting" youtube ads (the normal "throughout the video" ads are blocked fairly well on YT with Pi-Hole alone)).
Lots of geeky info in the admin panel too (still can't figure out what the Load indicates though, as it's sometimes red and mostly green regardless of what I'm doing - heavy browsing or not).
Great for a £35 pi (with few quid SDCard) . |
|