2020-11-11 11:47:10 +01:00
---
title: Pi-hole
template: docs
taxonomy:
2020-11-14 14:14:50 +01:00
category: docs, apps
2021-02-06 18:22:00 +01:00
routes:
default: '/app_pihole'
2020-11-11 11:47:10 +01:00
---
2021-02-06 23:39:43 +01:00
![Pi-hole's logo ](image://pihole_logo.png?width=80 )
2018-11-22 00:58:30 +01:00
2020-04-17 12:05:29 +02:00
[![Install Pi-hole with YunoHost ](https://install-app.yunohost.org/install-with-yunohost.png )](https://install-app.yunohost.org/?app=pihole) [![Integration level ](https://dash.yunohost.org/integration/pihole.svg )](https://dash.yunohost.org/appci/app/pihole)
2018-11-22 00:58:30 +01:00
2022-10-17 23:13:51 +02:00
*Pi-hole* is a network-level ad blocker that acts as a DNS layer and possibly a DHCP3 server for use on a private network. It is designed to be installed on embedded devices with network capabilities, such as the Raspberry Pi, but can be used on other machines running GNU/Linux or in virtualised environments.
2020-04-17 12:05:29 +02:00
2022-10-17 23:13:51 +02:00
## Using Pi-hole as a DHCP server
2020-04-17 12:05:29 +02:00
> **Warning, you should be aware that touching your DHCP could break your network.
In case your server is inaccessible, you will lose your dns resolution and IP address.
Thus, you would lose any connection to the internet and even the connection to your router.**
> If you encounter this kind of problem, please read the section "How to restore my network".
2022-10-17 23:13:51 +02:00
### Configure Pi-hole
2020-04-17 12:05:29 +02:00
There are 2 ways to configure Pi-hole to be used as your DHCP server.
- Either you can choose to use it when you install the application.
- Or you can activate the DHCP server afterwards in the "Settings" tab, part "Pi-hole DHCP Server".
2020-04-19 19:30:00 +02:00
In this second case, it may be preferable to force the server IP to a static address.
2020-04-17 12:05:29 +02:00
### Configure my router
Your router or your ISP's router has a DHCP server enabled by default.
If you keep this DHCP, along with Pi-hole's, you will have transparent conflicts between them.
2020-04-19 19:30:32 +02:00
The first DHCP server to respond will distribute its own IP and settings.
2020-04-17 12:05:29 +02:00
So you need to turn off your router's DHCP server and let Pi-hole manage your network.
#### Why should I use Pi-hole's DHCP?
By using Pi-hole's DHCP, you allow Pi-hole to give its dns configuration to each of your clients. This way, every request will be filtered by Pi-hole.
2020-04-19 19:29:36 +02:00
Another case of using Pi-hole DHCP is if you have hairpinning problems (you can't connect to your server because its IP is your public IP, and your router doesn't allow this).
2020-04-17 12:05:29 +02:00
In this case, using Pi-hole's dns will allow you to connect to your server by its local address rather than its public address.
2020-04-17 12:57:12 +02:00
### Restore network
2020-04-17 12:05:29 +02:00
> Oops!
2022-10-17 23:13:51 +02:00
Your Pi-hole server has crashed, and you don't have DHCP anymore.
2020-04-17 12:05:29 +02:00
Don't panic. We'll get through this.
Use your favorite device on your desktop computer.
And first, get your network interface (usually `eth0` ).
2022-10-17 23:03:16 +02:00
2020-04-17 12:05:29 +02:00
```bash
sudo ifconfig
```
2020-04-19 19:30:44 +02:00
Then change your IP to a static one.
2022-10-17 23:03:16 +02:00
2020-04-17 12:05:29 +02:00
```bash
sudo ifconfig eth0 192.168.1.100
```
Now you can connect to your router and reboot its DHCP server to use it again.
2020-04-19 19:30:22 +02:00
You can now remove your static IP and get a dynamic IP again.
2022-10-17 23:03:16 +02:00
2020-04-17 12:05:29 +02:00
```bash
sudo ifconfig eth0 0.0.0 & & sudo dhclient eth0
```
> Remember to turn off your router's DHCP if your server is running again.
## Useful links
2020-04-17 12:57:12 +02:00
+ Website: [pi-hole.net ](https://pi-hole.net )
+ Official documentation: [docs.pi-hole.net ](https://docs.pi-hole.net/ )
2020-04-17 12:05:29 +02:00
+ Application software repository: [github.com - YunoHost-Apps/pihole ](https://github.com/YunoHost-Apps/pihole_ynh )
+ Fix a bug or an improvement by creating a ticket (issue): [github.com - YunoHost-Apps/pihole/issues ](https://github.com/YunoHost-Apps/pihole_ynh/issues )