我正在尝试设置一个仅转发来自其他 DNS 服务器的请求的基本 DNS 服务器。
我已经安装了 bind9 并按/etc/bind/named.conf.options
如下方式编辑了文件。
options {
directory "/var/cache/bind";
// If there is a firewall between you and nameservers you want
// to talk to, you may need to fix the firewall to allow multiple
// ports to talk. See http://www.kb.cert.org/vuls/id/800113
// If your ISP provided one or more IP addresses for stable
// nameservers, you probably want to use them as forwarders.
// Uncomment the following block, and insert the addresses replacing
// the all-0's placeholder.
forwarders {
8.8.8.8;
};
//========================================================================
// If BIND logs error messages about the root key being expired,
// you will need to update your keys. See https://www.isc.org/bind-keys
//========================================================================
dnssec-validation auto;
auth-nxdomain no; # conform to RFC1035
listen-on-v6 { any; };
};
因此它应该将请求转发到 Google DNS 服务器(很简单,但我打算在以后添加更多内容)。
接下来我进行了编辑/etc/network/interfaces
,将 DNS 服务器添加为环回(127.0.0.1)以进行测试,然后我执行了 asudo service bind9 start
和 asudo ifdown ens33 && sudo ifup ens33
以将其全部启动。
但这似乎不起作用。我执行了 a,dig google.com
但它没有解析来自自身的请求 (127.0.0.1)。
; <<>> DiG 9.10.3-P4-Ubuntu <<>> google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 63300
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4000
;; QUESTION SECTION:
;google.com. IN A
;; ANSWER SECTION:
google.com. 276 IN A 216.58.220.110
;; Query time: 0 msec
;; SERVER: 192.168.0.3#53(192.168.0.3)
;; WHEN: Sun Feb 26 16:43:05 PST 2017
;; MSG SIZE rcvd: 55
我也尝试过通过 Windows 7 机器外部连接到 DNS 服务器,但似乎没有解决任何问题,nslookup
来自 Windows 7 机器的查询给出了以下结果。
nslookup google.com
Server: UnKnown
Address: 192.168.0.188
DNS request timed out.
timeout was 2 seconds.
DNS request timed out.
timeout was 2 seconds.
DNS request timed out.
timeout was 2 seconds.
*** Request to UnKnown timed-out
我已经执行了一个操作sudo service bind9 status
,它告诉我服务处于活动状态,但似乎存在一些解决的问题。
â— bind9.service - BIND Domain Name Server
Loaded: loaded (/lib/systemd/system/bind9.service; enabled; vendor preset: enabled)
Drop-In: /run/systemd/generator/bind9.service.d
└─50-insserv.conf-$named.conf
Active: active (running) since Sun 2017-02-26 16:26:44 PST; 20min ago
Docs: man:named(8)
Process: 1329 ExecStop=/usr/sbin/rndc stop (code=exited, status=0/SUCCESS)
Main PID: 1334 (named)
Tasks: 7 (limit: 512)
CGroup: /system.slice/bind9.service
└─1334 /usr/sbin/named -f -u bind
Feb 26 16:39:24 ubuntu named[1334]: network unreachable resolving '151.in-addr.arpa/DNSKEY/IN': 2001:500:2f::f#53
Feb 26 16:39:24 ubuntu named[1334]: REFUSED unexpected RCODE resolving '151.in-addr.arpa/DNSKEY/IN': 202.12.27.33#53
Feb 26 16:39:24 ubuntu named[1334]: network unreachable resolving '151.in-addr.arpa/DNSKEY/IN': 2001:dc3::35#53
Feb 26 16:39:24 ubuntu named[1334]: REFUSED unexpected RCODE resolving '151.in-addr.arpa/DNSKEY/IN': 192.112.36.4#53
Feb 26 16:39:24 ubuntu named[1334]: REFUSED unexpected RCODE resolving '151.in-addr.arpa/DNSKEY/IN': 192.228.79.201#53
Feb 26 16:39:24 ubuntu named[1334]: network unreachable resolving '151.in-addr.arpa/DNSKEY/IN': 2001:500:84::b#53
Feb 26 16:39:24 ubuntu named[1334]: network unreachable resolving '151.in-addr.arpa/DNSKEY/IN': 2001:500:12::d0d#53
Feb 26 16:39:24 ubuntu named[1334]: REFUSED unexpected RCODE resolving '151.in-addr.arpa/DNSKEY/IN': 198.97.190.53#53
Feb 26 16:39:24 ubuntu named[1334]: network unreachable resolving '151.in-addr.arpa/DNSKEY/IN': 2001:500:1::53#53
Feb 26 16:39:24 ubuntu named[1334]: broken trust chain resolving '69.65.101.151.in-addr.arpa/PTR/IN': 8.8.8.8#53
有人能发现我做错了什么或者指点我下一步应该检查什么吗?