This is an old revision of the document!

Is this Nethserver module helpful to you?
Please consider donating to the author

Thank you kindly!

2019/03/04 11:32 · HF

Available for NS7

Pi-hole is a Linux network-level advertisement and Internet tracker blocking application which acts as a DNS sinkhole and optionally a DHCP server (even if it is workable, you could use the router of your network or the DHCP server of NethServer), intended for use on a private network. It is designed for use on embedded devices with network capability, such as the Raspberry Pi,but it can be used on other machines running Linux and cloud implementations.

Pi-hole has the ability to block traditional website advertisements as well as advertisements in unconventional places, such as smart TVs and mobile operating system advertisements.

nethserver-pihole relie on nethserver-docker, you will run a docker container either on the aeria network (experimental) or on the macvlan network (Recommended). Saying that the pihole container will have an IP on your network, you will just have to set in the DHCP server of your network that the DNS server is the IP of pihole

Stephane de Labrusse at

1-You need to install my repository, see how to do it

2-You can install pihole

yum install nethserver-pihole --enablerepo=stephdl


if you have decided to use the aeria network, please jump to the next chapter

Macvlan is particuliar network, this is the documentation for explanation, please refer there to understand:

You must have a bridge, here called br0, if you have installed SAMBA AD, then it is already created. Else you can use the network panel to make it available.

config setprop  docker macVlanGateway macVlanLocalNetwork macVlanNetwork macVlanNic br0
signal-event nethserver-docker-update

- check macvlan is up : docker network ls - then assign macvlan to piholeNetwork and set the IP to piholeMacVlanIP (in macvlan range)

config setprop pihole piholeNetwork macvlan piholeMacVlanIP


if you have decided to use the macvlan network, please jump to the next chapter

To create the AERIA network please review

You must have a bridge, here called br0, if you have installed SAMBA AD, then it is already created. Else you can use the network panel to make it available.

config setprop docker bridgeAeria br0
signal-event nethserver-docker-update

- check aeria is up : docker network ls

- then assign aeria to piholeNetwork

config setprop pihole piholeNetwork aeria

Create the container

review the pihole conf : config show pihole

    DNS1=    #upstream dns
    DNS2=    #upstream dns
    mac=00:60:2f:0a:66:06    # once generated, it is static mac
    password=admin  #web admin password

- change the admin password (default is admin)

By default the password is admin, you should change it obviously, once created with a password, you must destroy the container, change the password and create it again.

config setprop docker password azertyuiop

- Modify the upstream DNS of pihole following your needs (default is google DNS)

you can adjust to different DNS if you think they are faster or DNS with adult filtering if your want to protect your kids

as example I will use, decide what Family or Adult filter to use (

If you want to filter porn, set DNS1 and DNS2 to

Family filter
    DNS1=    #upstream dns
    DNS2=    #upstream dns

Adult filter
    DNS1=    #upstream dns
    DNS2=    #upstream dns

set DNS1 and DNS2 accordingly

config setprop pihole DNS1 DNS2


config setprop pihole DNS1 DNS2

- trigger the event to create the container

signal-event nethserver-pihole-update

- The time depends of your internet bandwith

- check docker pihole is up :

docker ps

pihole status

- Modify the PHP CGI memory limit

The php memory limit for CGI is set to 512M, this should be good but when you browse the long-term data graphs you might need to increase it

config setprop pihole PhpMemoryLimit 1024M
signal-event nethserver-pihole-update
pihole upgrade

Once installed pihole is available at the ip of the container, to find it do pihole ip in the terminal, use the IP of the container in your browser, then log with the credential admin and the password set in the password esmith property

To use Pi-Hole, make sure that your devices use Pi-Hole's IP address as their only DNS server. To accomplish this, there are generally 2 methods to make it happen:

  1. In router's LAN DHCP settings, set Pi-Hole's IP address as the only DNS server available for connected devices.
  2. Manually configure each device to use Pi-Hole's IP address as their only DNS server.

Note: Some routers (or even ISPs) do not allow to change LAN DNS settings, so you might want to disable router's DHCP server and use the NetHServer built in DHCP server instead. More information about making other devices use Pi-Hole can be found at upstream documentation.

Some router can still serve DNS request when the IPV6 is enabled, you should turn it off because we do not use yet with NethServer. I mean the livebox4 of orange for example

do pihole in your terminal to get help

pihole facilities wrapper to docker command

  pihole ip : find the IP of pihole given by your dhcp server for aeria network
  pihole status : retrieve the status of pihole container
  pihole env : retrieve all the environment vars of the container
  pihole bash : start a shell inside the container
  pihole start: Start the pihole container
  pihole stop: Stop the pihole container
  pihole destroy: Delete the pihole container
  pihole build: Delete then create the pihole container
  pihole upgrade: Upgrade docker image, delete then create the pihole container
  pihole ps: Container information
  pihole log: Display the error log of the container

As many docker container the upgrade of a container means you must destroy it before

pihole upgrade

Upgrade the docker image, delete then build again the container

All the container data are in /var/lib/pihole, it is included in the backup-data of your NethServer if used.

Please raise Issues on github