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

In my company we have 2 DNS servers: one for the internal hostnames and one for Internet.

I tried to configure both in my Network Manager, who result in having the two DNS server IPs in my /etc/resolv.conf.

If I put as primary DNS server the Internet one, when I try to resolve the name of one internal hostname, it fails, and the resolver doesn't try to found the IP using the secondary DNS server.

In the other hand, if I put the internal DNS as primary, I cannot reach any Internet server from my computer.

Is there a solution to make the resolver to query the seconday DNS when the first one answer with “no such name” or any other DNS lookup error?

share|improve this question
up vote 4 down vote accepted

I guess you can use your own name server (BIND) for resolving:

zone "." IN {
    type forward;
    forward only;
    forwarders {;};

zone "company.lan" IN {
    type forward;
    forward only;
    forwarders {;};
share|improve this answer
Thanks! Probably it will make the trick for now... but what if my company have several domain suffixes? Do I need to define several zones with the same configuration? – JoseLSegura Oct 15 '13 at 16:23
Yes. You need several zone clauses for each domain. – dchirikov Oct 15 '13 at 16:29
Finally I solved the issue using DNSmasq, that I have previously installed for other reason (as a little DHCP+TFTP server for PXE boot). Your help was totally necessary for investigating in the right direction. – JoseLSegura Oct 15 '13 at 23:39
@JoseLSegura How did you configure DNSmasq for that? What are the steps? – Czarek Tomczak Dec 17 '13 at 22:39
@Czarek Tomczak For separate zone dns in DNSmasq you have to add server=/company.lan/ to the /etc/dnsmasq.conf – Alexander Feb 11 '14 at 20:12

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.