JustToThePoint English Website Version
JustToThePoint en español

Maximize your online presence with our exclusive offer: Get a stunning hero banner, the hero you need and deserve, at an unbeatable price! Bew, 689282782, bupparchard@gmail.com

How to Block Ads (Network-Wide) with Pi-hole


The Pi-hole® is a DNS sinkhole that protects your devices from unwanted content, without installing any client-side software.

  1. Installing Pi-hole. First, download the script and run the installer: curl -sSL https://install.pi-hole.net | bash

  2. Choose An Interface: tun0/eth0/wlan0 (VPN, Ethernet, WiFi). Select Upstream DNS Provider (which DNS server the Pi-hole should use to resolve IPs/domains): Google. Pi-hole relies on third party lists (with unwanted ad domains): *StevenBlack, *MalwareDom. Select Protocols: *IPv4, *IPv6.

  3. Do you want to use your current network settings as a static address? Typically you will answer Yes and jump to step 5 directly. We will answer No (How to pair Pi-hole with an OpenVPN to block ads and increase privacy on Ubuntu / Debian Linux, nixCraft)Enter your desired IPv4 address : (OpenVPN server’s static IP address: ip a show dev tun0). Enter your desired IPv4 default gateway: (default router IP).

  4. Update OpenVPN config to force all DNS requests to Pi-Hole: sudo vi /etc/openvpn/server.conf

    #Stop using Google DNS for our OpenVPN 
    #push "dhcp-option DNS" 
    #push "dhcp-option DNS" 
    push "dhcp-option DNS"
  5. Restart the openvpn service: sudo systemctl restart openvpn. Change your pihole password: pihole -a -p. Other useful commands: PiHole Status (pihole status), Update PiHole (pihole -up).

  6. Access the web interface for your PiHole, or

  7. You will also need to configure the client devices: Settings, Wi-Fi/Ethernet, DNS: Pi-hole’s IP address (

  8. If you have setup PiHole and OpenVPN on your Raspberry Pi, you can go to your router and change your DNS settings so that it points to your PiHole server. Open a browser and type The password is usually on the back of the router.

    Advanced Setup, DNS, DNS Server Configuration, Use the following Static DNS IP address: Pi-hole’s IP address ( Besides, we could set up the DHCP server in the router, just navigate through Advanced Setup, LAN (Local Area Network (LAN) Setup): Enable DHCP, (Start IP address)- (End IP address). Router configuration

  9. Uninstall Pi-hole: pihole uninstall.

  10. Disable PiHole for 30 minutes: pihole disable 30m.

  11. Add custom blocklists. Access the Pi-hole’s Web Interface in your browser by going to http://Raspberry’sIP/admin. Navigate through Adlist, Groups. Add a new adlist.

    You can find adlists or, more technically, their URLs in The Firebog. Run pihole -g or update your gravity list (list of blocked domains) online after modifying your adlists: http://Raspberry’sIP/admin/gravity.php. You may want to check: pihole -q www.xhamster.com.

  1. Ubuntu runs systemd-resolved which listens on port 53. We need to disable (sudo systemctl disable systemd-resolved.service) and stop it (sudo systemctl stop systemd-resolved.service).
  2. Edit /etc/systemd/resolved.conf: DNS= and DNSStubListener=no.
  3. Delete the symlink /etc/resolv.conf: rm /etc/resolv.conf. Change the /etc/resolv.conf symlink to point to /run/systemd/resolve/resolv.conf: ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf. You could get more information in Docker Pi-hole, Installing on Ubuntu.
  4. Restart systemd-resolved using the following command: systemctl restart systemd-resolved.
  5. Download, configure, and run Pi-Hole container on Docker:
      wget https://raw.githubusercontent.com/pi-hole/docker-pi-hole/master/docker_run.sh 
      sudo chmod +x docker_run.sh
      sudo ./docker_run.sh_
    #!/bin/bash # https://github.com/pi-hole/docker-pi-hole/blob/master/README.md. This is docker_run.sh:
    [[ -d "$PIHOLE_BASE" ]] || mkdir -p "$PIHOLE_BASE" || { echo "Couldn't create storage directory: $PIHOLE_BASE"; exit 1; }
    # Note: ServerIP should be replaced with your external ip. 
    docker run -d --name pihole -p 53:53/tcp -p 53:53/udp \ # This container uses 2 popular ports, port 53 and port 80. 
        -p 80:80 \ 
        -e TZ="Europe/Madrid" \ # Set your timezone to make sure logs rotate at local midnight 
        -v "${PIHOLE_BASE}/etc-pihole/:/etc/pihole/" \ 
        -v "${PIHOLE_BASE}/etc-dnsmasq.d/:/etc/dnsmasq.d/" \
        --dns= --dns= \ # Upstream DNS servers 
        --restart=unless-stopped \ 
        --hostname pi.hole \ 
        -e VIRTUAL_HOST="pi.hole" \ 
        -e PROXY_LOCATION="pi.hole" \ 
        -e ServerIP="" \ # Set to your server's LAN IP: ip addr show 
    printf 'Starting up pihole container ' 
    for i in $(seq 1 20); do 
      if [ "$(docker inspect -f "{{.State.Health.Status}}" pihole)" == "healthy" ] ; then 
        printf ' OK' 
        echo -e "\n$(docker logs pihole 2> /dev/null | grep 'password:') for your pi-hole: https://${IP}/admin/" 
        exit 0 
        sleep 3 
        printf '.' 
      if [ $i -eq 20 ] ; then 
        echo -e "\nTimed out waiting for Pi-hole start, consult your container logs for more info (\`docker logs pihole\`)" 
        exit 1 
  6. The last command generates a random password. Go to a browser: IP’s address/admin and use this password.

    Use Pi_Hole for the entire LAN: ]Access your router: The password is usually on the back of the router. Configuración avanzada/Advanced Setup, DNS: IP address Pi-hole.

  7. Add a new blocklist from The Firebog. Pi-hole, Croup management, Groups, Add a new group, and then, run pihole -g or update your gravity list (list of blocked domain) online after modifying your adlists: http://IP’s address/admin/gravity.php.
  8. Pi-hole cannot resolve DNS for itself, you may want to change your DNS in: Pi-hole, Settings, DNS, Upstream DNS Server.
Bitcoin donation

JustToThePoint Copyright © 2011 - 2024 Anawim. ALL RIGHTS RESERVED. Bilingual e-books, articles, and videos to help your child and your entire family succeed, develop a healthy lifestyle, and have a lot of fun. Social Issues, Join us.

This website uses cookies to improve your navigation experience.
By continuing, you are consenting to our use of cookies, in accordance with our Cookies Policy and Website Terms and Conditions of use.