Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I don't know much about networking...but I've been spending a lot of time reading about it.

In my /etc/resolv.conf I have listed 3 nameservers. I understand that the second name namer is used only if the first one has a failure, or times out.

Is there a way for me to get it to use the second one when the first one cannot be resolved?

This is on my Centos workstation. I'm not running a nameserver.

share|improve this question
Just to clarify, you mean /etc/resolv.conf, yes? – Nick Aug 17 '14 at 23:02
@Nick yes - edited the question...thx – hba Aug 18 '14 at 0:48
up vote 4 down vote accepted

Is there a way for me to get it to use the second one when the first one cannot be resolved?

The DNS resolver will only move onto the other name servers if the first one returns an error (i.e SERVFAIL) or can't be reached. If the DNS server returns NXDOMAIN then the resolver considers that the proper answer and won't check the others. NXDOMAIN is considered a final definitive answer that the requested domain does not exist.

If you're asking this because you have a local DNS server that's authoritative for a local domain, then you should set up forwarders on that DNS server so that it can resolve all your domain names for you. You can still list the non-local DNS after that one in resolv.conf as a precaution against failure, but your local DNS has to be first because the other DNS servers returning NXDOMAIN will stop name resolution.

share|improve this answer

Your Answer


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.