DoH with Dnsmasq and https-dns-proxy

  • Encrypt your DNS traffic improving security and privacy.
    • Prevent DNS leaks and DNS hijacking.
  • Bypass regional restrictions using public DNS providers.
    • Escape DNS-based content filters and internet censorship.

Install the required packages. DNS encryption should be enabled automatically.

# Install packages
opkg update
opkg install https-dns-proxy

LAN clients should use Dnsmasq as a primary resolver. Dnsmasq forwards DNS queries to https-dns-proxy which encrypts DNS traffic.

Verify domain name resolution with nslookup.

nslookup localhost

Check your DNS provider and test DNSSEC validation.

Collect and analyze the following information.

# Restart services
service log restart; service dnsmasq restart; service https-dns-proxy restart
# Log and status
logread -e dnsmasq; netstat -l -n -p | grep -e dnsmasq
logread -e https-dns; netstat -l -n -p | grep -e https-dns
# Runtime configuration
pgrep -f -a dnsmasq; pgrep -f -a https-dns
head -v -n -0 /etc/resolv.* /tmp/resolv.* /tmp/resolv.*/*
# Persistent configuration
uci show dhcp; uci show https-dns-proxy

If you want to manage the settings using web interface. Install the necessary packages.

# Install packages
opkg update
opkg install luci-app-https-dns-proxy
service rpcd restart
  • Navigate to LuCI → Network → DHCP and DNS to configure Dnsmasq.
  • Navigate to LuCI → Services → HTTPS DNS Proxy to configure https-dns-proxy.

https-dns-proxy is configured with Google DNS and Cloudflare DNS by default. You can change it to Google DNS or any other DoH provider. Use resolvers supporting DNSSEC validation if necessary. Specify several resolvers to improve fault tolerance.

# Configure DoH provider
while uci -q delete https-dns-proxy.@https-dns-proxy[0]; do :; done
uci set https-dns-proxy.dns="https-dns-proxy"
uci set https-dns-proxy.dns.bootstrap_dns=","
uci set https-dns-proxy.dns.resolver_url=""
uci set https-dns-proxy.dns.listen_addr=""
uci set https-dns-proxy.dns.listen_port="5053"
uci commit https-dns-proxy
service https-dns-proxy restart
This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
  • Last modified: 2023/12/07 20:04
  • by frollic