See my Pi-Hole: Difference between revisions

From munkjensen.net/wiki
No edit summary
(22 intermediate revisions by the same user not shown)
Line 1: Line 1:
Info on my [http://jacobsalmela.com/block-millions-ads-network-wide-with-a-raspberry-pi-hole-2-0/ Pi-Hole] is consolidated on this page.
{{#widget:AdSense
|name=munkjensen.net
|client=ca-pub-5816155791679071
|slot=1106658884
}}Info on my [http://jacobsalmela.com/block-millions-ads-network-wide-with-a-raspberry-pi-hole-2-0/ Pi-Hole] is consolidated on this page.


== Links to sites i used for this project ==
== Links to sites i used for this project ==
* [https://www.raspberrypi.org/ raspberrypi.org]
* [http://www.raspberrypi.org/ raspberrypi.org]
** [https://www.raspberrypi.org/documentation/installation/installing-images/README.md How to install a Raspberry Pi Operating System image on an SD card]
** [http://www.raspberrypi.org/documentation/installation/installing-images/README.md How to install a Raspberry Pi Operating System image on an SD card]
** [https://www.raspberrypi.org/downloads/ raspberrypi.org/downloads]
** [http://www.raspberrypi.org/downloads/ raspberrypi.org/downloads]
* [http://sourceforge.net/projects/win32diskimager/ win32diskimager]
* [http://sourceforge.net/projects/win32diskimager/ win32diskimager]
* [https://github.com/jacobsalmela/pi-hole pi-hole @ github]
* [http://github.com/jacobsalmela/pi-hole pi-hole @ github]
* [https://www.raspberrypi.org/documentation/remote-access/ssh/ Remote access] to the RPi using [http://www.chiark.greenend.org.uk/~sgtatham/putty/ putty] for Windows.
* [http://www.raspberrypi.org/documentation/remote-access/ssh/ Remote access] to the RPi using [http://www.chiark.greenend.org.uk/~sgtatham/putty/ putty] for Windows.
 
* "[http://discourse.pi-hole.net/t/add-wildcard-sites-to-the-blacklist/337 Add Wildcard sites to the blacklist]" - This also enables TLD blocking ;-)


== What i did... ==
== What i did... ==
Line 16: Line 20:
# Then i followed Jacob Salmela's guide: "''Setting It Up (The Easy Way)''"
# Then i followed Jacob Salmela's guide: "''Setting It Up (The Easy Way)''"


The DHCP server running on my ISP provided SHOH Router/Wireless Accesspoint cannot be disabled or changed in it's settings,  so i will have to manually point my devices to the PiHole DNS server... :-/
The DHCP server running on my ISP provided SHOH Router/Wireless Accesspoint cannot be disabled or changed in it's settings,  so i will have to manually point my devices to the Pi-Hole DNS server... :-/
If IPv6 is annoying you on the WIndows OS [https://support.microsoft.com/en-us/kb/929852 disable it correctly] !
 
If IPv6 is annoying you on the Windows OS [https://support.microsoft.com/en-us/kb/929852 disable it correctly] !


== chronometer.sh for putty ==
== chronometer.sh for putty ==
Line 60: Line 65:




== Minibian Pi-hole?? ==
== Minibian Pi-hole ==


Distro is avilable at http://minibianpi.wordpress.com/
Distro is avilable at http://minibianpi.wordpress.com/ and fits on a 1 gigabyte SD card !
<blockquote>
<blockquote>
=== <u>My notes</u> ===
=== <u>My notes</u> ===
''while trying to get this up and running''...
''while trying to get this up and running''...
 
# / have 223Mb free space after install on a 1 gig SD... that is sufficient to install pi-hole but why let parts of the 1 gig SD lay waste unused ?? let's try to [http://minibianpi.wordpress.com/how-to/resize-sd/ expand the partition] to fully utilize 1 Gb SD card.
# After 1st try to [http://minibianpi.wordpress.com/how-to/resize-sd/ expand the partition] to fully utilize 1 Gb SD card, i could not log in. So expanding is the first thing to do so all other steps is not wasted if(when) i fail again ;-)
# Okay - that worked great. 377 Mb is now avilable on the / mountpoint, after this step.
# Okay - that worked the second time. 57% of space is in use on the / mountpoint, after this step.
# Now it's time to ''apt-get -y update'' and then ''apt-get -y upgrade''. 59% of space is in use on the / mountpoint, after this step.
# Now it's time to ''apt-get -y update'' and then ''apt-get -y upgrade''. 59% of space is in use on the / mountpoint, after this step.
# init 6


<u>Missing packages:</u>
<u>Missing packages:</u>
* ''apt-get install curl'' (After this operation, 1,918 kB of additional disk space will be used.)
* ''apt-get -y install curl'' (After this operation, 1,918 kB of additional disk space will be used.)
* ''apt-get install sudo'' (After this operation, 2,337 kB of additional disk space will be used.)
* ''apt-get -y install sudo'' (After this operation, 2,337 kB of additional disk space will be used.)
* ''apt-get install whiptail'' (After this operation, 437 kB of additional disk space will be used.)
* ''apt-get -y install whiptail'' (After this operation, 437 kB of additional disk space will be used.)
* ''apt-get -y install unzip'' (After this operation, 394 kB of additional disk space will be used.)


Aukay... now i will just try to use the easy pi-hole install '''curl -L install.pi-hole.net | bash''' :-P
Aukay... now i will just try to use the easy pi-hole install '''curl -L install.pi-hole.net | bash''' :-P


Disk stats before:<pre>Filesystem      Size  Used Avail Use% Mounted on
Disk stats before:<pre>Filesystem      Size  Used Avail Use% Mounted on
/dev/root      864M  481M  327M  60% /
/dev/root      864M  481M  327M  60% /</pre>
devtmpfs        237M    0  237M  0% /dev
tmpfs          242M    0  242M  0% /dev/shm
tmpfs          242M  4.4M  237M  2% /run
tmpfs          5.0M    0  5.0M  0% /run/lock
tmpfs          242M    0  242M  0% /sys/fs/cgroup
/dev/mmcblk0p1  61M  20M  42M  32% /boot</pre>


I opted NOT to block IPv6 ads.
The install seemed to go without any errors :-D


Disk stats after:<pre>Filesystem      Size  Used Avail Use% Mounted on
/dev/root      864M  593M  215M  74% /</pre>
Correction: The install script complains only once due to the fact that the user 'pi' does not exsist.
=== Conclusion ===
It is possible to run a pi-hole on Minibian... i might not be the best/safest way to fly a pi-hole - but it works :-P
</blockquote>
</blockquote>
== Pi-Hole + OpenVPN = WIN ==
I have installed this on the RPi that is running my OpenVPN server. This gives me (and you if you do the same) the option to use the Ablocking DNS server ANYWHERE !!
See [[Rapsberry Pi OpenVPN Server]] for more information ;-)
== Mac mini 3,1 Pi-Hole ==
# Install [[Debian on a Mac Mini]]
# sudo apt-get update
# sudo apt-get install curl
# [http://github.com/pi-hole/pi-hole curl -L https://install.pi-hole.net | bash]
# Enjoy you new powerfull Pi-Hole :-)
[[Category:DNS]]
[[Category:DNS]]
[[Category:Pi-Hole]]
[[Category:RaspBerry Pi]]
[[Category:RaspBerry Pi]]

Revision as of 12:37, 24 October 2017

{{#widget:AdSense |name=munkjensen.net |client=ca-pub-5816155791679071 |slot=1106658884 }}Info on my Pi-Hole is consolidated on this page.

Links to sites i used for this project

What i did...

  1. Copied 2015-11-21-raspbian-jessie.img to the micro-sd card, using win32diskimager.
  2. After first boot, i configured the WiPi USB interface so it would connect to my Wireless network. I did this from the GUI.
  3. The i opened a Terminal window on top of the GUI. This might put unnessesary strain on the RPi, but for now it doesn't matter :-)
  4. Then i followed Jacob Salmela's guide: "Setting It Up (The Easy Way)"

The DHCP server running on my ISP provided SHOH Router/Wireless Accesspoint cannot be disabled or changed in it's settings, so i will have to manually point my devices to the Pi-Hole DNS server... :-/

If IPv6 is annoying you on the Windows OS disable it correctly !

chronometer.sh for putty

This is my version of the chronometer.sh script. /usr/share/figlet does not contain small font and i would like to rearrange the stuff a tiny bit.

#!/usr/bin/env bash
# Displays Pi-hole stats on the Adafruit PiTFT 2.8" touch screen
# Set the pi user to log in automatically and run this script from /etc/profile
# (c) 2015 by Jacob Salmela
# This file is part of Pi-hole.
#
# Pi-hole is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
for (( ; ; ))
do
        clear
        # Displays a colorful Pi-hole logo
        toilet -f smbraille -F gay Pi-hole
        echo "   $(ifconfig wlan0 | awk '/inet addr/ {print $2}' | cut -d':' -f2)"
        echo ""
        echo "  $(uptime | cut -d' ' -f11-)"
        echo "---------------------"
        # Uncomment to continually read the log file and display the current domain being blocked
        #tail -f /var/log/pihole.log | awk '/\/etc\/pihole\/gravity.list/ {if ($7 != "address" && $7 != "name" && $7 != "/etc/pihole/gravity.list") print $7; else;}'

        today=$(date "+%b %e")
        todaysQueryCount=$(cat /var/log/pihole.log | grep "$today" | awk '/query/ {print $7}' | wc -l)
        todaysQueryCountV4=$(cat /var/log/pihole.log | grep "$today" | awk '/query/ && /\[A\]/ {print $7}' | wc -l)
        todaysQueryCountV6=$(cat /var/log/pihole.log | grep "$today" | awk '/query/ && /\[AAAA\]/ {print $7}' | wc -l)
        todaysAdsEliminated=$(cat /var/log/pihole.log | grep "$today" | awk '/\/etc\/pihole\/gravity.list/ {print $7}' | wc -l)
        dividend=$(echo "$todaysAdsEliminated/$todaysQueryCount" | bc -l)
        fp=$(echo "$dividend*100" | bc -l)
        percentAds=$(echo ${fp:0:4})

        echo "Queries:  $todaysQueryCountV4 / $todaysQueryCountV6"
        echo "Pi-holed: $todaysAdsEliminated  ($percentAds%)"
        sleep 42
done


Minibian Pi-hole

Distro is avilable at http://minibianpi.wordpress.com/ and fits on a 1 gigabyte SD card !

My notes

while trying to get this up and running...

  1. / have 223Mb free space after install on a 1 gig SD... that is sufficient to install pi-hole but why let parts of the 1 gig SD lay waste unused ?? let's try to expand the partition to fully utilize 1 Gb SD card.
  2. Okay - that worked great. 377 Mb is now avilable on the / mountpoint, after this step.
  3. Now it's time to apt-get -y update and then apt-get -y upgrade. 59% of space is in use on the / mountpoint, after this step.
  4. init 6

Missing packages:

  • apt-get -y install curl (After this operation, 1,918 kB of additional disk space will be used.)
  • apt-get -y install sudo (After this operation, 2,337 kB of additional disk space will be used.)
  • apt-get -y install whiptail (After this operation, 437 kB of additional disk space will be used.)
  • apt-get -y install unzip (After this operation, 394 kB of additional disk space will be used.)

Aukay... now i will just try to use the easy pi-hole install curl -L install.pi-hole.net | bash :-P

Disk stats before:

Filesystem      Size  Used Avail Use% Mounted on
/dev/root       864M  481M  327M  60% /

I opted NOT to block IPv6 ads. The install seemed to go without any errors :-D

Disk stats after:

Filesystem      Size  Used Avail Use% Mounted on
/dev/root       864M  593M  215M  74% /

Correction: The install script complains only once due to the fact that the user 'pi' does not exsist.

Conclusion

It is possible to run a pi-hole on Minibian... i might not be the best/safest way to fly a pi-hole - but it works :-P

Pi-Hole + OpenVPN = WIN

I have installed this on the RPi that is running my OpenVPN server. This gives me (and you if you do the same) the option to use the Ablocking DNS server ANYWHERE !!

See Rapsberry Pi OpenVPN Server for more information ;-)


Mac mini 3,1 Pi-Hole

  1. Install Debian on a Mac Mini
  2. sudo apt-get update
  3. sudo apt-get install curl
  4. curl -L https://install.pi-hole.net | bash
  5. Enjoy you new powerfull Pi-Hole :-)