CentOS DNS domain name parsing of 7

A, DNS Introduction:

Domain Name System (English: Domain Name System, abbreviated: DNS) is an Internet service. It acts as a distributed database of domain names and IP addresses will be mapped each other, it can make it easier to access the Internet. DNS uses TCP and UDP port 53. Currently, for every level domain name length limit is 63 characters, the total length of the domain name can not be more than 253 characters.

Second, the role of DNS and data structures:

CentOS DNS domain name parsing of 7

Three, DNS type:

The different regional geological data source being managed, DNS system can be divided into different types. Common caching name server, primary domain name server as well as from the Domain Name Server.
CentOS DNS domain name parsing of 7
CentOS DNS domain name parsing of 7

Four, BIND Domain Name Service

CentOS DNS domain name parsing of 7
BIND DNS service represents a unique program to provide domain name services, but it is the most widely used, BIND can be run on most Linux / UNIX host.

Fifth, install and configure the DNS service

1, DNS forward resolution

(1)在服务器上使用yum安装执行“yum install bind -y”命令安装BIND软件包。
CentOS DNS domain name parsing of 7
(2)执行“rpm - qc bind”命令查看安装的bind软件包是否完整。
CentOS DNS domain name parsing of 7
(3)执行“vim /etc/named.conf”命令进入到主文件配置。
CentOS DNS domain name parsing of 7
(4)在主文件配置中把原有模板中的IP地址换为本地主机的IP地址,并将权限中的“localhost”换为any,授权所有人访问。
CentOS DNS domain name parsing of 7
(5)然后执行“vim /etc/named.rfc1912.zones”命令进入到区域配置文件。
CentOS DNS domain name parsing of 7
(6)在区域配置文件中,我们可以复制一份模板来改写,将正向区域中的“localhost”换为“kgc.com”,然后改区域数据配置文件为“kgc.com.zone”即可。
CentOS DNS domain name parsing of 7
(7)执行“cd /var/named/”命令进入区域数据配置文件的目录,我们再执行“cp -p named.localhost kgc.com.zone”命令保留原有权限的复制模板文件来修改。
CentOS DNS domain name parsing of 7
(8)执行“vim kgc.com.zone”命令进入到区域数据配置文件。br/>![](https://s1.51cto.com/images/blog/201909/01/8adc7e2e961a7be1971012adbf189734.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
(9)进入区域数据配置文件后,将“@”全部换为“kgc.com.”;
换“rname.invalid”为“admin.kgc.com.”管理员邮箱;在吧ip地址换为本地主机的IP地址;最后把其余内容删除并输入邮箱服务器的主机地址、正向解析条目、别名解析条目以及泛域名解析条目。
CentOS DNS domain name parsing of 7
(10)执行“systemctl stop firewalled.service”关闭防火墙,再执行“setenforce 0”命令关闭增强型安全功能。
CentOS DNS domain name parsing of 7
(11)执行“systemctl start named”命令重启服务,再执行“netstat -nuap”命令查看此服务的UDP 53号端口是否开启。
CentOS DNS domain name parsing of 7
(12)执行“netstat -ntap”查看此服务的TCP 53号端口是否开启。
CentOS DNS domain name parsing of 7
(13)执行“echo “nameserver 192.168.174.155” > /etc/resolv.conf”命令来指定本地主机IP地址为DNS服务器地址。
CentOS DNS domain name parsing of 7
(14)使用host命令来即可获取解析到的IP地址。
CentOS DNS domain name parsing of 7

2、DNS反向解析

(1)在上述正向解析的基础下,我们执行“vim /etc/named.rfc1912.zones”再次进入到区域配置文件中。
CentOS DNS domain name parsing of 7
(2)在区域配置文件在复制反向解析模板,倒过来填写IP地址区域,并指定区域数据配置文件即可。
CentOS DNS domain name parsing of 7
(3)执行“cp -p kgc.com.zone yun.com.loacl”命令保留原有权限的复制模板文件来修改。
CentOS DNS domain name parsing of 7
(4)执行“vim yun.com.local”进入区域数据文件来修改,
将原有的“kgc”券换为yun;删除原有解析条目,输入反向解析条目即可。
CentOS DNS domain name parsing of 7
(5)执行“systemctl start named”命令重启服务。
CentOS DNS domain name parsing of 7
(6)使用host命令即可获取反向解析的域名。
CentOS DNS domain name parsing of 7

3, DNS master-slave synchronization (hot standby)

(1) on another server will close the firewall and security features, and perform the installation using yum "yum install bind -y" command to install BIND package.
CentOS DNS domain name parsing of 7
(2) into the same main configuration file.
CentOS DNS domain name parsing of 7
(3) in the main configuration file with the IP address into the IP address of the second server, and authorize access to everyone.
CentOS DNS domain name parsing of 7
(4) the implementation of "vim /etc/named.rfc1912.zones" into a zone profile.
CentOS DNS domain name parsing of 7
(5) The same copy in the forward area of the configuration file parsing template to modify, replace and specify the type of area from slave download file storage directory, specify the IP address of the master server.
CentOS DNS domain name parsing of 7
(6) and then go to the master zone modified configuration file.
CentOS DNS domain name parsing of 7
(7) arranged in the region of the main server of the file in the "update" replaced "transfer" transmission, and specify the IP address from the server.
CentOS DNS domain name parsing of 7
(8) the implementation of "systemctl start named" command to restart the service to see the synchronized files.
CentOS DNS domain name parsing of 7
(9) the implementation of "echo" nameserver 192.168.174.151 "> /etc/resolv.conf " command to specify the local host IP address of the DNS server address.
CentOS DNS domain name parsing of 7
(10) Finally, using the host command in exchange for the analysis results.
CentOS DNS domain name parsing of 7

Guess you like

Origin blog.51cto.com/14449521/2434498