What is the diff between resolv.conf and named.conf forwarders?

9,709

It's hard to answer clearly as I don't know what you're trying to accomplish:

  • Do you want to manage a private DNS zone using your own BIND server?
  • Do you just want to get DNS resolution working properly?
  • Are you trying to set up a local cache for performance reasons?

If you're going to run a local DNS resolver on your server, you would point /etc/resolv.conf to your local BIND server (127.0.0.1) and let BIND resolve starting from the root nameservers, like any other nameserver. No "forwarders" entries needed in your named.conf. Strictly speaking, you would be ever-so-slightly decreasing the load on the root nameservers by leaving the "forwarders" entries in place.

If you're just trying to get DNS resolution working on your box but don't need to run a DNS server yourself, then don't worry about named.conf and just point /etc/resolv.conf at your ISP's DNS servers.

EDIT:

It occurs to me I didn't answer the question in your title.

  • /etc/resolv.conf is the file used by the resolver libraries on your computer (part of libc) that are used by every single program to request DNS lookups. When your web browser wants to do a DNS lookup, it calls gethostbyname('www.blah.com') (or one of its derivatives). That function does a ton of stuff, among which is reading /etc/resolv.conf and using that to figure out which DNS server it can ask to perform the lookup for it.

  • /etc/named.conf is used by BIND. Normally when you make a request to BIND, it checks its local cache and, if it doesn't have the anser, it asks one of the root nameservers. The root servers "delegate" to (usually) a GTLD or country-level server. Those servers will then delegate to the owner of the domain. Usually it stops there, but sometimes there is one or two more levels of delegation for sub-subdomains. This adds up to 3 - 5 queries to get the answer. The answer is then added to the local cache and handed back to the requesting client. If you specify a "forwarder", BIND just makes a single request to one of the listed hosts (usually your ISP's DNS servers) and lets them do all the heavy work. It gets a reply back to its single query and hands the reply back to the client.

Share:
9,709

Related videos on Youtube

storm
Author by

storm

Updated on September 17, 2022

Comments

  • storm
    storm over 1 year

    As I have been troubleshooting the DNS creation process in Ubuntu I have noticed that the following files appear redundant:

    etc/bind/named.conf.options (or a section of named.conf depending on how your files are set up)

    forwarders {
          1.2.3.4;
          5.6.7.8;
          9.10.11.12;
    };
    

    etc/resolv.conf

    domain example.com
    nameserver 1.2.3.4
    nameserver 5.6.7.8
    nameserver 9.10.11.12
    

    Generally when such an observation is made I find that I'm doing something incorrectly, so correct me if I'm wrong. It seems that named.conf likes to have the machines net ip and resolv.conf should have 127.0.0.1. That aside, they should have the ip's of my isp's dns's, which would be the same. Thanks for the help.

  • storm
    storm over 14 years
    Great answer. Thank you. In response to your question, I am trying to run a local DNS server. I however am having problems resolving my ISP's DNS. It seems likely that the problem is related to these files.
  • Return_Of_The_Archons
    Return_Of_The_Archons over 14 years
    Can you clarify what you mean by "problems resolving my ISP's DNS"? What are you doing, what response do you expect, and what happens instead?
  • storm
    storm over 14 years
    I am trying to host a site and run my own DNS for said site. I can not call the site by its name via the command line using digs or pings, however the IP works. I realized that I needed a needed to give a bit more detail so I moved the question to this post: serverfault.com/questions/87650/…. If you could help me with that info I would greatly appreciate it. Thanks for the help thus far.