Language: EN

bloquear-anuncios-con-pi-hole-en-raspberry-pi

What Is and How to Use Pi-hole on Raspberry Pi

Pi-hole is a network-level ad-blocking tool that allows you to filter ads and trackers across your local network.

Installed on a Raspberry Pi, Pi-hole acts as a Domain Name System (DNS) server for your network. When a device on your network tries to access a website, it queries the DNS server to translate the site name into an IP address.

Pi-hole filters these requests and blocks unwanted ones, which are those that match lists of domains known for serving ads or tracking users.

Benefits of using Pi-hole,

  • Ad Blocking: Removes ads on all devices on your network without the need to install blockers on each one.
  • Enhanced Privacy: Blocks trackers and scripts that collect information about your browsing.
  • Reduced Bandwidth Usage: By blocking ads and trackers, you reduce bandwidth consumption.
  • User Interface: Provides a web interface to monitor and configure ad blocking.

For more information and additional support, visit the official Pi-hole page.

Installing Pi-hole on Raspberry Pi

First, prepare the environment by ensuring your Raspberry Pi is updated:

sudo apt update
sudo apt upgrade

Then, download and install Pi-hole using its automated installation script. Run the following command to download and start the installation script:

wget -O basic-install.sh https://install.pi-hole.net
sudo bash basic-install.sh

This script will download and install Pi-hole and guide you through a series of configuration steps.

Initial Configuration

During the installation, you will be asked to configure various aspects of Pi-hole:

pihole-configuration

First, choose a DNS server to use with Pi-hole. You can select one of the recommended public DNS servers or use the DNS server provided by your Internet Service Provider (ISP).

Next, configure the blocklist. Pi-hole uses these lists to filter requests from unwanted domains. During installation, you will be offered a selection of default lists, but you can add more lists in the web interface after installation.

Accessing the Web Interface

Once Pi-hole is installed, you can access its web interface to manage settings and monitor traffic.

Open your web browser and go to the IP address of your Raspberry Pi.

http://localhost/admin

pihole-login

Log in with the admin password provided during installation. Here you can view statistics about blocked requests, manage blocklists, and configure other advanced options.

If you want to change the port on which the admin panel runs, you can do so by editing the configuration file at:

sudo nano /etc/lighttpd/lighttpd.config

Configuring Pi-hole

Once you log in, you will see the main Dashboard, a graphical user interface that provides an overview and detailed view of the system’s operation and performance.

pihole-dashboard

In the Pi-hole web interface, you can adjust advanced settings such as:

  • Blocklists: Add or remove lists of domains to block.
  • Query Logs: View details about DNS requests that have been made.
  • Privacy Settings: Adjust the amount of data stored about DNS queries.

Configuring Devices to Use Pi-hole

For Pi-hole to filter network traffic, you need to configure all your devices to use the Raspberry Pi as their DNS server. You can do this in two ways:

DNS Configuration on the Router

The normal option is to configure your router to use the IP of the Raspberry Pi as its primary DNS server. This will make all devices connected to your network use Pi-hole automatically.

DNS Configuration on Individual Devices

The other option is to manually configure each device on your network to use the IP of the Raspberry Pi as its DNS server. This is useful if you cannot change the router settings or if you want to test Pi-hole on specific devices.

Updating and Maintenance

Keep Pi-hole updated to benefit from the latest features and security fixes. You can update Pi-hole from the web interface or by running:

pihole -up