Resolve DNS through Tor

tor_compIn our earlier article on running Tor + Privoxy on Ubuntu we explored ways to enable Tor to route all browser requests through it. In case you are not routing all your network traffic through Tor, you can still use Tor DNS to resolve your IP address look-ups.

For most cases it’s your ISP which proves you a DNS name resolver. However, that also means that the ISP has your digital fingerprints, i.e., exactly where you are roaming on the interent. To bypass that, you can use open DNS servers like that of Google and OpenDNS. However, Tor provides better anonymity even in this respect.

Run the following steps to enable Tor DNS on Ubuntu:

  • Install dnsmasq:
    $ sudo apt-get install dnsmasq
  • Add the following line in /etc/tor/torrc:
    DNSPort 9053
  • Add the following in /etc/dnsmasq.conf:
    no-resolv
    server=127.0.0.1#9053
    listen-address=127.0.0.1
  • Restart both the services:
    $ sudo service tor restart
    $ sudo service dnsmasq restart
  • Go to NetworkManager applet ▸ Edit Connections… ▸ Select your connection ▸ Edit… ▸ IPv4 Settings ▸ DNS Server field and add 127.0.0.1.
  • Disable and enable networking from NetworkManager applet.

To make sure the new DNS configuration is in effect, run:

$ nslookup www.google.com

One thought on “Resolve DNS through Tor”

Leave a Reply

Your email address will not be published. Required fields are marked *