我想在局域网上设置自己的 DNS。我设法进行正向查找,但由于某种未知原因,反向查找不起作用。
下载bind9
apt-get install bind9
/etc/bind/named.conf.options
options {
directory "/var/cache/bind";
forwarders {
// Google Public DNS
8.8.8.8; // Use for Primary <-- modified
// 8.8.4.4; // Use for Secondary
};
//========================================================================
// 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;
listen-on-v6 { any; };
listen-on { 10.10.222.171; }; // <-- modified
};
添加 1 个正向 1 个反向区域
/etc/bind/named.conf.local
zone "kotylu.dev" {
type master;
file "/etc/bind/db.kotylu.dev";
};
zone "222.10.10.in-addr.arpa" {
type master;
file "/etc/bind/db.10";
};
db.kotylu.dev
;
; BIND data file for kotylu.dev
;
$TTL 604800
@ IN SOA kotylu.dev. root.kotylu.dev. (
16 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS kotylu.dev.
@ IN A 10.10.222.171
@ IN AAAA ::1
gw IN A 10.10.222.1
desktop IN A 10.10.222.201
tablet IN A 10.10.222.202
/etc/bind/db.10
;
; BIND reverse data file for 222.10.10
;
$TTL 604800
@ IN SOA kotylu.dev. root.kotylu.dev. (
22 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS kotylu.dev.
171 IN PTR kotylu.dev.
1 IN PTR gw.kotylu.dev.
201 IN PTR desktop.kotylu.dev.
202 IN PTR tablet.kotylu.dev.
跑步nslookup gw.kotylu.dev
:
Server: UnKnown
Address: fd33:330f:8aa::1
Non-authoritative answer:
Name: gw.kotylu.dev
Address: 10.10.222.1
跑步nslookup 10.10.222.1
:
Server: UnKnown
Address: fd33:330f:8aa::1
*** UnKnown can't find 10.10.222.1: Non-existent domain
Address: 10.10.222.1