mirror of
https://github.com/pi-hole/docs.git
synced 2024-12-06 19:27:12 +01:00
@@ -54,17 +54,13 @@ Example Usage | [`pihole -regex '^example.com$' '.*\.example2.net'`](https://d
|
||||
|
||||
Administrators need to be able to manually add and remove domains for various purposes, and these commands serve that purpose.
|
||||
|
||||
See [Regex Blocking](/ftldns/regex/overview/) for more information about using Regex.
|
||||
See [Regex Blocking](../ftldns/regex/overview.md) for more information about using Regex.
|
||||
|
||||
**Basic Script Process**:
|
||||
|
||||
* Each domain is validated using regex (except when using `-regex`), to ensure invalid domains and IDNs are not added
|
||||
* A whitelisted domain gets added or removed from `/etc/pihole/whitelist.txt`
|
||||
* A blacklisted domain gets added or removed from `/etc/pihole/blacklist.txt`
|
||||
* On either list type, `gravity.sh` is then called to consolidate an updated copy of `gravity.list`, and the DNS server is reloaded
|
||||
* A regex blacklisted domain gets added or removed from `/etc/pihole/regex.list`
|
||||
* A wildcard domain gets converted into regex and added or removed from `/etc/pihole/regex.list`
|
||||
* For both regex-based commands, `gravity.sh` is then called to restart the DNS server
|
||||
* A domain gets added to or removed from the `domainlist` table in [`/etc/pihole/gravity.db`](../database/gravity/index.md)
|
||||
* The DNS server is then reloaded
|
||||
|
||||
### Debugger
|
||||
|
||||
@@ -153,14 +149,12 @@ Gravity is one of the most important scripts of Pi-hole. Its main purpose is to
|
||||
|
||||
**Basic Script Process**:
|
||||
|
||||
* It will determine Internet connectivity, and give time for `dnsmasq` to be resolvable on low-end systems if has just been restarted
|
||||
* It extracts all URLs and domains from `/etc/pihole/adlists.list`
|
||||
* It will determine Internet connectivity, and give time for `pihole-FTL` to be resolvable on low-end systems if has just been restarted
|
||||
* It extracts all URLs and domains from the `adlists` table in [`/etc/pihole/gravity.db`](../database/gravity/index.md)
|
||||
* It runs through each URL, downloading it if necessary
|
||||
* `curl` checks the servers `Last-Modified` header to ensure it is getting a newer version
|
||||
* It will attempt to parse the file into a domains-only format if necessary
|
||||
* Lists are merged, comments removed, sorted uniquely and stored as `list.preEventHorizon`
|
||||
* Whitelisted entries within `/etc/pihole/whitelist.txt` are removed from `list.preEventHorizon` and saved into a temporary file
|
||||
* Blacklisted, "localhost" and temporary file entries are added as separate `.list` files
|
||||
* Lists are merged, comments removed, sorted uniquely and stored in the `gravity` table of [`/etc/pihole/gravity.db`](../database/gravity/index.md)
|
||||
* Gravity cleans up temporary content and reloads the DNS server
|
||||
|
||||
### Logging
|
||||
@@ -187,10 +181,7 @@ This command will query your whitelist, blacklist, wildcards and adlists for a s
|
||||
|
||||
* User-specified options are handled
|
||||
* Using `idn`, it will convert [Internationalized domain names](https://en.wikipedia.org/wiki/Internationalized_domain_name) into [punycode](https://en.wikipedia.org/wiki/Punycode)
|
||||
* The whitelist and the blacklist are searched
|
||||
* The possible wildcard matches are then searched (`/etc/dnsmasq.d/03-pihole-wildcard.conf`)
|
||||
* The adlists are then searched (`/etc/pihole/list.*.domains`)
|
||||
* Output is determined by the specified options, ensuring that a file name is only printed once
|
||||
* Database at [`/etc/pihole/gravity.db`](../database/gravity/index.md) is queried to return a list of adlists in which the queried domain exists.
|
||||
|
||||
### Update
|
||||
|
||||
@@ -311,16 +302,6 @@ Example Usage | [`pihole -a -c`](https://discourse.pi-hole.net/t/the-pihole-co
|
||||
|
||||
Set the specified temperature unit as the preferred type. This preference will affect the Web Interface, as well as Chronometer.
|
||||
|
||||
### Host Record
|
||||
|
||||
| | |
|
||||
-------------- | --------------
|
||||
Help Command | `pihole -a hostrecord --help`
|
||||
Script Location | [`/opt/pihole/webpage.sh`](https://github.com/pi-hole/pi-hole/blob/master/advanced/Scripts/webpage.sh)
|
||||
Example Usage | `pihole -a hostrecord home.domain.com 192.168.1.1`
|
||||
|
||||
Add A & AAAA records to the DNS, to be associated with an IPv4/IPv6 address.
|
||||
|
||||
### Email Address
|
||||
|
||||
| | |
|
||||
@@ -339,4 +320,4 @@ Help Command | `pihole -a interface --help`
|
||||
Script Location | [`/opt/pihole/webpage.sh`](https://github.com/pi-hole/pi-hole/blob/master/advanced/Scripts/webpage.sh)
|
||||
Example Usage | [`pihole -a interface local`](https://discourse.pi-hole.net/t/the-pihole-command-with-examples/738#interface)
|
||||
|
||||
Specify interface listening behavior for `dnsmasq`. When using `pihole -a interface all`, please ensure you use a firewall to prevent your Pi-hole from becoming an unwitting host to [DNS amplification attackers](https://duckduckgo.com/?q=dns+amplification+attack). You may want to consider running [OpenVPN](https://github.com/pi-hole/pi-hole/wiki/Pi-hole---OpenVPN-server) to grant your mobile devices access to the Pi-hole.
|
||||
Specify interface listening behavior for `pihole-FTL`. When using `pihole -a interface all`, please ensure you use a firewall to prevent your Pi-hole from becoming an unwitting host to [DNS amplification attackers](https://duckduckgo.com/?q=dns+amplification+attack). You may want to consider running [OpenVPN](../guides/vpn/overview.md) to grant your mobile devices access to the Pi-hole.
|
||||
|
||||
@@ -29,7 +29,7 @@ The long-term database can be disabled by setting
|
||||
DBFILE=
|
||||
```
|
||||
|
||||
in `/etc/pihole/pihole-FTL.conf` and running `sudo pihole restartdns` (see also [here](/ftldns/configfile/#dbfile)).
|
||||
in `/etc/pihole/pihole-FTL.conf` and running `sudo pihole restartdns` (see also [here](../ftldns/configfile.md#dbfile)).
|
||||
|
||||
### 2.2 Increase DNS cache size
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
**Up until now, this wiki has been about a server set up on a cloud host, available on the public Internet. This section is aimed at a server set up in a private network like on a Raspberry Pi.**
|
||||
|
||||
So if blocking works using `eth0` but stops working for `tun0`, as described [here](https://github.com/pi-hole/pi-hole/issues/1553), you may want to run this command `pihole -a -i all`, which should get the behavior you want by opening dnsmasq up to listen on all ports. This is not recommended for cloud servers as they should _not_ be listening on `eth0`.
|
||||
So if blocking works using `eth0` but stops working for `tun0`, as described [here](https://github.com/pi-hole/pi-hole/issues/1553), you may want to run this command `pihole -a -i all`, which should get the behavior you want by opening pihole-FTL up to listen on all ports. This is not recommended for cloud servers as they should _not_ be listening on `eth0`.
|
||||
|
||||
If you want to set up your Pi-hole + OpenVPN such that you can use from both internal ((W)LAN) and external (VPN) networks, you have to apply some small changes. As an additional benefit, you will be able to reach all devices in the internal network (e.g. computers, networking-aware printers, etc.) through the VPN.
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ Via this VPN, you can:
|
||||
- access your admin interface remotely
|
||||
- encrypt your Internet traffic
|
||||
|
||||
If you don't want a full-tunnel, we provide a wiki of how to [set up your server to exclusively route DNS traffic, but nothing else via the VPN](only-dns-via-vpn.md). On another optional page, we describe how to set up Pi-hole + VPN in such a way that it is [usable both locally (no VPN) and from remote (through VPN)](dual-operation.md) while preserving full functionality.
|
||||
If you don't want a full-tunnel, we provide a page of how to [set up your server to exclusively route DNS traffic, but nothing else via the VPN](only-dns-via-vpn.md). On another optional page, we describe how to set up Pi-hole + VPN in such a way that it is [usable both locally (no VPN) and from remote (through VPN)](dual-operation.md) while preserving full functionality.
|
||||
|
||||
In the end, you will have access to a VPN that uses Pi-hole for DNS and tunnels some or all of your network traffic
|
||||
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
|
||||
### How to Whitelist or Blacklist
|
||||
|
||||
There are scripts to aid users in adding or removing domains to the whitelist or blacklist.
|
||||
|
||||
The scripts will first parse `whitelist.txt` or `blacklist.txt` for any changes, and if any additions or deletions are detected, it will reload `dnsmasq` so that they are effective immediately.
|
||||
There are scripts to aid users in adding or removing domains to the whitelist or blacklist from the CLI
|
||||
|
||||
Each script accepts the following parameters:
|
||||
|
||||
@@ -22,19 +20,19 @@ Domains passed are parsed by the script to ensure they are valid domains. If a d
|
||||
|
||||
#### Example `pihole -w` usages
|
||||
|
||||
* Attempt to add one or more domains to the whitelist and reload dnsmasq:
|
||||
* Attempt to add one or more domains to the whitelist and reload pihole-FTL:
|
||||
|
||||
```bash
|
||||
pihole -w domain1 [domain2...]
|
||||
```
|
||||
|
||||
* Attempt to add one or more domains to the whitelist, but do not reload dnsmasq:
|
||||
* Attempt to add one or more domains to the whitelist, but do not reload pihole-FTL:
|
||||
|
||||
```bash
|
||||
pihole -w -nr domain1 [domain2...]
|
||||
```
|
||||
|
||||
* Attempt to add one or more domains to the whitelist and force dnsmasq to reload:
|
||||
* Attempt to add one or more domains to the whitelist and force pihole-FTL to reload:
|
||||
|
||||
```bash
|
||||
pihole -w -f domain1 [domain2...]
|
||||
@@ -48,19 +46,19 @@ pihole -w -d domain1 [domain2...]
|
||||
|
||||
#### Example `pihole -b` usages
|
||||
|
||||
* Attempt to add one or more domains to the blacklist and reload dnsmasq:
|
||||
* Attempt to add one or more domains to the blacklist and reload pihole-FTL:
|
||||
|
||||
```bash
|
||||
pihole -b domain1 [domain2...]
|
||||
```
|
||||
|
||||
* Attempt to add one or more domains to the blacklist, but do not reload dnsmasq:
|
||||
* Attempt to add one or more domains to the blacklist, but do not reload pihole-FTL:
|
||||
|
||||
```bash
|
||||
pihole -b -nr domain1 [domain2...]
|
||||
```
|
||||
|
||||
* Attempt to add one or more domains to the blacklist and force dnsmasq to reload:
|
||||
* Attempt to add one or more domains to the blacklist and force pihole-FTL to reload:
|
||||
|
||||
```bash
|
||||
pihole -b -f domain1 [domain2...]
|
||||
|
||||
@@ -11,6 +11,7 @@ Pi-hole being a **advertising-aware DNS/Web server**, makes use of the following
|
||||
- [`lighttpd`](https://www.lighttpd.net/) - web server designed and optimized for high performance
|
||||
- [`php`](https://www.php.net/) - a popular general-purpose web scripting language
|
||||
- [AdminLTE Dashboard](https://github.com/ColorlibHQ/AdminLTE) - premium admin control panel based on Bootstrap 3.x
|
||||
- [`sqlite3`](https://www.sqlite.org/index.html) - SQL Database engine
|
||||
|
||||
While quite outdated at this point, [this original blog post about Pi-hole](https://jacobsalmela.com/2015/06/16/block-millions-ads-network-wide-with-a-raspberry-pi-hole-2-0/) goes into **great detail** about how Pi-hole was originally set up and how it works. Syntactically, it's no longer accurate, but the same basic principles and logic still apply to Pi-hole's current state.
|
||||
|
||||
|
||||
@@ -40,15 +40,15 @@ Due to the complexity of different ways of setting an IP address across differen
|
||||
|
||||
| Service | Port | Protocol | Notes |
|
||||
| --------------------|:-------------|:---------| --------------------|
|
||||
| dnsmasq | 53 (DNS) | TCP/UDP | If you happen to have another DNS server running, such as BIND, you will need to turn it off in order for Pi-hole to respond to DNS queries. |
|
||||
| dnsmasq | 67 (DHCP) | IPv4 UDP | The DHCP server is an optional feature that requires additional ports. |
|
||||
| dnsmasq | 547 (DHCPv6) | IPv6 UDP | The DHCP server is an optional feature that requires additional ports. |
|
||||
| pihole-FTL | 53 (DNS) | TCP/UDP | If you happen to have another DNS server running, such as BIND, you will need to turn it off in order for Pi-hole to respond to DNS queries. |
|
||||
| pihole-FTL | 67 (DHCP) | IPv4 UDP | The DHCP server is an optional feature that requires additional ports. |
|
||||
| pihole-FTL | 547 (DHCPv6) | IPv6 UDP | The DHCP server is an optional feature that requires additional ports. |
|
||||
| lighttpd | 80 (HTTP) | TCP | If you have another Web server already running, such as Apache, Pi-hole's Web server will not work. You can either disable the other Web server or change the port on which `lighttpd` listens, which allows you keep both Web servers running. |
|
||||
| pihole-FTL | 4711-4720 | TCP | FTL is our API engine and uses port 4711 on the localhost interface. This port should not be accessible from any other interface.|
|
||||
|
||||
!!! info
|
||||
The use of lighttpd on port _80_ is optional if you decide not to install the Web dashboard during installation.
|
||||
The use of dnsmasq on ports _67_ or _547_ is optional, but required if you use the DHCP functions of Pi-hole.
|
||||
The use of pihole-FTL on ports _67_ or _547_ is optional, but required if you use the DHCP functions of Pi-hole.
|
||||
|
||||
### Firewalls
|
||||
|
||||
|
||||
Reference in New Issue
Block a user