I configured DNS server in Linux as forwarder.
It only forwards DNS queries to main DNS server of organization.

In Windows clients (in branches of organization), Primary DNS is set to their own DNS server,
and alternative is set to mine (forwarder DNS).

If my DNS server is set as alternative, it cannot resolve.
But when my DNS server is set as primary, resolving works.

How can I make my DNS server working when set as alternative DNS?

  • 1
    Linux has several DNS server software packages available; which of them are you using? When your DNS server is set as alternative, are you actually receiving any requests from clients? The clients might be just contacting the primary one. In DNS protocol, "this domain name does not exist" is not an error, but a valid answer, although it might not be an answer the user is happy with.
    – telcoM
    Apr 1, 2020 at 8:29
  • @telcoM, I am using bind. No, I don't receive requests.
    – it dev
    Apr 1, 2020 at 9:25
  • Update question to make it clear. Show us what you have done. Apr 1, 2020 at 9:29
  • That's it then. Your server cannot answer to questions if it's never asked in the first place. If the Windows client first asks the organization's DNS server first and gets a "name does not exist" response, it won't ask for a second opinion from your server - it will be 100% convinced that the name does not exist. In order to the client to fall back to your alternative server, the primary server would have to give a different response, essentially "I don't know" or "Sorry, I can't respond now." That's just how the DNS protocol works.
    – telcoM
    Apr 1, 2020 at 9:34
  • @telcoM, that is it what I am asking. And how to tell to primary server that it has to tell "I don't know, go and ask alternative DNS, maybe it knows" ?
    – it dev
    Apr 2, 2020 at 5:38

1 Answer 1


A basic DNS resolver (like the one in the Windows client) assumes that each DNS server configured for it knows or can find out everything there is to know, and if one server says something does not exist, there will be no point in asking another server for a second opinion.

A DNS server can have more flexibility in where it gets its information from. Many DNS servers can be configured to selectively forward requests: "if a request is about domain X.Y.example, forward the request to server A, if about any other Y.example, forward to server B, else try to resolve it yourself by asking the DNS servers of the internet."

But that is not the normal way to set up DNS resolution.

If the information in the primary DNS server is about domain Y.example and your DNS server has information about subdomain X.Y.example, then the primary DNS server should have so-called glue records in its information on the Y.example domain. Something like:

X.Y.example.            IN NS <your.DNS.server.name.>

and if your DNS server is within the Y.example domain (i.e. part of either the X.Y.example domain, or of the Y.example domain or any of its other subdomains), also:

<your.DNS.server.name.> IN A <your DNS server IP address>

The NS record would tell the primary DNS server to contact your DNS server for any information on the X.Y.example domain. This is known as a DNS delegation. The A record is just to supply the address to connect to: a glue record.

If the information in your nameserver is about an unrelated domain, e.g. Z.other.example, then there are three options:

  • The primary nameserver may have a special relationship with your DNS server so that it can download a complete copy of the Z.other.example domain's contents and automatically keep it up to date by periodically checking with your DNS server. This is usually called a master/slave relationship: your server would be the master authority on Z.other.example, but the primary DNS server would have full knowledge of that domain's contents and would be able to answer authoritatively based on the downloaded data.

With BIND, that means your server would have something like:

options {
    allow-transfer { <IP address of primary DNS server>; };
    # The next line is not absolutely necessary but speeds up propagation of updates:
    also-notify { <IP address of primary DNS server>; }; 
    <... any other options here...>

and the primary server would have:

zone "Z.other.example" { 
    type slave; 
    masters { <IP address of your DNS server>; };

And yes, this means that the organization's primary DNS server would be a slave server for the Z.other.example domain only. For other domains/zones, this would have no effect.

Normally this kind of relationship means the primary DNS server could also be listed in the NS records for the Z.other.example domain, but you don't have to do that if the domain is for the internal use of the users of the primary DNS server only.

  • Or the primary DNS server might be configured to conditionally forward the queries: "if the request is about Z.other.example, forward it to your DNS server instead of doing anything else". This is sometimes done with e.g. organization's internal DNS domains whose existence should not be revealed in any public NS records.

For this, the primary server would need to have:

zone "Z.other.example" { 
    type forward;
    forwarders { <IP of your DNS server>; };
    forward only;
  • Or if there is no special configuration, then a chain of NS records must exist for the DNS servers to find your Z.other.example domain:
    • the root DNS servers must have NS records (and the corresponding A records) pointing out the DNS servers of the example top level domain
    • the example domain servers must have NS records pointing out the DNS servers of the other.example second-level domain
    • and the DNS servers of the other.example domain must have NS records pointing at your DNS server as the responsible for Z.other.example.

With this, the primary DNS server would be able to find your domain, just like any other domain on the internet.

If you are trying to make your DNS server supply just a few additional records to the Y.example domain, that is not going to work.

If a DNS server is authoritative for a particular domain (excluding delegated sub-domains, if any), then it must always have complete knowledge of the contents of that domain; there is no such thing as "maybe" for a DNS server in an authoritative position. If the primary DNS server is the authority for Y.example and when queried about X.Y.example it has no record for that and no matching sub-domain delegation, its "no such host/domain" response will be in human terms:

"I know everything there is to know about Y.example, and there is definitely no such thing as X.Y.example."

It might be technically possible to make the primary server refuse queries for your domain so that the client will ask the alternative DNS server instead, but I would strongly recommend against that.

Such setups may appear to work at first, but tend to fail in unexpected ways, particularly when one or the other of the nameservers becomes temporarily unreachable. Many have tried setups like this, and failed. The learning experience tends to involve a painful troubleshooting session at a time of not your choosing, and/or facepalms from more experienced DNS administrators alerted to help fix the problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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