我在 Red-hat 7 中重新启动 Named.service 时遇到错误 这是我的实验室状态和所有命令。
在 REDHAT 7 中配置 DNS DNS 名称 p1.linux.com IP 地址 192.168.1.1/24 N/W ID 192.168.1.0/24
[root@p1 Desktop]# hostname
p1.linux.com
# yum -y install bind bind-utils
成功了
配置绑定: 我编辑了以下几行
[root@p1 Desktop]# vim /etc/named.conf
options {
#listen-on port 53 { 127.0.0.1; };
#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 { localhost;192.168.1.0/24; };
allow-transfer { 192.168.1.1; };
zone "linux.com" IN {
type master;
file "fwd.linux.com.db";
allow-update { none; };
};
zone "1.168.192.in-addr.arpa" IN {
type master;
file "1.168.192.db";
allow-update { none; };
};
在 /var/named 目录下创建一个名为 fwd.linux.com.db 的区域文件作为转发区域
# vi /var/named/fwd.linux.com.db
$TTL 86400
@ IN SOA p1.linux.com. root.linux.com. (
2014112511 ;Serial
3600 ;Refresh
1800 ;Retry
604800 ;Expire
86400 ;Minimum TTL
)
;Name Server Information
@ IN NS p1.linux.com.
;IP address of Name Server
primary IN A 192.168.1.1
;Mail exchanger
p1.linux.com. IN MX 10 mail.linux.com.
;A - Record HostName To Ip Address
www IN A 192.168.1.100
mail IN A 192.168.1.150
;CNAME record
ftp IN CNAME www.p1.linux.com.
为反向区域创建一个名为 1.168.192.db 的区域文件
# vi /var/named/1.168.192.db
$TTL 86400
@ IN SOA p1.linux.com. root.linux.com. (
2014112511 ;Serial
3600 ;Refresh
1800 ;Retry
604800 ;Expire
86400 ;Minimum TTL
)
;Name Server Information
@ IN NS p1.linux.com.
;Reverse lookup for Name Server
1 IN PTR p1.linux.com.
;PTR Record IP address to HostName
100 IN PTR www.linux.com.
150 IN PTR mail.linux.com.
现在出现问题
[root@p1 Desktop]# systemctl restart named.service
Job for named.service failed. See 'systemctl status named.service' and 'journalctl -xn' for details.
[root@p1 Desktop]#
这是错误
[root@p1 Desktop]# systemctl status named.service
named.service - Berkeley Internet Name Domain (DNS)
Loaded: loaded (/usr/lib/systemd/system/named.service; enabled)
Active: failed (Result: exit-code) since Wed 2015-03-11 13:25:43 IST; 1min 0s ago
Process: 5283 ExecStartPre=/usr/sbin/named-checkconf -z /etc/named.conf (code=exited, status=1/FAILURE)
Mar 11 13:25:43 p1.linux.com named-checkconf[5283]: _default/linux.com/IN: bad zone
Mar 11 13:25:43 p1.linux.com named-checkconf[5283]: zone 1.168.192.in-addr.arpa/IN: loaded serial 2014112511
Mar 11 13:25:43 p1.linux.com named-checkconf[5283]: zone localhost.localdomain/IN: loaded serial 0
Mar 11 13:25:43 p1.linux.com named-checkconf[5283]: zone localhost/IN: loaded serial 0
Mar 11 13:25:43 p1.linux.com named-checkconf[5283]: zone 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa/IN: ...erial 0
Mar 11 13:25:43 p1.linux.com named-checkconf[5283]: zone 1.0.0.127.in-addr.arpa/IN: loaded serial 0
Mar 11 13:25:43 p1.linux.com named-checkconf[5283]: zone 0.in-addr.arpa/IN: loaded serial 0
Mar 11 13:25:43 p1.linux.com systemd[1]: named.service: control process exited, code=exited status=1
Mar 11 13:25:43 p1.linux.com systemd[1]: Failed to start Berkeley Internet Name Domain (DNS).
Mar 11 13:25:43 p1.linux.com systemd[1]: Unit named.service entered failed state.
Hint: Some lines were ellipsized, use -l to show in full.
[root@p1 Desktop]#
问题是什么,我应该如何解决它,任何人都可以检查一下,谢谢
答案1
linux.com
您在区域中有一条值为 的NS 记录p1.linux.com
,但没有 的 A 记录p1.linux.com
。
primary.linux.com
您的评论有 A 记录名称服务器的IP地址但这是错误的,这样的评论会让你看不到真正的问题。
答案2
您忘记关闭选项节。
options {
#listen-on port 53 { 127.0.0.1; };
#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 { localhost;192.168.1.0/24; };
allow-transfer { 192.168.1.1; };
}; ## This right here. You're missing this.
作为旁注...这不会阻止 bind 启动,但您需要p1.linux.com
.否则 nslookup 将找不到它。