Network-wide Ad Blocking
The other day I was looking into the possibility of upgrading my PC's and using the parts that I replaced to build another PC. I currently have my main PC, a socket 1150 i5 (4th gen) CPU. I also have an old socket 775 running a pin modded quad core Xeon CPU. The theory was to replace my main PC's motherboard and buy a i3-3240 which would of become the heart of the new PC. Then I wanted to renegate the Xeon into a Pi-Hole DNS server to block adverts on the internet for the entirity of the household.
Information : https://pi-hole.net/
I didn't really need to buy that many more components but surprisingly the majority of the expense was going to be the new case and power supply. Then I remembered that I had an old PC which was kicking around in the garage. So I decided to go and find it, my thinking here was that maybe it would suffice as the DNS server without spending any money. If not, at worse at least I could use it as a case and I wouldn't need to buy a brand new one.
After I took it back inside, I began to strip it down, fighting off the spiders and cleaning and hoovering the parts as I dissembled it. I was pleasantly surprised to discover there was a 1.86GHz Core 2 Duo chip lurking under the Heat Sink Fan (HSF).
Once it's installed it's just a case of typing in your Pi-Hole's IP address into your internet browser of another device. Initially I used my phone to see if it's up and running on your home network.
Here's the PC from my garage in all it's glory
Intel Core 2 Duo 1.86GHz CPU
Unfortunately whilst inspecting the motherboard I noticed a rather big problem. At some point this circuit had fried and I was a little disappointed however at least I'd reclaimed a case to house a new machine in.
Damaged Motherboard
So I went back out to the garage looking for a cardboard box to put the components into so that I could take them down to the local recycling centre. Whilst looking around I came across a box which had old parts in, a real selection of all sorts and you wont believe this.. I only came across an identical motherboard!! What were the chances of that happening?
Exact Replacement Motherboard
I decided to check the power supply before hooking it up again, I've got one of these Power Supply testers and again I was surprised as it seemed fine too!
Testing the Power Supply Unit (PSU)
After I had rebuilt this PC it was starting to look quite good actually!
It cleaned up well
Finally I noticed that there were no feet on the bottom of the computer case. Admittedly it's not really that important but I've got a glue gun and some furniture feet so I decided to use those.
The feet looked good
Powering up the PC was a little bit of a case of trial and error, it turned on, the Power On Self Test (POST) beeped but I had to hook up a monitor, keyboard and mouse to really see what exactly was happening.
Computer Power Up into BIOS
The computer entered into the Basic Input Output System (BIOS) and I discovered it had two 512MB memory modules. There is only one in the photo above as initially it was easier to diagnose. Eventually I swapped those for two 1024MB memory modules. I also added two 100MB network adaptors thinking that I would need a CAT5 Network connection going into the DNS server and one CAT5 Network connection coming out of the PC to feed the intranet. The on-board Network adaptor was only a 10MB one so really that wasn't fast enough.
Next came the download of Linux Debian 9, which wasn't exactly straight forward. Initially I started looking here and got to the point where I needed to make a selection between x86 (32 Bit) or x64 (64 Bit). To help me out I quickly Google'd the CPU's code 'SL9SA' and confirmed that the process featured 'EM64T technology'. I then found and downloaded the 64 bit version of Debian and burnt the .ISO file onto a blank DVD disc.
Booting from the DVD, the installation process of Debian 9 started.. it's fairly self explanatory but here's a useful and helpful guide. Just to note that I didn't need to install the 'Print Server' option and the installation took around an hour (which I though was pretty hefty)
After the installation had completed I removed the DVD from the optical drive and rebooted. Grub (the boot menu) had a 4 second time out and defaulted to loading Debian as normal. However two lines of text came up and the system halted..
"GPU Lockup - switching to software fbcon"
OK, I thought.. here's where the Linux fun starts.. and I've only got a teeny tiny about of Linux experience.. this is going to be REALLY FUN... Sarcasm ☹️
Rebooting and selecting the second option on Grub allows you to boot into the Recovery mode, which is a fancy way of saying into a command prompt or in Linux is called a Terminal or Shell.
Several Debian re-installations later, tweaking, discovering little snippets of information. I could aliken the whole experience similar to that of a plumber working in the dark to fix an electrical circuit that an electrician would be much better suited doing! I worked out that the graphics card in my old PC is a nVidia based graphics card, and even though I was installing the nVidia drivers. These were newer drivers that didn't recognise the legacy hardware.
Step 1 - Getting the Internet Working
Useful information if your in this situation yourself.. To get the internet working you need to manually type commands to make this happen. In my case it was these:
Step 2 - Editing your Sources.List
You'll probably be better off asking a Linux guy the reason for adding these into the Sources file, I understand it a little bit but it goes something along the lines of you cannot download nVidia graphics drivers if you don't do this. The real reason is probably relating to security but I'm not the guy to ask about that!!
Step 3 - Adding Headers
Then you need to add 'headers' (again I don't really have a clue) but I did this by..
Step 4 - Downloading Stuff
Once the previous steps have been done your good to start downloading packages, utilities, drivers and such like.
Should you install the wrong graphics driver, I did.. several times you can removed them by typing..
Step 5 - Reboot with your fingers crossed
Then it's just a case of rebooting the system using the command..
Useful information if your in this situation yourself.. To get the internet working you need to manually type commands to make this happen. In my case it was these:
ip link show (displays network adaptors)
Once you've a net connection you need can start messing, updating and breaking more things. I worked out that doing things in this order eventually got me up and running..ip link set enp0s10 up (gets the choosen adaptor ready)dhclient enp0s10 (gets an IP address for the choosen adaptor)ip addr show dev enp0s10 (displays information relating to the adaptor)
Step 2 - Editing your Sources.List
nano /etc/apt/Sources.List (edit the sources file)add on "contrib" and "non-free" to the end of these sources
You'll probably be better off asking a Linux guy the reason for adding these into the Sources file, I understand it a little bit but it goes something along the lines of you cannot download nVidia graphics drivers if you don't do this. The real reason is probably relating to security but I'm not the guy to ask about that!!
Step 3 - Adding Headers
Then you need to add 'headers' (again I don't really have a clue) but I did this by..
apt-get install linux-headers_$(uname -r) (don't ask me!!)
Step 4 - Downloading Stuff
Once the previous steps have been done your good to start downloading packages, utilities, drivers and such like.
apt-get update (updates the operating system)apt install nvidia-detect (useful detection utility for your nVidia graphics card)apt install nvidia-legacy-304xx-driver (the legacy driver that my GPU needed)
Should you install the wrong graphics driver, I did.. several times you can removed them by typing..
apt purge nvidia.* (Removes everything with nVidia)
Step 5 - Reboot with your fingers crossed
Then it's just a case of rebooting the system using the command..
rebootand then keeping your fingers cross that your system boots into the Graphical User Interface (GUI) of Debian. Once your there everything else is a lot easier.
What do we have left to do you ask?
We still have a couple of things that we need to do..
- Well, from within the GUI we still need to get the PC to boot headlessly (i.e. with no mouse, keyboard or display and it's a lot easier to test whilst we still have these devices attached to double check!).
systemctl set-default multi-user.targetBasically a terminal prompt for username and password, no GUI gets loaded. If you reboot with your screen and keyboard still attached you will see this.
- Then we need to install and setup Pi-Hole.
This is seemingly easy.. although of course with an exception, we need to download 'Curl'
apt install curl (install curl and then after thats installed..)A quick walk through of the complete Pi-Hole installation can be seen here but it's pretty easy to follow.
curl -sSL https://install.pi-hole.net | bash (this basically does everything else for you)
When you see the 'Installation Complete' dialogue
box just remember to take a note of the password
it gives you to access your own server!
Once it's installed it's just a case of typing in your Pi-Hole's IP address into your internet browser of another device. Initially I used my phone to see if it's up and running on your home network.
Pi-Hole running Headlessly
If it's there you can either change the DNS details on your main router which will affect all users on your home network or you could just change the DNS servers on a machine by machine basis. This is what I did to test using my laptop.
Here's you'll be able to see Speedtest's website and it's 5 adverts (before Pi-Hole)
SpeedTest with 5 x Adverts
Pi-Hole Server Running
SpeedTest without Adverts
Just in case any of you are wondering, "How do I switch off the Pi-Hole?" You can log into the server's IP address and control it from there, there a a number of options including restart and power off.
Thanks for reading my post, I hope it will inspire some of you to try and make your own DNS server, it really improves the way the internet is delivered.
No comments:
Post a Comment