_{replace this section with your content or delete if not a FEATURE REQUEST/QUESTION/OTHER}_
Please [submit your feature request here](https://discourse.pi-hole.net/c/feature-requests), so it is votable by the community. It's also easier for us to track.
**[BUG | ISSUE] Expected Behaviour:**
@ -35,8 +35,8 @@ _{replace this section with your content or delete if not a FEATURE REQUEST/QUES
-
-
**(Optional) Debug Log generated by `pihole -d`:**
**(Optional) Debug token generated by `pihole -d`:**
`http://termbin.com/<something>`
`<token>`
_This template was created based on the work of [`udemy-dl`](https://github.com/nishad/udemy-dl/blob/master/LICENSE)._
@ -33,5 +33,6 @@ When requesting or submitting new features, first consider whether it might be u
- Submit Pull Requests to the **development branch only**.
- Before Submitting your Pull Request, merge `development` with your new branch and fix any conflicts. (Make sure you don't break anything in development!)
- Please use the [Google Style Guide for Shell](https://google.github.io/styleguide/shell.xml) for your code submission styles.
- Commit Unix line endings.
- (Optional fun) keep to the theme of Star Trek/black holes/gravity.
Designed For Raspberry Pi A+, B, B+, 2, 3B, and Zero (with an Ethernet/Wi-Fi adapter)
Works on most Debian and CentOS/RHEL based distributions!
## The multi-platform, network-wide ad blocker
1. Install Raspbian
2. Run the command below (downloads [this script](https://github.com/pi-hole/pi-hole/blob/master/automated%20install/basic-install.sh) in case you want to read over it first!)
Block ads for **all** your devices _without_ the need to install client-side software. The Pi-hole blocks ads the DNS-level, so all your devices are protected.
If you wish to read over the script before running it, then after the `wget` command, do `nano basic-install.sh` to open a text viewer
Digital Ocean helps with our infrastructure, but our developers are all volunteers so *your donations help keep us innovating*. Sending a donation using our links below helps us offset a portion of our monthly costs.
Once installed, [configure your router to have **DHCP clients use the Pi as their DNS server**](http://pi-hole.net/faq/can-i-set-the-pi-hole-to-be-the-dns-server-at-my-router-so-i-dont-have-to-change-settings-for-my-devices/) and then any device that connects to your network will have ads blocked without any further configuration. Alternatively, you can manually set each device to [use the Raspberry Pi as its DNS server](http://pi-hole.net/faq/how-do-i-use-the-pi-hole-as-my-dns-server/).
- ![Paypal](https://assets.pi-hole.net/static/paypal.png) [Donate via PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3J2L3Z4DHW9UY)
1. Install a [supported operating system](https://discourse.pi-hole.net/t/hardware-software-requirements/273/1)
2. Run the command below (it downloads [this script](https://github.com/pi-hole/pi-hole/blob/master/automated%20install/basic-install.sh) in case you want to read over it first!)
Once installed, [configure your router to have **DHCP clients use the Pi as their DNS server**](http://pi-hole.net/faq/can-i-set-the-pi-hole-to-be-the-dns-server-at-my-router-so-i-dont-have-to-change-settings-for-my-devices/) and then any device that connects to your network will have ads blocked without any further configuration. Alternatively, you can manually set each device to [use the Raspberry Pi as its DNS server](http://pi-hole.net/faq/how-do-i-use-the-pi-hole-as-my-dns-server/).
- [![Join the chat at https://gitter.im/pi-hole/pi-hole](https://badges.gitter.im/pi-hole/pi-hole.svg)](https://gitter.im/pi-hole/pi-hole?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
## Technical Details
@ -55,25 +83,34 @@ The Pi-hole is an **advertising-aware DNS/Web server**. If an ad domain is queri
### Gravity
The [gravity.sh](https://github.com/pi-hole/pi-hole/blob/master/gravity.sh) does most of the magic. The script pulls in ad domains from many sources and compiles them into a single list of [over 1.6 million entries](http://jacobsalmela.com/block-millions-ads-network-wide-with-a-raspberry-pi-hole-2-0) (if you decide to use the [mahakala list](https://github.com/pi-hole/pi-hole/commit/963eacfe0537a7abddf30441c754c67ca1e40965)).
The [gravity.sh](https://github.com/pi-hole/pi-hole/blob/master/gravity.sh) does most of the magic. The script pulls in ad domains from many sources and compiles them into a single list of [over 1.6 million entries](http://jacobsalmela.com/block-millions-ads-network-wide-with-a-raspberry-pi-hole-2-0) (if you decide to use the [mahakala list](https://github.com/pi-hole/pi-hole/commit/963eacfe0537a7abddf30441c754c67ca1e40965)). This script is controlled by the `pihole` command. Please run `pihole -h` to see what commands can be run via `pihole`.
## Web Interface
The [Web interface](https://github.com/jacobsalmela/AdminLTE#pi-hole-admin-dashboard) will be installed automatically so you can view stats and change settings. You can find it at:
#### Other Operating Systems
The automated install is only for a clean install of a Debian family or Fedora based system, such as the Raspberry Pi. However, this script will work for most UNIX-like systems, some with some slight **modifications** that we can help you work through. If you can install `dnsmasq` and a Webserver, it should work OK. If there are other platforms you'd like supported, let us know.
### Web Interface
The [Web interface](https://github.com/pi-hole/AdminLTE#pi-hole-admin-dashboard) will be installed automatically so you can view stats and change settings. You can find it at:
`http://192.168.1.x/admin/index.php` or `http://pi.hole/admin`
Domains can be whitelisted and blacklisted using two pre-installed scripts. See [the wiki page](https://github.com/pi-hole/pi-hole/wiki/Whitelisting-and-Blacklisting) for more details ![Whitelist editor in the Web interface](http://i.imgur.com/ogu2ewg.png)
Domains can be whitelisted and blacklisted using either the web interface or the command line. See [the wiki page](https://github.com/pi-hole/pi-hole/wiki/Whitelisting-and-Blacklisting) for more details
- [Pi-hole on Ubuntu](http://www.boyter.org/2015/12/pi-hole-ubuntu-14-04/)
- [Catchpoint: iOS 9 Ad Blocking](http://blog.catchpoint.com/2015/09/14/ad-blocking-apple/)
## Other Operating Systems
This script will work for other UNIX-like systems with some slight **modifications**. As long as you can install `dnsmasq` and a Webserver, it should work OK. The automated install is only for a clean install of a Debian based system, such as the Raspberry Pi.
- [Build an Ad-Blocker for less than 10$ with Orange-Pi](http://www.devacron.com/orangepi-zero-as-an-ad-block-server-with-pi-hole/)
# Changes the behaviour from strict RFC compliance so that DHCP requests on unknown leases from unknown hosts are not ignored. This allows new hosts to get a lease without a tedious timeout under all circumstances. It also allows dnsmasq to rebuild its lease database without each client needing to reacquire a lease, if the database is lost.
echo"::: Cannot continue, neither IPv4 or IPv6 selected"
echo"::: Exiting"
@ -282,7 +312,7 @@ use4andor6() {
getStaticIPv4Settings(){
# Ask if the user wants to use DHCP settings as their static IP
if(whiptail --backtitle "Calibrating network interface" --title "Static IP Address" --yesno "Do you want to use your current network settings as a static address?
IP address: ${IPv4_address}
IP address: ${IPV4_ADDRESS}
Gateway: ${IPv4gw}"${r}${c}); then
# If they choose yes, let the user know that the IP address will not be available via DHCP and may cause a conflict.
whiptail --msgbox --backtitle "IP information" --title "FYI: IP Conflict""It is possible your router could still try to assign this IP to a device, which would cause a conflict. But in most cases the router is smart enough to not do that.
@ -295,16 +325,16 @@ It is also possible to use a DHCP reservation, but if you are going to do that,
# Start a loop to let the user enter their information with the chance to go back and edit it if necessary
ip addr replace dev "${piholeInterface}""${IPv4_address}"
}> "${IFCFG_FILE}"
ip addr replace dev "${PIHOLE_INTERFACE}""${IPV4_ADDRESS}"
if[ -x "$(command -v nmcli)"];then
# Tell NetworkManager to read our new sysconfig file
nmcli con load "${IFCFG_FILE}" > /dev/null
fi
echo":::"
echo"::: Setting IP to ${IPv4_address}. You may need to restart after the install is complete."
echo"::: Setting IP to ${IPV4_ADDRESS}. You may need to restart after the install is complete."
echo":::"
fi
else
@ -419,70 +449,70 @@ setDNS() {
case${DNSchoices} in
Google)
echo"::: Using Google DNS servers."
piholeDNS1="8.8.8.8"
piholeDNS2="8.8.4.4"
PIHOLE_DNS_1="8.8.8.8"
PIHOLE_DNS_2="8.8.4.4"
;;
OpenDNS)
echo"::: Using OpenDNS servers."
piholeDNS1="208.67.222.222"
piholeDNS2="208.67.220.220"
PIHOLE_DNS_1="208.67.222.222"
PIHOLE_DNS_2="208.67.220.220"
;;
Level3)
echo"::: Using Level3 servers."
piholeDNS1="4.2.2.1"
piholeDNS2="4.2.2.2"
PIHOLE_DNS_1="4.2.2.1"
PIHOLE_DNS_2="4.2.2.2"
;;
Norton)
echo"::: Using Norton ConnectSafe servers."
piholeDNS1="199.85.126.10"
piholeDNS2="199.85.127.10"
PIHOLE_DNS_1="199.85.126.10"
PIHOLE_DNS_2="199.85.127.10"
;;
Comodo)
echo"::: Using Comodo Secure servers."
piholeDNS1="8.26.56.26"
piholeDNS2="8.20.247.20"
PIHOLE_DNS_1="8.26.56.26"
PIHOLE_DNS_2="8.20.247.20"
;;
Custom)
until[[${DNSSettingsCorrect}= True ]];do
strInvalid="Invalid"
if[ ! ${piholeDNS1}];then
if[ ! ${piholeDNS2}];then
if[ ! ${PIHOLE_DNS_1}];then
if[ ! ${PIHOLE_DNS_2}];then
prePopulate=""
else
prePopulate=", ${piholeDNS2}"
prePopulate=", ${PIHOLE_DNS_2}"
fi
elif[${piholeDNS1}]&&[ ! ${piholeDNS2}];then
prePopulate="${piholeDNS1}"
elif[${piholeDNS1}]&&[${piholeDNS2}];then
prePopulate="${piholeDNS1}, ${piholeDNS2}"
elif[${PIHOLE_DNS_1}]&&[ ! ${PIHOLE_DNS_2}];then
prePopulate="${PIHOLE_DNS_1}"
elif[${PIHOLE_DNS_1}]&&[${PIHOLE_DNS_2}];then
prePopulate="${PIHOLE_DNS_1}, ${PIHOLE_DNS_2}"
fi
piholeDNS=$(whiptail --backtitle "Specify Upstream DNS Provider(s)" --inputbox "Enter your desired upstream DNS provider(s), seperated by a comma.\n\nFor example '8.8.8.8, 8.8.4.4'"${r}${c}"${prePopulate}" 3>&1 1>&2 2>&3)
if[[$?=0]];then
piholeDNS1=$(echo"${piholeDNS}"| sed 's/[, \t]\+/,/g'| awk -F, '{print$1}')
piholeDNS2=$(echo"${piholeDNS}"| sed 's/[, \t]\+/,/g'| awk -F, '{print$2}')
if ! valid_ip "${piholeDNS1}"||[ ! "${piholeDNS1}"];then
piholeDNS1=${strInvalid}
PIHOLE_DNS_1=$(echo"${piholeDNS}"| sed 's/[, \t]\+/,/g'| awk -F, '{print$1}')
PIHOLE_DNS_2=$(echo"${piholeDNS}"| sed 's/[, \t]\+/,/g'| awk -F, '{print$2}')
if ! valid_ip "${PIHOLE_DNS_1}"||[ ! "${PIHOLE_DNS_1}"];then
PIHOLE_DNS_1=${strInvalid}
fi
if ! valid_ip "${piholeDNS2}"&&["${piholeDNS2}"];then
piholeDNS2=${strInvalid}
if ! valid_ip "${PIHOLE_DNS_2}"&&["${PIHOLE_DNS_2}"];then
whiptail --msgbox --backtitle "Invalid IP" --title "Invalid IP""One or both entered IP addresses were invalid. Please try again.\n\n DNS Server 1: $piholeDNS1\n DNS Server 2: ${piholeDNS2}"${r}${c}
whiptail --msgbox --backtitle "Invalid IP" --title "Invalid IP""One or both entered IP addresses were invalid. Please try again.\n\n DNS Server 1: $PIHOLE_DNS_1\n DNS Server 2: ${PIHOLE_DNS_2}"${r}${c}
if[[${PIHOLE_DNS_1}=="${strInvalid}"]];then
PIHOLE_DNS_1=""
fi
if[[${piholeDNS2}=="${strInvalid}"]];then
piholeDNS2=""
if[[${PIHOLE_DNS_2}=="${strInvalid}"]];then
PIHOLE_DNS_2=""
fi
DNSSettingsCorrect=False
else
if(whiptail --backtitle "Specify Upstream DNS Provider(s)" --title "Upstream DNS Provider(s)" --yesno "Are these settings correct?\n DNS Server 1: $piholeDNS1\n DNS Server 2: ${piholeDNS2}"${r}${c});then
if(whiptail --backtitle "Specify Upstream DNS Provider(s)" --title "Upstream DNS Provider(s)" --yesno "Are these settings correct?\n DNS Server 1: $PIHOLE_DNS_1\n DNS Server 2: ${PIHOLE_DNS_2}"${r}${c});then
DNSSettingsCorrect=True
else
# If the settings are wrong, the loop continues
@ -498,6 +528,28 @@ setDNS() {
fi
}
setLogging(){
local LogToggleCommand
local LogChooseOptions
local LogChoices
LogToggleCommand=(whiptail --separate-output --radiolist "Do you want to log queries?\n (Disabling will render graphs on the Admin page useless):"${r}${c} 6)