-1

after I have done million researchs, I still no sure if this right or wrong. Please allow me to ask..

I have Bind DNS setup on Linux, and Resolver setup to listen localhost first then others.

I have a domain, example.com , which has amazon name servers.

On Linux, I also have zone file for example.com and its written as

example.com.  86400   IN      NS     < local host name >

When I command

nslookup example.com

It will return

Server:     < local host ip >
Address:    < local host ip >#53

After removed/disabled zone file

It will return correct info

Server:     < amazon ns ip >
Address:    < amazon ns ip >#53

I assume the correct setup is even when the zone file exists, dns can figure it out where is the real name server.

Can you guide me what is wrong, and where I should look into deeper?

Till
  • 99
  • 2
  • 1
    `dns not resolving remote domain when local zone file exist` - This is how DNS works. Nothing to see here. – joeqwerty Sep 29 '17 at 20:46
  • 1
    That's right. Not a bug, a real feature. But it also depends on your local setup for DNS. If you register `8.8.8.8` as the only nameserver, local files will have no impact. BTW: Why is there a zone file laying aroud if you use an external nameserver? An why are they in a place where `bind` can find them? – blafasel Sep 29 '17 at 20:50

1 Answers1

1

The priority that a DNS lookup works is defined in the file /etc/nsswitch.conf

If you search the file you will find out that the line hosts is the following

cat /etc/nsswitch.conf  | grep hosts
hosts:          files dns

So the resolve will first look for an entry in file /etc/hosts and after that will check the DNS. The DNS priority is defined in the file /etc/resolv.conf

So in your /etc/resolv.conf you will probably have public DNS entry.

dkokmadis
  • 546
  • 2
  • 9