Miscellaneous pihole commands

1. Display system stats

CPU, Volt, Temp and Clock speed

sudo /opt/vc/bin/vcgencmd measure_volts
sudo /opt/vc/bin/vcgencmd measure_temp
sudo /opt/vc/bin/vcgencmd measure_clock

2. Backing up pihole FTL long term log

# sudo service pihole-FTL stop

# sudo mv /etc/pihole/pihole-FTL.db /media/backup/pihole-FTL_$(date +"%m-%y").db

# sudo rm /etc/pihole/pihole-FTL.db

# sudo service pihole-FTL start

sudo service pihole-FTL stop ; sudo rm /etc/pihole/pihole-FTL.db ; sudo service pihole-FTL start

3. Setting secondary DNS server pihole

Adapter the answer from here. Edit your config using the command sudo nano /etc/dnsmasq.d/02-pihole-dhcp.conf

Your config file should look like this:

dhcp-authoritative
dhcp-range=192.168.100.10,192.168.100.70,24h
dhcp-option=option:router,192.168.100.1
dhcp-leasefile=/etc/pihole/dhcp.leases
#quiet-dhcp
# Following line sends 2 DNS servers over DHCP
dhcp-option=6,192.168.100.27,192.168.100.35,91.239.100.100
domain=lan

Remember to restart the DNS resolver by running

sudo /etc/init.d/dnsmasq restart

4. Modify duration of log retention

Edit the duration of retaining logs by using the command sudo nano /etc/pihole/pihole-FTL.conf

# Contents
PRIVACYLEVEL=0
ANALYZE_ONLY_A_AND_AAAA=true
MAXDBDAYS=30
DBINTERVAL=15

5. Force DNS lookups by disabling pihole DNS cache

Edit your config using the command sudo nano /etc/dnsmasq.d/01-pihole.conf to disable DNS caching, this forces pihole to forward DNS queries to upstream resolvers.

# Set following
cache-size=0
# Now pi-hole always forwards non-blocked lookups

pihole restartdns # To put in effect

In unbound.conf make following changes

sudo nano /etc/unbound/unbound.conf.d/pi-hole.conf
# Add following lines / Change default values to these
prefetch: yes
cache-min-ttl: 0
serve-expired: yes
msg-cache-size: 128m
rrset-cache-size: 256m

# Restart unbound
sudo service unbound restart

Some tips are from this reddit thread.

Previous
Next