Configure Ubuntu Pi-hole for Cloudflare DNS over HTTPS

htt‮‬ps://www.lautturi.com
Configure Ubuntu Pi-hole for Cloudflare DNS over HTTPS

To configure Pi-hole on Ubuntu to use Cloudflare DNS over HTTPS (DoH), you will need to modify the Pi-hole DNS settings and install the jq utility.

  1. Install jq by running the following command:
sudo apt-get install jq
  1. Modify the Pi-hole DNS settings by running the following command:
sudo pihole -a setdns cloudflare "https://cloudflare-dns.com/dns-query"

This will set Cloudflare DNS as the primary DNS resolver for Pi-hole.

  1. To enable DoH, you will need to obtain a Cloudflare API key. You can do this by visiting the Cloudflare dashboard and creating a new API key.

  2. Once you have obtained an API key, you can use the following script to configure Pi-hole to use DoH:

#!/bin/bash

# Set Cloudflare API key
CLOUDFLARE_API_KEY=your_api_key

# Set Cloudflare email address
CLOUDFLARE_EMAIL=your_email@example.com

# Set Cloudflare zone ID
CLOUDFLARE_ZONE_ID=your_zone_id

# Set Pi-hole URL
PIHOLE_URL=http://localhost/admin/

# Set Pi-hole API password
PIHOLE_API_PASSW
Created Time:2017-10-16 14:38:42  Author:lautturi