Полезная информация

DNS & BIND

DNS & BINDSearch this book
Previous: 4.3 Setting Up a BIND Configuration FileChapter 4
Setting Up BIND
Next: 4.5 Host Name Checking (BIND 4.9.4 and Later Versions)
 

4.4 Abbreviations

At this point, we have created all the files necessary for a primary master name server. Let's go back and revisit the DNS database files; there are shortcuts we didn't use. Unless you see and understand the long form first, though, the short form can look very cryptic. Now that you know the long form and have seen the BIND configuration file, we'll show you the shortcuts.

4.4.1 Appending Domains

The second field of a primary (version 4) or zone (version 8) configuration file line specifies a domain name. This domain is the key to the most useful shortcut. This domain is the origin of all the data in the db file. The origin is appended to all names in the db file not ending in a dot. The origin will be different for each db file.

Since the origin is appended to names, instead of entering robocop's address in db.movie as this:

robocop.movie.edu.    IN A     192.249.249.2

we could have entered it like this:

robocop    IN A     192.249.249.2

In the db.192.24.249 file we entered this:

2.249.249.192.in-addr.arpa.  IN PTR robocop.movie.edu.

Since 249.249.192.in-addr.arpa is the origin, we could have entered:

2  IN PTR robocop.movie.edu.

Remember we warned you earlier not to omit the trailing dot when using the long names? Suppose you forgot the trailing dot. An entry like:

robocop.movie.edu    IN A     192.249.249.2

turns into an entry for robocop.movie.edu.movie.edu, and you didn't intend that at all.

4.4.2 @ Notation

If the domain name is the same as the origin, the name can be specified as "@". This is most often seen in the SOA record of the db files. The SOA records could have been entered this way:

@ IN SOA terminator.movie.edu. al.robocop.movie.edu. (
                          1        ; Serial
                          10800    ; Refresh after 3 hours
                          3600     ; Retry after 1 hour
                          604800   ; Expire after 1 week
                          86400 )  ; Minimum TTL of 1 day

4.4.3 Repeat Last Name

If a resource record name (that starts in column one) is a space or tab, then the name from the last resource record is used. You would use this if there were multiple resource records for a name. Here is an example where there are two address records for one name:

wormhole   IN A     192.249.249.1
           IN A     192.253.253.1

In the second address record, the name wormhole is implied. You can use this shortcut even if the resource records are of different types.

4.4.4 The Shortened db Files

Now that we have shown you the abbreviations, we'll repeat the db files, making use of these shortcuts.

Here are the contents of the file db.movie:

;
; Origin added to names not ending
; in a dot: movie.edu
;

@ IN SOA terminator.movie.edu. al.robocop.movie.edu. (
                          1        ; Serial
                          10800    ; Refresh after 3 hours
                          3600     ; Retry after 1 hour
                          604800   ; Expire after 1 week
                          86400 )  ; Minimum TTL of 1 day

;
; Name servers (The name '@' is implied)
;
           IN NS  terminator.movie.edu.
           IN NS  wormhole.movie.edu.

;
; Addresses for the canonical names
;
localhost  IN A     127.0.0.1
robocop    IN A     192.249.249.2
terminator IN A     192.249.249.3
diehard    IN A     192.249.249.4
misery     IN A     192.253.253.2
shining    IN A     192.253.253.3
carrie     IN A     192.253.253.4

wormhole   IN A     192.249.249.1
           IN A     192.253.253.1

;
; Aliases
;
bigt       IN CNAME terminator
dh         IN CNAME diehard
wh         IN CNAME wormhole

;
; Interface specific names
;
wh249      IN A     192.249.249.1
wh253      IN A     192.253.253.1

Here are the contents of the file db.192.249.249:

;
; Origin added to names not ending
; in a dot: 249.249.192.in-addr.arpa
;

@ IN SOA terminator.movie.edu. al.robocop.movie.edu. (
                          1        ; Serial
                          10800    ; Refresh after 3 hours
                          3600     ; Retry after 1 hour
                          604800   ; Expire after 1 week
                          86400 )  ; Minimum TTL of 1 day

;
; Name servers (The name '@' is implied)
;
   IN NS  terminator.movie.edu.
   IN NS  wormhole.movie.edu.

;
; Addresses point to canonical name
;
1  IN PTR wormhole.movie.edu.
2  IN PTR robocop.movie.edu.
3  IN PTR terminator.movie.edu.
4  IN PTR diehard.movie.edu.

Here are the contents of the file db.192.253.253:

;
; Origin added to names not ending
; in a dot: 253.253.192.in-addr.arpa
;

@ IN SOA terminator.movie.edu. al.robocop.movie.edu. (
                          1        ; Serial
                          10800    ; Refresh after 3 hours
                          3600     ; Retry after 1 hour
                          604800   ; Expire after 1 week
                          86400 )  ; Minimum TTL of 1 day

;
; Name servers (The name '@' is implied)
;
   IN NS  terminator.movie.edu.
   IN NS  wormhole.movie.edu.

;
; Addresses point to canonical name
;
1  IN PTR wormhole.movie.edu.
2  IN PTR misery.movie.edu.
3  IN PTR shining.movie.edu.
4  IN PTR carrie.movie.edu.

Here are the contents of the file db.127.0.0:

@ IN SOA terminator.movie.edu. al.robocop.movie.edu. (
                          1        ; Serial
                          10800    ; Refresh after 3 hours
                          3600     ; Retry after 1 hour
                          604800   ; Expire after 1 week
                          86400 )  ; Minimum TTL of 1 day

   IN NS  terminator.movie.edu.
   IN NS  wormhole.movie.edu.

1  IN PTR localhost.

While looking at the new db.movie file, you may notice that we could have removed movie.edu from the host names of the SOA and NS records like this:

@ IN SOA terminator al.robocop (
                          1        ; Serial
                          10800    ; Refresh after 3 hours
                          3600     ; Retry after 1 hour
                          604800   ; Expire after 1 week
                          86400 )  ; Minimum TTL of 1 day

  IN NS  terminator
  IN NS  wormhole

You can't do this in the other db files because their origins are different. In db.movie, we left these names as fully qualified domain names so that the NS and SOA records are exactly the same for all the db files.


Previous: 4.3 Setting Up a BIND Configuration FileDNS & BINDNext: 4.5 Host Name Checking (BIND 4.9.4 and Later Versions)
4.3 Setting Up a BIND Configuration FileBook Index4.5 Host Name Checking (BIND 4.9.4 and Later Versions)