您好,我正在尝试遵循此 DNS 服务器设置教程
以下是我希望设置的
win10 | 192.168.1.247
ns1 | 192.168.1.203
薄荷 | 192.168.1.183
域名:nyc3.example.com
我的 named-checkconf 返回正确,但是当我尝试运行 $systemctl start named 时,我无法启动它。
$systemctl status named.service - l
named.service - Berkeley Internet Name Domain (DNS)
Loaded: loaded (/usr/lib/systemd/system/named.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Sun 2023-08-13 00:12:39 EDT; 17s ago
Process: 76083 ExecStartPre=/bin/bash -c if [ ! "$DISABLE_ZONE_CHECKING" == "yes" ]; then /usr/sbin/named-checkconf -z "$NAMEDCONF"; else echo "Checking of zone files is disabled"; fi (code=exited, status=1/FAILURE)
Aug 13 00:12:39 dnsCentOS bash[76083]: _default/0.in-addr.arpa/IN: file not found
Aug 13 00:12:39 dnsCentOS bash[76083]: zone nyc3.example.com/IN: loading from master file etc/named/zones/db.nyc3.example.com failed: file not found
Aug 13 00:12:39 dnsCentOS bash[76083]: zone nyc3.example.com/IN: not loaded due to errors.
Aug 13 00:12:39 dnsCentOS bash[76083]: _default/nyc3.example.com/IN: file not found
Aug 13 00:12:39 dnsCentOS bash[76083]: /etc/named/zones/db.192:1: no TTL specified; using SOA MINTTL instead
Aug 13 00:12:39 dnsCentOS bash[76083]: zone 192.in-addr.arpa/IN: loaded serial 3
Aug 13 00:12:39 dnsCentOS systemd[1]: named.service: control process exited, code=exited status=1
Aug 13 00:12:39 dnsCentOS systemd[1]: Failed to start Berkeley Internet Name Domain (DNS).
Aug 13 00:12:39 dnsCentOS systemd[1]: Unit named.service entered failed state.
Aug 13 00:12:39 dnsCentOS systemd[1]: named.service failed.
这是我的 /etc/named.conf。我尝试更改为其他目录,但似乎不起作用
//
// named.conf
//
// Provided by Red Hat bind package to configure the ISC BIND named(8) DNS
// server as a caching only nameserver (as a localhost DNS resolver only).
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
// See the BIND Administrator's Reference Manual (ARM) for details about the
// configuration located in /usr/share/doc/bind-{version}/Bv9ARM.html
options {
listen-on port 53 { 127.0.0.1; 192.168.1.201; };
# listen-on-v6 port 53 { ::1; };
#directory "/var/named";
directory "/etc/named/zones";
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";
recursing-file "/var/named/data/named.recursing";
secroots-file "/var/named/data/named.secroots";
allow-query { trusted; };
/*
- If you are building an AUTHORITATIVE DNS server, do NOT enable recursion.
- If you are building a RECURSIVE (caching) DNS server, you need to enable
recursion.
- If your recursive DNS server has a public IP address, you MUST enable access
control to limit queries to your legitimate users. Failing to do so will
cause your server to become part of large scale DNS amplification
attacks. Implementing BCP38 within your network would greatly
reduce such attack surface
*/
recursion yes;
dnssec-enable yes;
dnssec-validation yes;
/* Path to ISC DLV key */
bindkeys-file "/etc/named.root.key";
managed-keys-directory "/var/named/dynamic";
pid-file "/run/named/named.pid";
session-keyfile "/run/named/session.key";
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
acl "trusted" {
192.168.1.201; #ns1 ---primary DNS server
192.168.1.247; #win10
192.168.1.183; #mint
};
zone "." IN {
type hint;
file "named.ca";
};
include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";
include "/etc/named.conf.local";
这是我的 /etc/named/named.conf.local
zone "nyc3.example.com" {
type master;
file "/etc/named/zones/db.nyc3.example.com";
};
zone "192.in-addr.arpa" {
type master;
file "/etc/named/zones/db.192";
};
这是我的 /etc/named/zones/db.nyc3.example.com
@ IN SOA ns1.nyc3.example.com. admin.nyc3.example.com. (
3 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
; name servers - NS records
IN NS ns1.nyc3.example.com.
; name servers - A records
ns1.nyc3.example.com. IN A 192.168.1.201
; 192.168.1.0/8 -A records
win10.nyc3.example.com. IN A 192.168.1.247
mint.nyc3.example.com. IN A 192.168.1.183
这是我的 /etc/named/zones/db.192
`@ IN SOA ns1.nyc3.example.com. admin.nyc3.example.com. (
3 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
; name servers - NS records
IN NS ns1.nyc3.example.com.
; PTR records
201.1 IN PTR ns1.nyc3.example.com. ; 192.168.1.201
247.1 IN PTR win10.nyc3.example.com. ; 192.168.1.247
183.1 IN PTR mint.nyc3.example.com. ; 192.168.1.183
谢谢
答案1
我猜测配置文件中的主文件路径有拼写错误。
路径开头缺少斜线
zone nyc3.example.com/IN:从主文件加载 etc/named/zones/db.nyc3.example.com失败:未找到文件