Skip to content

Instantly share code, notes, and snippets.

@ndlrx
Last active March 19, 2023 17:43
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save ndlrx/426a353c25684ba83b652db60ca58bb9 to your computer and use it in GitHub Desktop.
Save ndlrx/426a353c25684ba83b652db60ca58bb9 to your computer and use it in GitHub Desktop.
Install dnscrypt-proxy on Archlinux or Manjaro

Step 1 - Install and Configure dnscrypt-proxy

sudo su
pacman -S dnscrypt-proxy
cd /etc/dnscrypt-proxy/
vim dnscrypt-proxy.toml
  • Choose dns resolver

https://download.dnscrypt.info/resolvers-list/v2/public-resolvers.md

server_names = ['scaleway-fr', 'soltysiak', 'cloudflare', 'doh-blahdns-de']
  • Configure Liste address on port 53000
listen_addresses = ['127.0.0.1:53000', '[::1]:53000']
  • Enable dns cache
cache = true
  • Start service and add it ot the boot time
systemctl start dnscrypt-proxy
systemctl enable dnscrypt-proxy

Step 2 - Install and Configure Dnsmasq

pacman -S dnsmasq
vim /etc/dnsmasq.conf
  • Configure Dnsmasq
no-resolv
server=::1#53000
server=127.0.0.1#53000
listen-address=::1,127.0.0.1
  • DNSSEC Validation
conf-file=/usr/share/dnsmasq/trust-anchors.conf
dnssec
  • Start service and add it to the boot time
systemctl start dnsmasq
systemctl enable dnsmasq

Step 3 - Edit resolv.conf

vim /etc/resolv.conf
  • Change resolver to local Dnsmasq
nameserver ::1
nameserver 127.0.0.1
options edns0 single-request-reopen

Step 4 - Checking the Result

https://www.dnsleaktest.com/

Additional:

permanent /etc/resolv.conf file

chattr +i /etc/resolv.conf

📝 with ♥️ by ndlr

@hnharejin
Copy link

It was a little tortuous, but it worked finally! Thank you for sharing!

I disabled DNSSEC because alidns-doh or cloudflare may not support it. I am not sure that.

insecure ds reply received for org, check domain configuration and upstream dns server dnssec support

@abnt713
Copy link

abnt713 commented Jan 4, 2022

Thank you very much for this guide

@smzm
Copy link

smzm commented Sep 7, 2022

How Check dnsmasq work :

  1. install bind package : sudo pacman -S bind
  2. dig google.com ---> Check Query time. it should be something like : 150msec
  3. again type google.com ---> Check Query Time. it should be Zero : 0msec

@dyrer
Copy link

dyrer commented Mar 19, 2023

Should I enable cache on dnsmasq??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment