Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Suppose I work in environment with number of domain changes and slow propagation.
I want to test domain configuration immediately after setting change but the propagation is slow. So I want to add more nameservers to /etc/resolv.conf file in my Debian 6.0.3 laptop. Especially domain name servers of my domain name registrar. I do it by adding:

append domain-name-servers 85.128.130.10, 194.204.152.34;

to my /etc/dhcp/dhclient.conf file. After reconnecting to the network my /etc/resolv.conf is updated properly, but with following message:

# NOTE: the libc resolver may not support more than 3 nameservers.
# The nameservers listed below may not be recognized.

So is there a way to use more than 3 nameservers at the time?

share|improve this question

5 Answers 5

up vote 10 down vote accepted

Put only 127.0.0.1 as a name server in /etc/resolv.conf, and run a DNS cache locally. I recommend Dnsmasq, it's lightweight and easy to setup. On distributions such as Debian and Ubuntu, I also recommend installing the resolvconf package, which takes care of maintaining /etc/resolv.conf when you aren't running a local DNS cache, or of maintaining the DNS cache program's configuration when you are.

share|improve this answer
    
Yes, local DNS cache ( and specifically dnsmasq ) did the trick. I'll let myself to expand Your solution below. –  malloc4k Jan 8 '12 at 13:40

This is how I made Debian use more than 3 nameservers at a time.

  1. Install dnsmasq package

  2. Configure my local DHCP client not to use DNS server addresses provided by DHCP server, but only local server instead. To do so I add in my /etc/dhcp/dhclient.conf file the following line

    supersede domain-name-servers 127.0.0.1;

  3. Configure dnsmasq not to use the default /etc/resolv.conf file, but its own alternative one. In /etc/dnsmasq.conf add the following line

    resolv-file=/etc/resolv.dmasq

  4. Create /etc/resolv.dmasq with as many nameservers as you like.

  5. Restart the dnsmasq service.

I tested it with 9 defined nameservers not containing my domain. The system couldn't resolve its name. When I added the 10th nameserver, the system resolved its name correctly.

share|improve this answer

From resolv.conf:

Up to MAXNS (currently 3) name servers may be listed, one per line. If there are multiple servers, the resolver library queries them in the order listed. If no nameserver entries are present, the default is to use the name server on the local machine. (The algorithm used is to try a name server, and if the query times out, try the next, until out of name servers, then repeat trying all name servers until a maximum number of retries are performed.)

Once all the nameservers are tried, and the query fails the default is to return the host not found message.

Can you repeat the same line below in the conf file so that multiple nameserver directives are added. Each line of nameserver directive supports upto 3 DNS addresses (per line).

Please note that only one host is ever tried, and that is on the top of the list in resolv.conf; if the address is not found on the first server or the server is not reachable, and only then the second is tried and then continues for the third server if the query on the second server fails. There is no round-robin or random selection of nameservers from resolv.conf during the host resolution, so the cost of trying all the nameservers will be directly taxing on the performance of underlying systems/applications.

However, I think you better implement a local caching nameserver , the increase in DNS performance for applications using/depending on the host resolution would increase if the number of dns calls are reduced/depends on the latency as well.

Another approach would be to use openDNS servers, they have perhaps the most updated and also fast serving DNS servers on the internet.

share|improve this answer

Another answer. I am not sure if this would be relevant on Debian but this is lately more an conventional (& fashionable) approach to be found on almost all latest distribution releases.

Use Networking profiles. The idea is to switch to the network settings in a differring network environments either dynamically or use user inputs, while still maintain the copies of the configuration files and settings for all the other networks which may not be active at the time.

http://www.linuxhowtos.org/Tips%20and%20Tricks/switchingnetwork.htm http://www.linuxhomenetworking.com/forums/showthread.php/15822-Configure-multiple-network-profiles http://wiki.debian.org/NetworkManager

share|improve this answer

Edit /etc/resolvconf/update.d/libc the following line

[ "$N" = 3 ] && return 0

To

[ "$N" = 4 ] && return 0

You can now insert 4 nameservers in /etc/network/interfaces, insert the line in your interface

dns-nameservers x.x.x.x y.y.y.y a.a.a.a b.b.b.b
share|improve this answer
1  
If libc doesn't use more than three, this change seems pointless. –  Mikel Apr 4 at 14:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.