实验设备
主服务器:OpenElur Linux IP地址为192.168.188.129
从服务器:RedHat Linux IP地址为192.168.188.128
实验步骤
1.进行主服务器的基础配置
#安装DNS对应工具
[root@OpenElurRJW ~]# yum install bind -y
#编辑DNS系统配置信息
[root@OpenElurRJW ~]# cat /etc/named.conf
options {
listen-on port 53 { 192.168.188.129; };
directory "/var/named";
allow-query {any;};
allow-transfer {192.168.188.128; };
};
zone "RRR.com" IN {
type master;
file "RRR";
};
zone "188.168.192.in-addr.arpa" IN {
type master;
file "192";
};
2.配置主服务器的解析配置文件
#编辑正向解析配置文件
[root@OpenElurRJW ~]# cat /var/named/RRR
$TTL 1D
@ IN SOA @ admin.RRR.com. ( 2024011700 1D 1H 3H 1D)
IN NS dns.RRR.com.
dns IN A 192.168.188.129
www IN A 192.168.188.129
ftp IN A 192.168.188.129
a IN A 192.168.188.129
aaa IN CNAME a
#编辑反向解析配置文件
[root@OpenElurRJW ~]# cat /var/named/192
$TTL 1D
@ IN SOA @ admin.RRR.com. ( 2024011701 1D 1H 3H 1D )
IN NS dns.RRR.com.
129 IN PTR dns.RRR.com.
129 IN PTR www.RRR.com.
#重启服务
[root@localhost ~]# systemct restart named
3.进行从服务器的基础配置 文章来源:https://www.toymoban.com/news/detail-802408.html
#安装DNS对应工具
[root@RedHatRJW ~]# yum install bind -y
#编辑DNS系统配置文件
[root@RedHatRJW ~]# cat /etc/named.conf
options {
listen-on port 53 { 192.168.188.129; };
directory "/var/named";
};
zone "RRR.com" IN {
type slave;
file "slaves/named.RRR.com";
masters { 192.168.188.129 ; };
};
zone "188.168.129.in-addr.arpa" IN {
type slave;
file "slaves/named.192.coom";
masters { 192.168.188.129 ;};
};
#重启服务
[root@localhost ~]# systemct restart named
4.实验结果检验文章来源地址https://www.toymoban.com/news/detail-802408.html
[root@RedHatRJW ~]# nslookup
> server 192.168.188.129
Default server: 192.168.188.129
Address: 192.168.188.129#53
> 192.168.188.129
129.188.168.192.in-addr.arpa name = dns.RRR.com.
129.188.168.192.in-addr.arpa name = www.RRR.com.
> www.RRR.com
Server: 192.168.188.129
Address: 192.168.188.129#53
Name: www.RRR.com
Address: 192.168.188.129
到了这里,关于linux配置DNS主从服务器的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!