Skip to content

Instantly share code, notes, and snippets.

@tgardiner
Last active April 23, 2022 18:23
Show Gist options
  • Save tgardiner/42fe7b0a6b10c7e5b9ec4709efd67937 to your computer and use it in GitHub Desktop.
Save tgardiner/42fe7b0a6b10c7e5b9ec4709efd67937 to your computer and use it in GitHub Desktop.
DNS over HTTPS with cloudflared on macOS

DNS over HTTPS with cloudflared on macOS

The instructions on Cloudflare's website are confusing and incomplete.

  1. Install cloudflared:

     brew install cloudflare/cloudflare/cloudflared
    
  2. Create the configuration file:

     mkdir /usr/local/etc/cloudflared/ && vim /usr/local/etc/cloudflared/config.yml
    
  3. With the contents:

     proxy-dns: true
     proxy-dns-upstream:
       - https://1.1.1.1/dns-query
       - https://1.0.0.1/dns-query
    
  4. Enable on system boot:

     sudo cloudflared service install
    
  5. Start the service:

     sudo launchctl start com.cloudflare.cloudflared
    
  6. Test with dig:

     dig @127.0.0.1 google.com A
    
  7. Change your dns settings to point to 127.0.0.1:

     sudo networksetup -setdnsservers Wi-Fi 127.0.0.1
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment