主DNS服务器
1.下载DNS软件:dnf -y install bing-chroot
2.更改配置文件: vim /etc/named.rpeo
改:options {
listen-on port 53 {any;};
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";
secroots-file "/var/named/data/named.secroots";
recursing-file "/var/named/data/named.recursing";
allow-query {any;};
3.更改配置文件: vim /etc/named.rfc1912.zones
进入后,光标定位到第一个,输入555dd,删除全部。输入:
zone "yz.com" IN{
type master;
file "yz.com.zone";
allow-update {none;};
};
zone "23.168.192.in-addr.arpa" IN{
type master;
file "192.168.23.arpa";
allow-update {none;};
};
4.进入/var/named文件夹: cd /var/named
5.查看文件夹: ls
6.将named.locahost 内容复制到 yz.com.zone: cp -a named.locahost yz.com.zone
7.将named.loopback 内容复制到 192.168.20.arpa 中:cp -a named .loopback 192.168.20.arpa
8修改yz.com.zone 文件: vim yz.com.zone
改为:
$TTL 1D
@ IN SOA yz.com. root.yz.com. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS ns.yz.com.
ns IN A 192.168.23.120
www IN A 192.168.23.120
9.修改192.168.20.arpa 文件:vim192.168.23.arpa
改为:
$TTL 1D
@ IN SOA yz.com. root.yz.com. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS ns.yz.com.
ns A 192.168.23.120
120 PTR www.yz.com.
10.编辑网卡:nmtui
进去编辑连接将dns 地址改为192.168.23.120
11.启动网卡连接:nmcli connection up ens33
12.重启服务:systemctl restart named
13.测试域名是否配置成功:ping www.yz.com
14.查询dns服务是否通过防火墙:firewall-cmd --zone=public --query-service=dns --permanent
15.开通防火墙:firewall-cmd --zone=public --add-service=dns --permanent
16.重启防火墙:firewall-cmd --reload
从DNS服务器的配置
1.下载DNS软件:dnf -y install bind-chroot
2.将DNS 加入防火墙:firewall-cmd --zone=public --add-service=dns --permanent
3.重启防火墙:firewall-cmd --reload
4.编辑/etc/named.conf 文件:vim /etc/named.conf
改为:
options {
listen-on port 53 {any;};
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";
secroots-file "/var/named/data/named.secroots";
recursing-file "/var/named/data/named.recursing";
allow-query {any;};
5.编辑/etc/named.rf1912.zones : vim /etc/named.rf1912.zones
进入后,光标定位到第一个,输入555dd,删除全部。输入
zone "yz.com" IN{
type slave;
masters{192.168.23.120}
file "slaves/yz.com.zone";
};
zone "23.168.192.in-addr.arpa" IN{
type slave;
masters{192.168.23.120}
file "slaves/192.168.23.arpa";
};
6.进入主服务器修改配置文件/etc/named.rf1912.zones :vim /etc/named.rf1912.zones
zone "yz.com" IN{
type master;
file "yz.com.zone";
allow-update {192.168.23.129;};
};
zone "23.168.192.in-addr.arpa" IN{
type master;
file "192.168.23.arpa";
allow-update {192.168.23.129;};
};
7.重启主服务器named服务: systemctl restart named
8.重启从服务器named服务: systemctl restart named
9.进入/var/named/slaves 文件: cd /var/named/slaves
10.查看是否有yz.com.zone,192.168.23.arpa 两个文件:ll