我只想在我的本地配置DNS服务器 我配置了/etc/named.conf
options {
listen-on port 53 {
127.0.0.1; 192.168.220.135;
};
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.220.0/24;
};
allow-transfer{
localhost; 192.168.220.136;
};
recursion yes;
dnssec-enable yes;
dnssec-validation yes;
dnssec-lookaside auto;
/* Path to ISC DLV key */
bindkeys-file "/etc/named.iscdlv.key";
managed-keys-directory "/var/named/dynamic";
also-notify {
};
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
zone "." IN {
type hint;
file "named.ca";
};
zone "ayoub.local" IN {
type master;
file "direct.zone";
#allow-update {none;};
};
zone "220.168.192.in-addr.arpa" IN {
type master;
file "inverse.zone";
#allow-update {none;};};
include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";
和/var/named/direct.zone
**$TTL 3H
@ IN SOA MasterDNS.ayoub.local. root.ayoub.local. (
20160421 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minim
@ IN NS MasterDNS.ayoub.local.
@ IN NS SlaveDNS.ayoub.local.
@ IN A 192.168.220.135
@ IN A 192.168.220.136
@ IN A 192.168.220.137
MasterDNS IN A 192.168.220.135
SlaveDNS IN A 192.168.220.136
Client IN A 192.168.220.137
和/var/named/inverse.zone
$TTL 3H
@ IN SOA MasterDNS.ayoub.local. root.ayoub.local. (
20160418 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
@ IN NS MasterDNS.ayoub.local.
@ IN NS SlaveDNS.ayoub.local.
@ IN PTR ayoub.local.
MasterDNS IN A 192.168.220.135
SlaveDNS IN A 192.168.220.136
Client IN A 192.168.220.137
135 IN PTR MasterDNS.ayoub.local.
136 IN PTR SlaveDNS.ayoub.local.
137 IN PTR Client1.ayoub.local.
和/etc/resolv.conf
domain ayoub.local
search ayoub.local
nameserver 127.0.0.1
nameserver 192.168.220.136
当我用nslookup测试域名时
;; Got SERVFAIL reply from 127.0.0.1, trying next server
;; connection timed out; trying next origin
;; Got SERVFAIL reply from 127.0.0.1, trying next server
;; connection timed out; no servers could be reached
当我用
设置/etc/resolv.conf时search localdomain
nameserver 192.168.220.2
我看到了nslookup的纪念结果
Server: 192.168.220.2
Address: 192.168.220.2#53
** server can't find ayoub.local: NXDOMAIN
答案 0 :(得分:0)
我解决了这个问题 我只是忘了将direct.zone和inverse.zone的groupe从root更改为named,命令是: chgroup名为/var/named/direct.zone 并强制resolv不通过DHCP更改: chattr + i /etc/resolv.conf
答案 1 :(得分:0)
有时由于名称服务器127.0.0.1而发生错误 因此,在resolve.conf中使用以下或您喜欢的任何其他名称服务器。这是我的resolve.conf文件
nameserver 8.8.8.8
nameserver 1.1.1.1