安装软件
关闭防火墙和seliux
配置文件
反向解析文件
$TTL 86400
@ IN SOA 47.168.192.in-addr.arpa. root.wyl.org (
20180511 ; serial
1H ; refresh
15M ; retry
1W ; expire
1D) ; minimum
@ IN NS dns.wyl.org.
128 IN PTR dns.wyl.org. 正确格式如下:
120 IN PTR www.ttxs.org.(错误,域名应该和dns一样) ttxs.wyl.org.
121 IN PTR www.nznd.org.(错误) nznd.wyl.org.
122 IN PTR www.xxhh.org.(错误) xxhh.wyl.org.
正向解析
$TTL 86400
wyl.org. IN SOA dns.wyl.org. root.wyl.org(
20180511 ; serial
1H ; refresh
15M ; retry
1W ; expire
1D) ; minimum
wyl.org. IN NS dns.wyl.org.
dns IN A 192.168.47.128
ttxs IN A 192.168.47.120
nznd IN A 192.168.47.121
xxhh IN A 192.168.47.122
配置文件
options {
directory "/var/named";
};
zone "wyl.org" {
type master;
file "wyl.org";
};
zone "47168.192.in-addr.arpa" {
type master;
file "47.168.192";
};
问题出错:
6月 05 10:35:23 localhost.localdomain bash[10460]: dns_master_load:146.168.192:2: unexpected end of line
6月 05 10:35:23 localhost.localdomain bash[10460]: dns_master_load:146.168.192:1: unexpected end of input
6月 05 10:35:23 localhost.localdomain bash[10460]: 146.168.192:8: usingRFC1035 TTL semantics
6月 05 10:35:23 localhost.localdomain bash[10460]: zone146.168.192.in-addr.arpa/IN: loading from master file 146.168.192 failed:unexpected end of input
6月 05 10:35:23 localhost.localdomain bash[10460]: zone146.168.192.in-addr.arpa/IN: not loaded due to errors.
6月 05 10:35:23 localhost.localdomain bash[10460]:_default/146.168.192.in-addr.arpa/IN: unexpected end of input
6月 05 10:35:23 localhost.localdomain systemd[1]: named.service:control process exited, code=exited status=1
6月 05 10:35:23 localhost.localdomain systemd[1]: Failed to startBerkeley Internet Name Domain (DNS).
6月 05 10:35:23 localhost.localdomain systemd[1]: Unit named.serviceentered failed state.
6月 05 10:35:23 localhost.localdomain systemd[1]: named.service failed.
解决方案:
1. 排查问题
a) 查看权限:ls -la 146.168.192
b) 运行文件,查看文件状态:systemctlrestart named;
systemctl status named.service
或者查看日志:cat /var/log/messages
2. 解决问题
反向解析文件出错:把$符号写成s符号
在客户端配置文件:
测试结果:
客户机测试:
[root@localhost ~]# host nznd.wyl.org
nznd.wyl.org has address 192.168.47.121
[root@localhost ~]# host xxhh.wyl.org
xxhh.wyl.org has address 192.168.47.122
[root@localhost ~]# host ttxs.wyl.org
ttxs.wyl.org has address 192.168.47.129
[root@localhost ~]# host 192.168.47.121
121.47.168.192.in-addr.arpa domain name pointer nznd.wyl.org.
[root@localhost ~]# host 192.168.47.122
122.47.168.192.in-addr.arpa domain name pointer xxhh.wyl.org.
[root@localhost ~]# host 192.168.47.129
129.47.168.192.in-addr.arpa domain name pointer ttxs.wyl.org.
[root@localhost ~]# host 192.168.47.128
128.47.168.192.in-addr.arpa domain name pointer dns.wyl.org.