| Lesson 5 || Preparing the zone files |
| Objective || Create and position your zone files. |
Preparing Zone Files
As you prepare your zone files, remember that each zone must have an (SOA) State of Authority record.
Also, remember that forward and reverse zones each need name servers, and so their zone files must have NS records.
Naming your zone file
You can name your zone file anything you want. For example, you could name the forward zone file forward.zone, and name the reverse zone file reverse.zone, or any other name you see fit. Some administrators include the name of the domain or company this file serves.
For example, if you were in a company named Security Inc., you could name the forward zone file security.forward.zone.
The examples below use corp.zone for the forward file, and rev.zone for the reverse file.
Root cache and loopback files
You must also provide cache and loopback files. You can name these anything you like, although named.ca and named.local are usual names for each respective file. You need not create or configure the root cache file. You can obtain the latest root cache file from the InterNIC FTP site.
See the course Resources page for the link to this site. Below is the code for a sample loopback file:
@ IN SOA localhost. root.localhost. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS localhost.
1 IN PTR localhost.
Tips for creating your zone files
As you create your zone files, remember to do two things:
Use periods properly.
Fully qualified domain names must end with a period. Any key in a DNS record that is not fully qualified will have the value of
$ORIGIN added to the end of it. For example, you will have to include periods after
responsible.party entries in the SOA record. Notice the loopback file example given above. It has periods after
root.localhost, as well as the IN entries. Improper period placement is the primary reason for rejected DNS zone records.
- In general, if a zone file line begins with white space, then the first field from the previous line will be copied into the first field of the current line. Remember not to omit this white space.
Placing your zone files
Once you have prepared your zone files, you need to place them in the /var/named directory on the primary server host.
DNS clients do not need to create zone files, nor do they need to have named running.
They only need to have the primary and secondary name servers listed in the /etc/resolv.conf file.
CNAME and MX records
Remember that in addition to A and NS records, you can also add CNAME and MX records.
CNAME allows you to supply an alternative name to a system already within the DNS structure. For example, consider that a system named server1.corporation.com may be your primary Web server. However, it is standard for people to refer to Web server machines as www. To solve this problem, you would not need to rename the system in DNS.
All you need to do is add a CNAME entry that allows users to refer to this machine as www (assuming that
$ORIGIN is correctly set):
www IN CNAME server1.corporation.com.
An MX record, on the other hand, allows you to use DNS to denote a mail exchanger.
As you will see in the next module,
sendmail is highly dependent upon DNS. When the
sendmail daemon is told to forward a message outside of a local system, it will consult the DNS zone files for MX records. We will discuss this in the next module.
Now let us get started on a DNS configuration. The steps are very similar on Linux and Solaris.
Prepare Zone Files