Example 25.2. localhost
代码: 全选
1|$TTL 3600
2|@ IN SOA strider.diverge.org. root.diverge.org. (
3| 1 ; Serial
4| 8H ; Refresh
5| 2H ; Retry
6| 1W ; Expire
7| 1D) ; Minimum TTL
8| IN NS localhost.
9|localhost. IN A 127.0.0.1
10| IN AAAA ::1
Line by line:
Line 1:
[INDENT]This is the Time To Live for lookups, which defines how long other DNS servers will cache that value before discarding it. This value is generally the same in all the files.
[/INDENT]Line 2:
[INDENT]This line is generally the same in all zone files except root.cache. It defines a so-called "Start Of Authority" (SOA) header, which contains some basic information about a zone. Of specific interest on this line are "strider.diverge.org." and "root.diverge.org." (note the trailing dots!). Obviously one is the name of this server and the other is the contact for this DNS server, in most cases root seems a little ambiguous, it is preferred that a regular email account be used for the contact information, with the "@" replaced by a "." (for example, mine would be "jrf.diverge.org.").
[/INDENT]Line 3:
[INDENT]This line is the serial number identifying the "version" of the zone's data set (file). The serial number should be incremented each time there is a change to the file, the usual format is to either start with a value of "1" and increase it for every change, or use a value of "YYYYMMDDNN" to encode year (YYYY), month (MM), day (DD) and change within one day (NN) in the serial number.
[/INDENT]Line 4:
[INDENT]This is the refresh rate of the server, in this file it is set to once every 8 hours.
[/INDENT]Line 5:
[INDENT]The retry rate.
[/INDENT]Line 6:
[INDENT]Lookup expiry.
[/INDENT]Line 7:
[INDENT]The minimum Time To Live.
[/INDENT]Line 8:
[INDENT]This is the Nameserver line, which uses a "NS" resource record to show that "localhost" is the only DNS server handing out data for this zone (which is "@", which indicates the zone name used in the named.conf file, i.e. "diverge.org") is, well, "localhost".
[/INDENT]Line 9:
[INDENT]This is the localhost entry, which uses an "A" resource record to indicate that the name "localhost" should be resolved into the IP-address 127.0.0.1 for IPv4 queries (which specifically ask for the "A" record).
[/INDENT]Line 10:
[INDENT]This line is the IPv6 entry, which returns ::1 when someone asks for an IPv6-address (by specifically asking for the AAAA record) of "localhost.".
[/INDENT]