Linux-centos7.4-dns II (Build master, slave domain Sync server)

Source: Internet
Author: User
Tags nslookup

Environment: two Linux servers
Home Server IP Address: 192.168.80.10
From server IP address: 192.168.80.20

First step: master server Configuration
[[email protected] ~]# yum install bind//Installation DNS service
[[email protected] ~]# systemctl stop FIREWALLD//Turn off firewall
[[email protected] ~]# Setenforce 0//Turn off SELinux
--------------1. Edit the master configuration file-------------
[Email protected] ~]# vi/etc/named.conf
The contents of the amendment are as follows:
Options {
Listen-on Port 53 {192.168.80.10;}; Change to the IP of your server
Listen-on-v6 Port 53 {:: 1;};
Directory "/var/named";
Dump-file "/var/named/data/cache_dump.db";
Statistics-file "/var/named/data/named_stats.txt";
Memstatistics-file "/var/named/data/named_mem_stats.txt";
allow-query {any;}; Anyone can access
Save exit
[[email protected] named]# named-checkconf//Check syntax error
------------2. Edit the Zone profile--------------
[Email protected] ~]# Vi/etc/named.rfc1912.zones
Forward region, add content last:
Zone "Hello.com" in {
Type master;
File "Hello.com.zone";
allow-update {192.168.80.20;}; Allow configuration files to be updated from the server from the primary server
also-notify {192.168.80.20;}; Note that to configure the from server address
};
Save exit
[[email protected] named]# named-checkconf//Check syntax error
--------3. Edit the Forward zone data profile--------
[Email protected] ~]# cd/var/named
[Email protected] named]# cp-p named.localhost hello.com.zone
[Email protected] named]# VI hello.com.zone
The contents of the amendment are as follows:
$TTL 1D
@ in SOA @ rname.invalid. (
0; Serial
1D; Refresh
1H; Retry
1W; Expire
3H); Minimum
NS @
A 192.168.80.10//This server address
www in A 192.168.80.10//www.hello.com corresponding address
FTP in A 192.168.80.10//ftp.hello.com corresponding address
Save exit
[[email protected] named]# named-checkconf//Check syntax error
------------4. Start the service, verify the--------------
[[email protected] named]# systemctl start named//Start DNS Service
[Email protected] named]# Netstat-anpu | grep named//view DNS service status
Successful display,

[[email protected] named]# nslookup www.hello.com//Resolve domain name
[[email protected] named]# nslookup ftp.hello.com//Resolve domain name
Successful display,

Step Two: Configure from server
-------------1. Preparatory work-------------
[[email protected] ~]# Yum install bind
[[email protected] ~]# systemctl stop FIREWALLD//Turn off firewall
[[email protected] ~]# Setenforce 0//Turn off SELinux
--------------2. Build a DNS server-------------
Edit the master configuration file
[Email protected] ~]# vi/etc/named.conf
The contents of the amendment are as follows:
Options {
Listen-on Port 53 {192.168.80.20;}; IP of the server being monitored
Listen-on-v6 Port 53 {:: 1;};
Directory "/var/named";
Dump-file "/var/named/data/cache_dump.db";
Statistics-file "/var/named/data/named_stats.txt";
Memstatistics-file "/var/named/data/named_mem_stats.txt";
allow-query {any;}; Anyone can access
Save exit
[[email protected] named]# named-checkconf//Check syntax error
Editing a zone configuration file
[Email protected] ~]# Vi/etc/named.rfc1912.zones
Forward zone, and finally add the following
Zone "Hello.com" in {
Type slave;
Masters {192.168.80.10;};
File "Slaves/hello.com.zone";
allow-notify {192.168.80.10;};
};
Save exit
[[email protected] named]# named-checkconf//Check syntax error
No zone data files need to be configured from the server and will be automatically synchronized from the primary server
--------------3. Start the service, verify the-------------
[[email protected] ~]# systemctl start named//Start DNS Service
[Email protected] ~]# Netstat-anpu | grep named//view DNS service status
Successful display,

[[email protected] ~]# cd/var/named/slaves///See if zone files are synchronized
[[email protected] slaves]# ls
Sync successfully,:

[[email protected] ~]# nslookup www.hello.com//Resolve domain name
Successful display,

Step three: Test master, sync from
Modify the configuration-------------the primary server-------------
[Email protected] ~]# Vi/var/named/hello.com.zone
$TTL 1D
@ in SOA @ rname.invalid. (
1; Serial//Modify serial number, must be modified
1D; Refresh
1H; Retry
1W; Expire
3H); Minimum
NS @
A 192.168.80.10
www in A 192.168.80.10
FTP in A 192.168.80.20//Modify FTP address to test
Save exit
[[email protected] named]# named-checkconf//Check syntax error
[[email protected] ~]# systemctl Restart named//Restart DNS service
[[email protected] ~]# nslookup ftp.hello.com//Parse FTP address
Resolved successfully,

---------------authentication from the server----------------
[[email protected] ~]# nslookup ftp.hello.com//Parse FTP address
Synchronized successfully,

Master, from the synchronous construction completed

Linux-centos7.4-dns II (Build master, slave domain Sync server)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.