Pi-hole: Difference between revisions
| Line 10: | Line 10: | ||
}} | }} | ||
Follow the installation steps and make a note of the admin password that is generated. If you did not see the admin password or if you've forgotten it, you can reset it with <code>pihole -a -p</code>. | Follow the installation steps and make a note of the admin password that is generated. If you did not see the admin password or if you've forgotten it, you can reset it with <code>pihole -a -p</code>. | ||
If you intend to use their block page feature, you will need to block port 443 so that secure requests are dropped rather than have a security warning show. | |||
{{Highlight | |||
| code = # iptables -A INPUT -p tcp --dport 443 -j REJECT --reject-with tcp-reset | |||
# iptables -A INPUT -p udp --dport 443 -j REJECT --reject-with icmp-port-unreachable | |||
| lang = terminal | |||
}} | |||
Edit <code>/etc/pihole/pihole-FTL.conf</code>, and set <code>BLOCKINGMODE=IP</code>. If you are using IPv6 on your network, ensure that the <code>IPV6_ADDRESS</code> value in <code>setupVars.conf</code> is correct. Apply your changes by restarting pihole-FTL or with <code>killall -SIGHUP pihole-FTL</code>. If this works correctly, going to a blacklisted host will show a blocked page and going to the secured version of the blacklisted host will immediately result in a connection refused error. | |||
==Administration== | ==Administration== | ||
Revision as of 00:04, 21 June 2020
Pi-hole is a light weight application that configures a DNS and DHCP server for the purpose of blocking advertisements. It comes with an optional control panel written in PHP. As the name suggests, it is designed to run on a Raspberry Pi, although it can also be installed on anything that runs a supported version of Linux.
Running Pi-hole on the original Raspberry Pi 1 works, though the web interface might be somewhat sluggish. I am using Pi-hole as an alternative to OpenWRT as a local DNS/DHCP server and it is working fine. Drawbacks with Pi-hole compared to OpenWRT is that the system needs to be updated independently unlike OpenWRT and the initial boot time is definitely longer. However, the Pi-hole user interface has a lot more information and the ability to see DNS queries in real time is a bonus.
Installation
Pi-hole can be installed on a clean install of Raspbian (Raspberry Pi OS), Ubuntu, Debian, Fedora, or CentOS. The installation process can be started by running their install script with alternative methods listed on their installation page.
# curl -sSL https://install.pi-hole.net | bash
Follow the installation steps and make a note of the admin password that is generated. If you did not see the admin password or if you've forgotten it, you can reset it with pihole -a -p.
If you intend to use their block page feature, you will need to block port 443 so that secure requests are dropped rather than have a security warning show.
# iptables -A INPUT -p tcp --dport 443 -j REJECT --reject-with tcp-reset
# iptables -A INPUT -p udp --dport 443 -j REJECT --reject-with icmp-port-unreachable
Edit /etc/pihole/pihole-FTL.conf, and set BLOCKINGMODE=IP. If you are using IPv6 on your network, ensure that the IPV6_ADDRESS value in setupVars.conf is correct. Apply your changes by restarting pihole-FTL or with killall -SIGHUP pihole-FTL. If this works correctly, going to a blacklisted host will show a blocked page and going to the secured version of the blacklisted host will immediately result in a connection refused error.
Administration
TFTP / PXE Boot Support

Unlike in OpenWRT where you can define the TFTP settings for dnsmasq directly in Luci, with Pi-hole, you will need to define the dnsmasq DHCP options configuration in a configuration file manually.
Create a dnsmasq configuration file at /etc/dnsmasq.d/02-tftp.conf with the following lines to define the next server and next file. These are the same values that you would have entered in OpenWRT via Luci. Ensure that the TFTP root exists and contains your PXE boot files.
# Defined within /etc/dnsmasq.d/02-tftp.conf
tftp-root=/tftpboot
dhcp-boot=pxelinux.0,10.1.2.54,10.1.2.54
Restart dnsmasq (via systemd or the Pi-hole control panel) to apply.
Updating
Updating Pi-hole is as simple as running:
# pihole -up
See Also
- Official Documentation - https://docs.pi-hole.net