Pihole DNS Over HTTPS Tutorial for Beginners

Author

Reads 882

Smart home wireless network router device
Credit: pexels.com, Smart home wireless network router device

Pihole DNS Over HTTPS is a game-changer for online security.

By enabling DNS over HTTPS on Pihole, you can encrypt your DNS queries, making it much harder for hackers to intercept and steal your sensitive information.

Pihole is a free, open-source software that runs on a Raspberry Pi and blocks ads, trackers, and malware at the network level.

To get started with Pihole DNS over HTTPS, you'll need to access your Pihole's web interface by navigating to your Pi's IP address in a web browser.

Check this out: Fortigate Content Filter

Why Use DNS?

Using DNS is essential for accessing websites, but it's not as secure as you might think. With standard DNS, requests are sent in plain-text, leaving you vulnerable to tampering and misbehavior.

This means a malicious actor can look at all your DNS requests, figure out what websites you're visiting, and even tamper with the response to redirect you to fake websites.

DNS-Over-HTTPS prevents this by using standard HTTPS requests to retrieve DNS information, making the connection from your device to the DNS server secure and hard to snoop or block.

The upstream DNS-Over-HTTPS provider will still have the ability to monitor your DNS requests, so it's worth noting that this isn't a foolproof solution.

Additional reading: Is Proton Drive Secure

Setup and Configuration

Credit: youtube.com, Encrypted DNS with a Pi-hole

To set up Pi-hole with DNS over HTTPS, you'll need to install Cloudflared on your Raspberry Pi. Run the command to install Cloudflared, and then create a user for the daemon to run under using the `useradd` command with the `-s`, `-r`, and `-M` options.

To configure Cloudflared to proxy DNS-over-HTTPS requests, create a service file using the `sudo nano` command, and add the following lines to set up the service. The key line is where you specify the call to the Cloudflared daemon, using the `proxy-dns` option to operate as a proxy for DNS-over-HTTPS on your Raspberry Pi for Pi-Hole.

Here are the key options to pass to Cloudflared:

  • “proxy-dns” to operate as a proxy for DNS-over-HTTPS (DOH)
  • “--port” to specify the port number (5053 in this case)
  • “--upstream” to specify the upstream DNS servers (1.1.1.1 and 1.0.0.1 in this case)

Configuring

Configuring your Pi-hole is a crucial step in setting up a robust and secure DNS filtering system. You'll need to configure Pi-hole to use a custom DNS server.

To configure Pi-hole to use the local cloudflared service, specify 127.0.0.1#5053 as the Custom DNS (IPv4) in the Pi-hole settings. Don't forget to hit Return or click on Save.

smart home devices
Credit: pexels.com, smart home devices

After configuring Pi-hole to use the local cloudflared service, you'll need to change the DNS back to something else in Pi-hole's DNS settings.

To configure Pi-hole to use DNS-Over-HTTPS (DoH), you'll need to point Pi-hole to the Raspberry Pi's DoH proxy. Change to the DNS settings by clicking “DNS” within the top navigation bar.

Ensure that all upstream DNS servers are unticked on the left-hand side. Then, enable a custom DNS server by ticking a checkbox and typing in “127.0.0.1#5053”.

Recommended read: Dns Settings Hostinger

Set Up Debian 12 LXC Container

To set up your Debian 12 LXC container, start by allocating a minimum of 512MB RAM and 2GB storage. Allocate a static IP for ease of access.

You'll need a server running Proxmox or another virtualized environment to host your LXC container.

To get started, create an LXC container on Proxmox running Debian 12.

Here are the requirements for setting up Pi-hole with Cloudflared on Proxmox:

  • A server running Proxmox (or another virtualised environment)
  • An LXC container with Debian 12 (Bookworm) installed
  • Basic knowledge of command-line operations

Configure DNS

To configure Pi-hole to use Cloudflared DNS, start by accessing the Pi-hole admin interface and navigating to Settings > DNS. Here, you'll add 127.0.0.1#5053 as a custom DNS server.

Credit: youtube.com, DNS Configuration - CompTIA A+ 220-1101 - 2.6

To set up Cloudflared to proxy DNS-Over-HTTPS requests, create a service file that will run Cloudflared. This service will pass options to Cloudflared so that it will operate as a proxy for DNS-Over-HTTPS (DOH) on your Raspberry Pi for Pi-Hole.

You'll need to specify the call to the Cloudflared daemon, passing in the “proxy-dns” option to tell the daemon to operate as a proxy for DNS-Over-HTTPS (DOH) on your Raspberry Pi for Pi-Hole. Next, use the “--port” option to tell Cloudflared to operate its DoH proxy on port 5053.

To configure Pi-hole to use the local cloudflared service as the upstream DNS server, specify 127.0.0.1#5053 as the Custom DNS (IPv4) in Pi-hole's settings. Don't forget to hit Return or click on Save.

Here's a summary of the steps to configure Pi-hole to use Cloudflared DNS:

  • Access the Pi-hole admin interface and navigate to Settings > DNS.
  • Add 127.0.0.1#5053 as a custom DNS server.
  • Create a service file that will run Cloudflared.
  • Specify the call to the Cloudflared daemon, passing in the “proxy-dns” option.
  • Use the “--port” option to tell Cloudflared to operate its DoH proxy on port 5053.

By following these steps, you'll be able to configure Pi-hole to use Cloudflared DNS, improving your privacy and security while browsing the internet.

User Setup and Management

Credit: youtube.com, PiHole + Cloudflare DNS over HTTPS to bypass ISP Restrictions

To set up Cloudflared on your Raspberry Pi, you'll need to create a user for the daemon to run under. This user is called "cloudflared".

The command to create this user is: `useradd -s /sbin/nologin -r -M cloudflared`. This command uses the following options: `-s` to set the user's shell to `/sbin/nologin`, `-r` to create the user as a system user, and `-M` to prevent the useradd command from generating a home directory for this user.

To summarize, the options used to create the user are: -s: to set the user's shell-r: to create the user as a system user-M: to prevent generating a home directory

User Creation and Setup

Creating a user for Cloudflared to run under is a crucial step in setting up your Raspberry Pi. This user will be used to proxy DNS-Over-HTTPS requests from Pi-Hole.

To create a user called “cloudflared”, you'll need to use the useradd command with some specific options. The “-s” option is used to set the user’s shell to something that can’t be utilized. This is important for security reasons.

Credit: youtube.com, Administration: Manage Users

The “-r” option tells the system to create this user as a system user. This is necessary for Cloudflared to function properly.

Finally, the “-M” option is used to tell the useradd command that it shouldn’t generate a home directory for this user. This is a common practice when creating system users.

Here are the options used to create the user in more detail:

  • -s: Sets the user’s shell to something that can’t be utilized.
  • -r: Creates the user as a system user.
  • -M: Prevents the useradd command from generating a home directory for the user.

Step 7: Verify

Now that you've set up your user accounts, it's time to verify everything is working as expected. You can use the dig command to ensure successful resolution through Cloudflared.

Use the dig command to check for a response indicating successful resolution through Cloudflared. You should see a response indicating successful resolution through Cloudflared.

Monitoring Pi-hole's query logs can also confirm that queries are routed through 127.0.0.1#5053. This will give you a clear picture of how your system is handling DNS queries.

DNS Over HTTPS

DNS Over HTTPS is a game-changer for internet security and privacy. It encrypts your DNS queries, making it harder for third parties to intercept and steal your data.

Credit: youtube.com, DNS over HTTPS in 2 Minutes

Pi-hole, a network-wide ad blocker, can be paired with Cloudflared to route DNS queries through DNS over HTTPS. This setup provides secure, encrypted DNS for your entire network.

To enable DNS over HTTPS with Pi-hole, you'll need to configure Cloudflared to operate as a DoH proxy. This involves creating a service file that tells Cloudflared to operate on port 5053 and connect to upstream DNS servers, such as Cloudflare's 1.1.1.1 and 1.0.0.1.

Here are the options you'll need to pass to the Cloudflared daemon:

  • proxy-dns: tells the daemon to operate as a proxy for DNS-Over-HTTPS (DOH)
  • --port 5053: tells Cloudflared to operate its DoH proxy on port 5053
  • --upstream: specifies where to connect for DNS requests

Once you've set up the service file, you'll need to configure Pi-hole to use the local Cloudflared service as the upstream DNS server. This involves specifying 127.0.0.1#5053 as the Custom DNS (IPv4) in Pi-hole's settings.

After making these changes, you'll see a message indicating that your Raspberry Pi's Pi-Hole server now uses DNS-Over-HTTPS (DoH) to make DNS requests. This improves your privacy and security while browsing the internet.

A fresh viewpoint: DNS Hosting Service

Walter Brekke

Lead Writer

Walter Brekke is a seasoned writer with a passion for creating informative and engaging content. With a strong background in technology, Walter has established himself as a go-to expert in the field of cloud storage and collaboration. His articles have been widely read and respected, providing valuable insights and solutions to readers.

Love What You Read? Stay Updated!

Join our community for insights, tips, and more.