Managing DNS zones and records is an important aspect of maintaining a DNS server. A DNS zone is a collection of related DNS records that are stored on a DNS server. These records contain information such as IP addresses, mail servers, and other data that is used to resolve domain names to the resources they represent.
In this documentation, we will cover the process of creating and managing DNS zones and records on a DNS server running the BIND (Berkeley Internet Name Domain) software.
Step 1: Creating a DNS Zone
To create a new DNS zone, you will need to add a new “zone” statement to the BIND configuration file (named.conf). This file is usually located in the /etc/bind/ directory on Linux and in the C:\Program Files (x86)\ISC BIND 9\etc\ directory on Windows.
Here is an example of a “zone” statement that creates a new zone for the domain example.com:
zone "example.com" {
type master;
file "/etc/bind/db.example.com";
};
The “zone” statement contains the following options:
- type: Specifies the type of zone. In this case, it is a master zone, which means that the DNS server is the primary source of information for this zone.
- file: Specifies the location of the zone file, which contains all the DNS records for this zone.
Once you have added the “zone” statement to the named.conf file, you will need to create the zone file specified in the “file” option.
Step 2: Adding DNS Records
Once you have created a DNS zone, you can begin adding DNS records to it. The most common types of DNS records are:
- A (Address) record: Maps a domain name to an IP address.
- MX (Mail exchange) record: Maps a domain name to one or more mail servers.
- CNAME (Canonical name) record: Maps a domain name to another domain name.
- NS (Name server) record: Specifies the name servers for a domain name.
Here is an example of a basic zone file with some DNS records:
$TTL 86400
@ IN SOA ns1.example.com. admin.example.com. (
2020101000 ; serial
3600 ; refresh
1800 ; retry
604800 ; expire
86400 ) ; minimum
@ IN NS ns1.example.com.
@ IN NS ns2.example.com.
@ IN A 192.0.2.1
www IN A 192.0.2.1
mail IN A 192.0.2.1
@ IN MX 10 mail.example.com.
This zone file contains the following records:
- SOA (Start of Authority) record: Specifies the name of the primary DNS server for the zone, as well as other information such as the zone’s serial number and refresh interval.
- NS (Name Server) record: Specifies the name servers for the zone.
- A (Address) record: Maps the domain names “example.com”, “www.example.com“, and “mail.example.com” to the IP address 192.0.2.1.
- MX (Mail exchange) record: