Ade Malsasa Akbar contact
Senior author, Open Source enthusiast.
Monday, October 7, 2019 at 17:17

 (Ubuntu Bionic connected to the internet via Tor and it's easy to setup)

This simple tutorial will show you to install two privacy tools, The Onion Router (TOR) and Dnscrypt-Proxy, on Ubuntu Bionic Beaver. We will make use of existing Mozilla Firefox browser instead and just configure system wide proxy using Ubuntu System Settings. We do not install Tor Browser or any other additional stuffs to make everything simple for everybody. Okay, let's go!

Subscribe to UbuntuBuzz Telegram Channel to get article updates directly.



Summary


  • 1. Install Them
  • 2. Enable DNSCrypt
  • 3. Test Them
  • 4. Configure Permanently
  • 5. Final Testing
  • Bonus
  • Further Reading

1. Install Tor and DNSCrypt



Two commands below install Tor and dnscrypt-proxy programs into Ubuntu system:

$ sudo apt-get install tor
$ sudo apt-get install dnscrypt-proxy

2. Enable DNSCrypt & Change its Resolver


In a Terminal:
$ sudo systemctl start dnscrypt-proxy.service

Configure it: run command line to edit DNSCrypt configuration > you see there fvz-anyone as resolver > replace it with cisco as resolver > save. Final correct DNSCrypt configuration should look like below.

 (See line with ResolverName code)

3. Test Tor and DNSCrypt


Before configuring them permanently, we need to see if quick install above worked perfectly.

For Tor, run it from command line[1], set Ubuntu to proxy all applications at 127.0.0.1:9050 SOCKS point, and then go to check.torproject.org website. Successful Tor connection will show Bootstrapped 100% done at Terminal and green onion Congratulations at browser. See below.

[1]:
$ tor



 (All pictures above are large enough, simply click one to see it larger)

For DNSCrypt, it works if you get dnscrypt enabled! message to the output of the command line dig @127.0.2.1 txt debug.opendns.com. See below.

(See the white line)

Once both testings worked, you are ready to configure them permanently below.

4. Configure Tor and DNSCrypt Permanently


For Tor, you need to setup it runs every startup. For DNSCrypt, you need to change resolver to 'cisco' and force your system to use 127.0.2.1 instead of 127.0.0.53 resolver point.

Tor setup:
Run Startup Applications from start menu > add Name: Tor > add Command: tor > add Comment: The Onion Router > press OK > see picture below for example.



DNSCrypt setup:

Remove your resolvconf package[1] > remove your original resolv.conf file[2] >  create new resolv.conf file[3] > write it so Ubuntu system will always look at 127.0.2.1 for resolving all DNS connections[4] > save. Final setup should give you /etc/resolv.conf always pointing to 127.0.2.1 point where dnscrypt-proxy working in your Ubuntu system.

[1]:
$ sudo apt-get remove resolvconf 

[2]:
$ sudo rm -fv /etc/resolv.conf

[3]:
$ sudo touch /etc/resolv.conf

[4]:
Write these lines into that new file and save:
nameserver 127.0.2.1
options edns0

Final output will be like this:

To revert back if you dislike the configuration, see official DNSCrypt guide link below.

5. Final Testing


Restart your Ubuntu computer and re-test both Tor and DNSCrypt like above with internet access.

For Tor, go to check.torproject.org and make sure it shows green onion saying Congratulations.

For DNSCrypt, check /etc/resolv.conf[1] and make sure it doesn't change from 127.0.2.1, and run dig command again[2] but this time without @127.0.2.1 anymore.

[1]:
cat /etc/resolv.conf

[2]:
dig txt debug.opendns.com

Result:

(This output means our Ubuntu system is already using 127.0.2.1 as the point of DNS resolving, so we do not need to specify it anymore in dig command)

For DNS leak, see DNS Leak Test website and make sure the resolver appeared is only from OpenDNS LLC because we used cisco resolver above. That means your DNS is not leaked and that's good. But if the DNS resolver shown there is from your Internet Service Provider (ISP), then it is DNS leak, and that's not good.



Do you want latest Tor instead?


For your information, you above installed Tor from universe Ubuntu repository which does not provide latest Tor program. In fact, at the moment, Tor program from universe is still at version 0.3.2.10 while actually latest Tor is already at 0.4.1.6. Do you want latest Tor? If so, read Tor Project guide instead. You can also follow latest version announcements at Tor Blog.


Further Readings



I hope you find this guide useful!


This article is licensed under CC BY-SA 3.0.