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,;

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?

6 Answers 6


Put only 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.

  • Yes, local DNS cache ( and specifically dnsmasq ) did the trick. I'll let myself to expand Your solution below.
    – malloc4k
    Jan 8, 2012 at 13:40
  • I'd like to add that systemd will provide systemd-resolved.service which is a system service that manages network name resolution. It implements a caching DNS stub resolver and an LLMNR resolver and responder. Jan 20, 2015 at 23:05
  • Well, this solution will works with strict order ?
    – TamiL
    Aug 11, 2021 at 13:54

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;

  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


  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.


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.


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


I would suggest to test changes in DNS zones using dig instead of the local resolver. You can specify the DNS server to query using

$ dig @ name.to.resolve

(to send the query to This way you don't need administration control about the host you test this on and you can tune a whole lot of the query details. Also you see more details about the reply.


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

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


[ "$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
  • 3
    If libc doesn't use more than three, this change seems pointless.
    – Mikel
    Apr 4, 2014 at 14:51
  • This suggestion seems worse than pointless - it will hide the fact that there is a problem, but there will still be a problem. Apr 14, 2021 at 4:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .