DNS over HTTPS (DoH) enhances your online privacy and security by encrypting your DNS queries. Instead of sending your DNS requests in plain text (which can be intercepted and analyzed), DoH encrypts them using HTTPS, making them much harder to eavesdrop on. This guide provides a detailed walkthrough of setting up DoH on various Linux distributions.
Selecting a reputable DoH provider is crucial. Consider factors like privacy policy, location, and performance. Popular options include:
Many modern Linux distributions use systemd-resolved as their DNS resolver. This is often the easiest method to configure DoH. You'll typically edit the /etc/systemd/resolved.conf file. Add or modify the following lines, replacing with your chosen provider's address:
[Resolve]
DNS=
DNSOverHTTPS=yes
For example, for Cloudflare:
[Resolve]
DNS=cloudflare-dns.com
DNSOverHTTPS=yes
After saving the file, restart systemd-resolved:
sudo systemctl restart systemd-resolved
If you're using NetworkManager, you can configure DoH through its GUI or command-line tools. The exact steps vary depending on your desktop environment. Consult your distribution's documentation for specific instructions.
Directly editing /etc/resolv.conf is generally discouraged as it's often managed dynamically. Modifying it might lead to conflicts. However, some distributions allow you to set DNS settings in other network configuration files (e.g., files within /etc/netplan/).
For advanced users, using a DNS client like unbound provides more control and customization options. You'll need to configure unbound to use DoH and then configure your system to use unbound as its DNS resolver. This involves more complex configuration steps and is beyond the scope of this basic guide.
After configuring DoH, you can verify it's working by using tools like dig or nslookup. These tools can show you the DNS query method being used.
dig @ example.com +trace
If DoH is working correctly, you should see HTTPS in the output indicating that your DNS query was made using DoH. Note that the exact output may vary depending on the tool and the DNS provider.
If you encounter issues, check your network configuration, ensure your chosen DoH server is reachable, and review your configuration files for any errors. Consult your distribution's documentation for more specific troubleshooting steps.
Setting up DNS over HTTPS significantly improves the security and privacy of your Linux system. By following these steps and choosing a reliable provider, you can protect your online activity from unwanted surveillance.