Add a DNS globally (to all ifaces)

2

I want to add an nameserver to be used on all connections. The DNS that I'm adding, opennic, will be giving responses for domains that my standard DNS will say don't exist. (.bit). I've added the nameservers to /etc/resolvconf/resolv.conf.d/tail and the resulting resolv.conf contains the nameservers, as one would expect, but they are at the tail of the file and don't work. If I edit /etc/resolv.conf to have the opennic servers first, I can successfully nslookup a .bit website. When they aren't first, I get a response of ** server can't find [domainname].bit: NXDOMAIN. I presume that once the resolver gets this response, it quits there and doesn't test other subsequent nameservers. Is there a way to change this behavior?

Also, for a variety of reasons, I don't want to switch to opennic alone for my DNS. I still want the DNS received from DHCP to have precedence. And only fall back on opennic if the standard DNS doesn't work.

Tyler

Posted 2014-11-20T18:14:59.493

Reputation: 123

Answers

4

What you are trying to do isn't really something that the built-in resolver libraries were designed to handle. (ie use a set of DNS servers only for a specific sub-domain). The built in resolver only skips to another server when communication with the server fails, not when the server reports that a record doesn't exist.

A way to handle this might be to install the dnsmasq package and let it run as a local resolver. By default it will read in your configuration for resolvconf to set the default forwarders. Then you can add configuration like this below that will send all lookups for the .bit tld to opennic.

#/etc/dnsmasq.d/blt_tld
server=/bit/109.69.8.34
server=/bit/185.16.40.143

Zoredache

Posted 2014-11-20T18:14:59.493

Reputation: 18 453