In the previous article on the detailed introduction of DNS, this time we talk about the configuration of the DNS server.
In the abc.com domain, in the 172.16.13.0/24 network segment
We have a simple plan:
NS server: 172.16.13.1 www server: 172.16.13.1,172.16.13.3 mail server: 172.16.13.2; FTP Server is the alias of the WWW server.
Configure the master-slave server so that data synchronization is achieved.
ip:172.16.13.2 from server (two virtual machines)
Complete the process:
Configuration on the primary server:
First, install the BIND software package (we are using the Redhat 5 and BIND97 packages)
1, configuration good yum source
2, delete the Redhat automatically installed bind93 two packages--> bind-libs, bind-utils
# rpm-e Bind-libs bind-utils
3, install BIND97 main package and its child package
# yum Install bind97-libs bind97-utils
# yum Install Bind97-y
Second, configure the BIND97 main configuration file:/etc/named.conf
1. Delete or rename the official main configuration file that was generated when the installation
# MV/ETC/NAMED.CONF/ETC/NAMED.CONF.1
2, create a new configuration file, in which to edit their own required functionality
# vim/etc/named.conf
Options {directory "/var/named"; # defines the stored directory allow-recursion {172.16.0.0/16;};
# define the network segment to be recursive; Zone "." {type hint; # region type file ' named.ca ';
# zone data File};
Zone "localhost" {type master;
File "Named.localhost"; Allow-transfer {none;};
# do not allow zone transfer};
Zone "0.0.127.in-addr.arpa" {type master;
File "Named.loopback"; Allow-transfer {172.16.13.2;};
# A secondary zone allowed to be transferred};
Zone "abc.com" {type master;
File "Abc.com.zone";
Allow-transfer {172.16.13.2;};
};
Zone "13.16.172.in-addr.arpa" {type master;
File "172.16.13.zone";
Allow-transfer {172.16.13.2;};
};
Key "Rndc-key" {#见下边注释 algorithm hmac-md5;
Secret "7oj+gsf3hcyyaq9dbprwvw==";
}; Controls {inet 127.0.0.1 port 953 allow {127.0.0.1;} keys {"Rndc-key";
}; };
Note: Implement RNDC (DNS remote Control tool) to control DNS servers on the local computer
1. Generate Key configuration file
# Rndc-confgen >/etc/rndc.conf
2. Copy the second half of the annotation in the configuration file into the/etc/named.conf file and remove the annotation character
3. Restart Network Services
4, the executable rndc-h command to display all the commands.
Third, the configuration area file:/var/named/
Create and configure two positive and Negative Zone files resolved in the main configuration file Abc.com.zone and 172.16.13.zone
# Vim/var/named/abc.com.zone
$TTL
@ in SOA ns1.abc.com. Admin.abc.com (
2013040103
1H
5M
1D
6H) # SOA record, @ referencing the zone name in NS defined in the main configuration file NS1 #主服务器的ns, ns1 (space defaults to the same domain name as above) in NS ns2 # from server ns,ns2 in MX Mail # NS records for mail servers, mail
ns1 in a 172.16.13.1 # NS records corresponding to a records
ns2 in a 172.16.13.2
Mail in a 172.16.13.2
www in a 172.16.13.1 # www. A records
www . 172.16.13.3
ftp in CNAME www # www ftp alias
*. ABC.com. in a 172.16.13.4 # abc.com. Domain, except for a records of all hosts defined above
# Vim/var/named/172.16.13.zone
$TTL
@ in SOA ns1.abc.com. Admin.abc.com (
2013040501
1H
5M
1D
6H) # SOA record, @ referencing the zone name in NS defined in the main configuration file Ns1.abc.com.
In NS ns2.abc.com. # NS Reverse Parse
1 in PTR ns1.abc.com for slave server. # The IP address is 172.16.13.1 pointer ptr record
2 in ptr ns2.abc.com.
1 in PTR www.abc.com.
2 in PTR mail.abc.com.
3 in PTR www.abc.com.