# \[OUTDATED\] Setting Up and Using DNScrypt-Loader

**URL:** <https://discourse.pi-hole.net/t/outdated-setting-up-and-using-dnscrypt-loader/606>\
**Category:** Community How-to's\
**Created:** [November 16, 2016, 6:05pm UTC](https://discourse.pi-hole.net/t/outdated-setting-up-and-using-dnscrypt-loader/606 "2016-11-16T18:05:09Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![firestorrrm](https://discourse-cdn.pi-hole.net/letter_avatar_proxy/v4/letter/f/edb3f5/32.png) [@firestorrrm](https://discourse.pi-hole.net/u/firestorrrm)\
**Post date:** [November 16, 2016, 6:05pm UTC](https://discourse.pi-hole.net/t/outdated-setting-up-and-using-dnscrypt-loader/606/1 "2016-11-16T18:05:09Z")

</div>

## **⚠ THIS TUTORIAL ONLY WORKS WITH DNSCRYPT VERSION 1.9.1 OR EARLIER ⚠**  
See: [dnscrypt-proxy v1.9.3 doesn't work with dnscrypt-loader · Issue #11 · GortCodex/DNSCrypt-Loader · GitHub](https://github.com/GortCodex/DNSCrypt-Loader/issues/11)  
If you wish to use DNScrypt 1.9.3 and later, use this tutorial: [https://github.com/pi-hole/pi-hole/wiki/DNSCrypt](https://github.com/pi-hole/pi-hole/wiki/DNSCrypt)

* * *

This tutorial is based on Debian 8, results may vary. This tutorial will help you easily set up DNScrypt. Bits and pieces of this tutorial will be pulled from [https://github.com/pi-hole/pi-hole/wiki/DNSCrypt](https://github.com/pi-hole/pi-hole/wiki/DNSCrypt).

##Install packages (from [wiki](https://github.com/pi-hole/pi-hole/wiki/DNSCrypt)):

```
sudo apt-get update
sudo apt-get -y install build-essential tcpdump dnsutils libsodium-dev 
sudo apt-get -y install locate bash-completion libsystemd-dev pkg-config

```

##Building DNScrypt (from [wiki](https://github.com/pi-hole/pi-hole/wiki/DNSCrypt)):

```
mkdir -p dnsproxy
cd dnsproxy
wget https://download.dnscrypt.org/dnscrypt-proxy/dnscrypt-proxy-1.9.1.tar.gz
tar -xf dnscrypt-proxy-1.9.1.tar.gz
ls
cd dnscrypt-proxy-1.9.1
sudo ldconfig
./configure 
make
sudo make install

```

##Installing DNScrypt-Loader  
Assuming we're still working in `~/dnsproxy/`

**Necessary package if not already installed:**

```
apt-get install gawk

```

**Downloading DNScrypt-Loader files** ([GitHub - GortCodex/DNSCrypt-Loader: A flexible and customizable bash script to manage DNSCrypt-proxy](https://github.com/GortCodex/DNSCrypt-Loader))

```
wget https://github.com/GortCodex/DNSCrypt-Loader/archive/v1.2.tar.gz
tar -xf v1.2.tar.gz
cd DNSCrypt-Loader-1.2

```

##Setting Up DNScrypt-Loader

> sudo ./install-loader-debian

After you run the command you will see a prompt, press **OK**.

After that you will come to this screen:

 ![](https://discourse.pi-hole.net/uploads/default/original/3X/1/f/1fc44cb411ed1c5370b683cc2d7fe9ac9a4c6f06.png)

Choose option **1** to Install DNSCrypt-loader

When you see this screen, choose **YES** to continue:

 ![](https://discourse.pi-hole.net/uploads/default/original/3X/2/3/23ba14ab0bea14c9537eaf1df94b3fadd009025d.png)

On successful installation you will see:

 ![](https://discourse.pi-hole.net/uploads/default/original/3X/4/8/486ff18fa7f0f4ce19509b7019bfd4a33317584f.png)

After you click on OK you will be redirected to the main page.

**OPTIONAL STEP** This time, choose option 2 to enable DNSCrypt to automatically start at boot.

When done, you can choose **option 5** to quit or tab to **CANCEL**

##Configuring DNScrypt-Loader for use

> nano /usr/local/sbin/dnscrypt-loader

Change these lines from:

```
cPrimaryIP="127.0.0.1"
cPrimaryPort="5553"

cSecondaryIP="127.0.0.1"
cSecondaryPort="5554"

```

to

```
cPrimaryIP="127.10.10.1"
cPrimaryPort="5553"

cSecondaryIP="127.10.10.2"
cSecondaryPort="5554"

```

or any ip / port you want... When done, **EXIT** and **SAVE**.

##Using DNScrypt-Loader

Launch DNScrypt-Loader using

> sudo dnscrypt-loader

You should see a screen like such:

 ![](https://discourse.pi-hole.net/uploads/default/original/3X/2/1/219271308b53bf3b70c6c5f5309033ef1e633f12.png)

- Your first step should be to choose option 7 to **Update resolver.csv from official source**

- When you're done with that, choose option 1 to Set a Primary DNS resolver. Choose a resolver from the list. You can also set a secondary resolver.

- Use this list to help you choose the best resolver. You should go for the ones that don't keep logs. ([https://github.com/jedisct1/dnscrypt-proxy/blob/master/dnscrypt-resolvers.csv](https://github.com/jedisct1/dnscrypt-proxy/blob/master/dnscrypt-resolvers.csv))

- When you're done, you can choose option 10 to **QUIT** or tab to **CANCEL**

##Change DNSmasq config (from [wiki](https://github.com/pi-hole/pi-hole/wiki/DNSCrypt)):

> sudo nano /etc/dnsmasq.d/02-dnscrypt.conf

add the following:

```
server=127.10.10.1#5553
server=127.10.10.2#5554

```

or whatever ip/port combination you chose to use.

From

> sudo nano /etc/pihole/setupVars.conf

Comment out:

```
#piholeDNS1=...
#piholeDNS2=...

```

From

> sudo nano /etc/dnsmasq.d/01-pihole.conf

Comment out

> `#server=...`

Then

> sudo service dnsmasq restart

##Testing your setup

Use [http://dnsleaktest.com](http://dnsleaktest.com) to ensure you've successfully set up DNScrypt-proxy.

##Upgrading and Uninstalling DNScrypt:

[https://discourse.pi-hole.net/t/setting-up-and-using-dnscrypt-loader/606/5](https://discourse.pi-hole.net/t/setting-up-and-using-dnscrypt-loader/606/5)

---

<div class="post-metadata">

**Author:** ![ajp2k13](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/ajp2k13/32/2115_2.png) [@ajp2k13](https://discourse.pi-hole.net/u/ajp2k13)\
**Post date:** [November 17, 2016, 10:29am UTC](https://discourse.pi-hole.net/t/outdated-setting-up-and-using-dnscrypt-loader/606/2 "2016-11-17T10:29:11Z")

</div>

Seems to be working fine, thanks!

I think 'lsof' command is needed on Raspbian though, should be added under 'install packages' perhaps? I got a 'command not found' sometimes when using dnscrypt-loader menu. Appeared to work anyway though..

Thanks for this, just what I needed... 🙂

---

<div class="post-metadata">

**Author:** ![hupo](https://discourse-cdn.pi-hole.net/letter_avatar_proxy/v4/letter/h/cc9497/32.png) [@hupo](https://discourse.pi-hole.net/u/hupo)\
**Post date:** [November 25, 2016, 9:17pm UTC](https://discourse.pi-hole.net/t/outdated-setting-up-and-using-dnscrypt-loader/606/3 "2016-11-25T21:17:29Z")

</div>

> [@firestorrrm](#):
>
> sudo nano /etc/pihole/setupVars.conf

so when pihole change the setupVars.conf file i have to reedit it again?  
if so, then it would be nice to have customVars that gets merged with setupVars

btw thanks for the tutorial

here is a list of resolvers  
[https://github.com/jedisct1/dnscrypt-proxy/blob/master/dnscrypt-resolvers.csv](https://github.com/jedisct1/dnscrypt-proxy/blob/master/dnscrypt-resolvers.csv)  
so you can check for no logs, dnssec, .. and so on 😛

---

<div class="post-metadata">

**Author:** ![firestorrrm](https://discourse-cdn.pi-hole.net/letter_avatar_proxy/v4/letter/f/edb3f5/32.png) [@firestorrrm](https://discourse.pi-hole.net/u/firestorrrm)\
**Post date:** [November 26, 2016, 12:39am UTC](https://discourse.pi-hole.net/t/outdated-setting-up-and-using-dnscrypt-loader/606/4 "2016-11-26T00:39:14Z")

</div>

Whenever you update pihole, it will read from setupVars and apply the settings to /`etc/dnsmasq.d/01-pihole.conf`.

Anything that's changed in `/etc/dnsmasq.d/01-pihole.conf` will get overwritten with what's in setupVars.

To answer your question, no you won't have to re-edit this file.

EDIT: added resolv list to tutorial, thanks

---

<div class="post-metadata">

**Author:** ![jpgpi250](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/jpgpi250/32/286_2.png) [@jpgpi250](https://discourse.pi-hole.net/u/jpgpi250)\
**Post date:** [January 9, 2017, 6:09pm UTC](https://discourse.pi-hole.net/t/outdated-setting-up-and-using-dnscrypt-loader/606/5 "2017-01-09T18:09:04Z")

</div>

Since dnscrypt is also a very alive project, the version changes regularly. How to update your installation (if you used the installation instructions from firestorrrm) - tested, upgrade from 1.8.1 to 1.9.1:  
assumptions:  
dnscrypt-proxy- **x.x.x**.tar.gz is the **old** version (currently running)  
dnscrypt-proxy- **y.y.y**.tar.gz id the **new** version

- Determine the new version number: check [this](http://download.dnscrypt.org/dnscrypt-proxy) site to determine the last version number, look for the file **dnscrypt-proxy-y.y.y.tar.gz** with the highest version number.
- cd into the dnscrypt folder (if you followed the instructions from firestorrrm):  
cd dnsproxy
- Download the file (you need to do this before making changes, DNS doesn't work during the upgrade):  
`wget http://download.dnscrypt.org/dnscrypt-proxy/dnscrypt-proxy-y.y.y.tar.gz`
- Unpack the new version:  
`tar -xf dnscrypt-proxy-y.y.y.tar.gz`
- Stop dnscrypt-proxy:  
sudo dnscrypt-loader  
select option 8 (Stop DNSCrypt-proxy)  
select option 10 (Quit)
- cd into the **old** version folder (if you used the installation instructions from firestorrrm):  
`cd dnscrypt-proxy-x.x.x`
- uninstall the **old** version  
`sudo make uninstall`
- cd into the **new** version:  
cd ../dnscrypt-proxy-y.y.y
- Install the **new** version:  
`sudo ldconfig`  
`./configure`  
`make`  
`sudo make install`
- Verify the new version number  
`dnscrypt-proxy --version`
- Reboot:  
`sudo reboot`
- Check if everything works, browse to [this](https://dnsleaktest.com/) and select "Standard test", the test should return your configured DNScrypt server

---

<div class="post-metadata">

**Author:** ![firestorrrm](https://discourse-cdn.pi-hole.net/letter_avatar_proxy/v4/letter/f/edb3f5/32.png) [@firestorrrm](https://discourse.pi-hole.net/u/firestorrrm)\
**Post date:** [January 10, 2017, 6:16pm UTC](https://discourse.pi-hole.net/t/outdated-setting-up-and-using-dnscrypt-loader/606/6 "2017-01-10T18:16:52Z")

</div>

Ah thanks for the heads up, I edited the tutorial accordingly.

---

<div class="post-metadata">

**Author:** ![casinelli26](https://discourse-cdn.pi-hole.net/letter_avatar_proxy/v4/letter/c/b3f665/32.png) [@casinelli26](https://discourse.pi-hole.net/u/casinelli26)\
**Post date:** [January 19, 2017, 1:10am UTC](https://discourse.pi-hole.net/t/outdated-setting-up-and-using-dnscrypt-loader/606/7 "2017-01-19T01:10:38Z")

</div>

Hi, I ran into a small problem using this guide and googling the problem did not lead to any answers. After installing the DNS Crypt loader, I am having an issue running sudo dnscrypt-loader. The error message I am getting is that the path to the resolver.csv files on the dns-crypt loader setup differs than the dns-crypt proxy setup. I doubled check the file paths and everything seems to point to the right folder, so I am not sure on how to fix this. Any advice? I can provide more information on my RPi 3 that I am trying to install this on. I just have pi Hole installed and nothing else (except for dnscrypt)

---

<div class="post-metadata">

**Author:** ![jpgpi250](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/jpgpi250/32/286_2.png) [@jpgpi250](https://discourse.pi-hole.net/u/jpgpi250)\
**Post date:** [January 19, 2017, 9:41am UTC](https://discourse.pi-hole.net/t/outdated-setting-up-and-using-dnscrypt-loader/606/8 "2017-01-19T09:41:26Z")

</div>

I just tried to upgrade from v1.9.1 to v1.9.3: **failed**. Something seems to be wrong or changed in this version, I reverted back to v1.9.1 (v1.9.1 works)  
The relevant syslog error messages (failed v1.9.3):  
Jan 19 10:06:06 raspberrypi dnscrypt-loader: The path to resolvers.csv on dnscrypt-loader script  
Jan 19 10:06:06 raspberrypi dnscrypt-loader: differs from dnscrypt-proxy setup  
Jan 19 10:06:06 raspberrypi dnscrypt-loader: Please change dnscrypt-loader 'cCSVBaseDir' and 'cSIGBaseDir' parameters to  
Jan 19 10:06:06 raspberrypi dnscrypt-loader: cCSVBaseDir='/'  
Jan 19 10:06:06 raspberrypi dnscrypt-loader: cSIGBaseDir='/'  
Jan 19 10:06:06 raspberrypi dnscrypt-loader: Edit script at /usr/local/sbin/dnscrypt-loader  
Changing the parameters, as indicated by this message doesn't solve the problem...  
After I reverted back to v1.9.1, I checked if the resolver.csv update still works (option 7 in dnscrypt-loader). The resolver files are updated (location **/usr/local/share/dnscrypt-proxy** ). The path matches the configuration in the (unchanged) dnscrypt-loader configuration file (/usr/local/sbin/dnscrypt-loader)

I've submitted an issue [here](https://github.com/GortCodex/DNSCrypt-Loader/issues/11), hope this is the correct place...

Update: There seems to be a problem. For now, use version 1.9.1 of DNScrypt! Read the comments in the above issue. I will update this thread, as soon as something changes.

Update2: I stopped using DNScrypt-proxy-loader altogether, you can read the alternative I used below (four entries down).

---

<div class="post-metadata">

**Author:** ![casinelli26](https://discourse-cdn.pi-hole.net/letter_avatar_proxy/v4/letter/c/b3f665/32.png) [@casinelli26](https://discourse.pi-hole.net/u/casinelli26)\
**Post date:** [January 19, 2017, 11:54pm UTC](https://discourse.pi-hole.net/t/outdated-setting-up-and-using-dnscrypt-loader/606/10 "2017-01-19T23:54:01Z")

</div>

I wanted to say thank you for leaving this comment. I was able to get DNS Crypt running successfully using v 1.9.1. Before I was trying to use dnscrypt-loader with dnscryp v 1.9.2 and I was running into the same problems you were.

---

<div class="post-metadata">

**Author:** ![hupo](https://discourse-cdn.pi-hole.net/letter_avatar_proxy/v4/letter/h/cc9497/32.png) [@hupo](https://discourse.pi-hole.net/u/hupo)\
**Post date:** [January 29, 2017, 11:07am UTC](https://discourse.pi-hole.net/t/outdated-setting-up-and-using-dnscrypt-loader/606/11 "2017-01-29T11:07:43Z")

</div>

pihole 2.12 has now dnssec i know dnscrypt != dnssec

---

<div class="post-metadata">

**Author:** ![prdtn](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/prdtn/32/510_2.png) [@prdtn](https://discourse.pi-hole.net/u/prdtn)\
**Post date:** [January 29, 2017, 8:14pm UTC](https://discourse.pi-hole.net/t/outdated-setting-up-and-using-dnscrypt-loader/606/12 "2017-01-29T20:14:47Z")

</div>

Yes it has, but dnssec != dnscrypt. For me dnssec isnt interesting but dnscurve is. Sadly dnsmasq does not seem to be capable of supporting it

---

<div class="post-metadata">

**Author:** ![jpgpi250](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/jpgpi250/32/286_2.png) [@jpgpi250](https://discourse.pi-hole.net/u/jpgpi250)\
**Post date:** [January 30, 2017, 11:52am UTC](https://discourse.pi-hole.net/t/outdated-setting-up-and-using-dnscrypt-loader/606/13 "2017-01-30T11:52:56Z")

</div>

I stopped using DNScrypt-proxy-loader altogether, as the development doesn't keep up with the dnscrypt-proxy development. Currently, you cannot use the loader with any version above 1.9.1. I've logged an [issue](https://github.com/GortCodex/DNSCrypt-Loader/issues/11), a couple of weeks ago, but in the mean time v1.9.4 of dnscrypt-proxy has been released, so I was already 3 versions behind...  
Instead I've used this [guide](https://github.com/pi-hole/pi-hole/wiki/DNSCrypt) to configure DNScrypt-proxy directly on the pi (running raspbian jessie lite), with an [upgraded](https://discourse.pi-hole.net/t/running-dnscrypt-and-dnssec/1463/7) dnsmasq (entry of jan 29 - required if you also want to use DNSSEC).  
The setup is a little harder, you really need to keep your mind to it, but I think it's worth the effort, as you lose the dependency of the loader.  
To make life a little easyer, I've published a [rar file](http://users.telenet.be/MySQLplaylist/dnscrypt-proxy-v1.9.4.rar), containing the files you need (IPv4 only). Put all **five dnscrypt-proxy@ files** in **/lib/systemd/system** (just like the instructions indicate) and **04-dnscrypt.conf** in **/ec/dnsmasq.d**. Remove the server settings from other dnsmasq configuration files! These files are for v1.9.4 of DNScrypt proxy, no clue if they will still work with future versions.  
I did change the ports, although a port scan indicates the ports are NOT open to the outside world. I just don't like using ports below 1024, this may interfere with other products using "well known ports".

This configuration works (tested)!

Edit: just read [this](https://discourse.pi-hole.net/t/primary-vs-secondary-dns/1536/9) interesting article. I was also under the assumption the primary resolver would always be used, even though the forward destinations graph on the main page of pihole showed otherwise. For this reason (and my privacy - more resolvers means harder to track), I added to more dnscrypt servers to the rar file (read above) and edited the instructions accordingly.

Edit2: Following the instructions from the [guide](https://github.com/pi-hole/pi-hole/wiki/DNSCrypt), I ran: **sudo systemctl status -l dnscrypt-proxy@\*** and noticed a warning, stating the system (our raspberry pi) doesn't have enough "entropy" to generate random numbers. This [article](https://www.howtoforge.com/helping-the-random-number-generator-to-gain-enough-entropy-with-rng-tools-debian-lenny) provides a solution:

- sudo apt-get install rng-tools
- add **HRNGDEVICE=/dev/urandom** to /etc/default/rng-tools
- reboot the system  
The output of sudo systemctl status -l dnscrypt-proxy@\* will no longer show these warnings.
