← Back to Projects

RPi5 Home Server — Part 2: Network & Monitoring

Part 2 of the RPi5 home server series. Install Pi-hole for DNS-based ad blocking and Glances for real-time hardware monitoring, then wire both into your Homepage dashboard.

This is Part 2 of the Raspberry Pi 5 Home Server series. If you haven't completed Part 1, start there — this guide assumes Docker, Docker Compose, and the directory structure from Part 1 are already in place.

All containers in this part are added to the same docker-compose.yml at /mnt/data/docker-compose/docker-compose.yml.


What We're Installing

ServicePurposePort
Pi-holeDNS-based ad and tracker blocking8082
GlancesReal-time hardware monitoring61208

Pi-hole — DNS Ad Blocking

Pi-hole acts as a private DNS server. Instead of your devices asking Google (8.8.8.8) or your ISP where a website is, they ask your Pi. If the request is for an ad server or a tracker, Pi-hole simply says "that doesn't exist" — and the ad never loads.

N
NOTE

In this setup Pi-hole runs on the Pi itself and is not configured as a network-wide DNS server on the router. It is used selectively — useful for testing, local DNS records, and per-device configuration without touching your router settings. To use it network-wide, set your router's DNS to your Pi's IP address (192.168.1.150).

1. Resolve the Port 53 conflict

Most modern Linux systems run systemd-resolved, which claims port 53 by default. Since DNS must use port 53, we need to free it before Pi-hole can start.

Disable the stub listener:

sudo systemctl stop systemd-resolved
sudo systemctl disable systemd-resolved

Reset the DNS configuration so the Pi can still reach the internet while we work:

sudo rm /etc/resolv.conf
echo "nameserver 9.9.9.9" | sudo tee /etc/resolv.conf

This sets Quad9 as a temporary upstream resolver — a privacy-focused alternative to Google DNS that supports DNSSEC.

2. Create the directory structure

mkdir -p /mnt/data/docker-compose/appdata/pihole/etc-pihole
mkdir -p /mnt/data/docker-compose/appdata/pihole/etc-dnsmasq.d

3. Docker Compose configuration

Add this to your docker-compose.yml under services::

  pihole:
    container_name: pihole
    image: pihole/pihole:latest
    restart: unless-stopped
    ports:
      - "53:53/tcp"
      - "53:53/udp"
      - "8082:80/tcp"
    environment:
      TZ: 'Etc/UTC'
      WEBPASSWORD: 'your_secure_password'
      FTLCONF_LOCAL_IPV4: '192.168.1.150'
    volumes:
      - /mnt/data/docker-compose/appdata/pihole/etc-pihole:/etc/pihole
      - /mnt/data/docker-compose/appdata/pihole/etc-dnsmasq.d:/etc/dnsmasq.d
    cap_add:
      - NET_ADMIN
W
WARN

Change your_secure_password before deploying. This is the password for the Pi-hole web admin interface.

Deploy:

cd /mnt/data/docker-compose
docker compose up -d pihole

Access the dashboard at http://192.168.1.150:8082/admin

4. Post-install configuration

Upstream DNS — Go to Settings → DNS and select Quad9 (Filtered, DNSSEC) for privacy-respecting upstream resolution.

Local DNS records — Go to Local DNS → DNS Records and add entries for your containers. Pointing homepage.lan to 192.168.1.150 lets you access your dashboard by name instead of typing the IP and port.

Gravity update — Go to Tools → Update Gravity to pull the latest blocklists immediately.

5. Homepage integration

Add this to your services.yaml:

- Infrastructure:
    - Pi-hole:
        icon: pi-hole.png
        href: http://192.168.1.150:8082/admin
        description: DNS Ad Blocking
        widget:
          type: pihole
          url: http://192.168.1.150:8082
          key: your_pihole_api_key
N
NOTE

Find your API key in the Pi-hole admin under Settings → API. The widget displays a live count of blocked queries, total DNS requests, and the percentage of traffic blocked.


Glances — Real-Time Hardware Monitoring

Glances is a cross-platform system monitoring tool that presents maximum information in minimum space. On the Raspberry Pi 5 it shows CPU usage, RAM, disk I/O, network throughput, running processes, and crucially — hardware temperatures.

N
NOTE

Glances is installed natively on the Pi rather than as a Docker container. Native installation gives it direct access to hardware sensors — particularly the Pi 5's CPU temperature — which is difficult to expose reliably through Docker's isolation layer.

1. Install Glances natively

sudo apt update
sudo apt install -y glances

Verify:

glances --version

2. Run Glances as a persistent web service

Create a systemd service so Glances starts automatically and stays running:

sudo nano /etc/systemd/system/glances.service

Add:

[Unit]
Description=Glances System Monitor
After=network.target

[Service]
ExecStart=/usr/bin/glances -w --port 61208
Restart=on-failure
User=admin

[Install]
WantedBy=multi-user.target

Enable and start:

sudo systemctl daemon-reload
sudo systemctl enable glances
sudo systemctl start glances

Verify it's running:

sudo systemctl status glances

3. Access the web interface

Navigate to http://192.168.1.150:61208

The dashboard uses a color-coded alert system:

ColorMeaning
GreenNormal
BlueCareful
MagentaWarning
RedCritical

Terminal mode — if you're SSH'd into the Pi and want the classic view:

glances

4. Homepage integration

- Infrastructure:
    - Glances:
        icon: glances.png
        href: http://192.168.1.150:61208
        description: Real-time System Stats
        widget:
          type: glances
          url: http://192.168.1.150:61208
          metric: cpu
T
TIP

Add multiple Glances widget entries with different metric values to show CPU, RAM, and disk side by side on your dashboard. All use the same url — just change metric to cpu, memory, disk, or network.


Troubleshooting

Pi-hole fails to start — "bind: address already in use"

Port 53 is still claimed. Check what's using it:

sudo lsof -i :53

If systemd-resolved is still listed despite being disabled, reboot:

sudo reboot

Pi-hole admin page returns "ERR_CONNECTION_REFUSED"

Check the container logs:

docker compose logs pihole

Glances service fails to start

Check the service logs:

sudo journalctl -u glances -n 50

The most common cause is the wrong username in the User= field of the service file. Make sure it matches your actual Pi username.

Glances shows no temperature data

If temperatures show as unavailable, the sensor may need elevated permissions. Test by running Glances as root temporarily:

sudo glances -w --port 61209

If temperatures appear, update the service file to run as root or add the admin user to the appropriate hardware group.


Series Navigation