分页: 1 / 1

《NetBSD指南-25.2.DNS文件》

发表于 : 2010-03-08 1:18
leo
Now let's look at actually setting up a small DNS enabled network. We will continue to use the examples mentioned in Chapter 23, Setting up TCP/IP on NetBSD in practice, i.e. we assume that:
  • Our IP networking is working correctly
  • We have IPNAT working correctly
  • Currently all hosts use the ISP for DNS
Our Name Server will be the “strider” host which also runs IPNAT, and our two clients use "strider" as a gateway. It is not really relevant as to what type of interface is on "strider", but for argument's sake we will say a 56k dial up connection.

So, before going any further, let's look at our /etc/hosts file on "strider" before we have made the alterations to use DNS.

Example 25.1. strider's /etc/hosts file
  • 127.0.0.1 localhost
  • 192.168.1.1 strider
  • 192.168.1.2 samwise sam
  • 192.168.1.3 wormtongue worm

This is not exactly a huge network, but it is worth noting that the same rules apply for larger networks as we discuss in the context of this section.

The other assumption we want to make is that the domain we want to set up is diverge.org, and that the domain is only known on our internal network, and not worldwide. Proper registration of the nameserver's IP address as primary would be needed in addition to a static IP. These are mostly administrative issues which are left out here.

The NetBSD operating system provides a set of config files for you to use for setting up DNS. They are stored in the /etc/namedb directory, I strongly suggest making a backup copy of this directory for reference purposes.

The default directory contains the following files:
  • named.conf
  • localhost
  • 127
  • loopback.v6
  • root.cache
You will see modified versions of these files in this section.
Note
The examples in this chapter refer to BIND major version 8, however, it should be noted that format of the name database and other config files are almost 100% compatible between version. The only difference I noticed was that the “$TTL” information was not required.