
我使用bind9 設定了兩個DNS 伺服器,它們接收來自LAN 上其他PC 的查詢。兩台電腦都有自己的網域,到目前為止,如果主伺服器請求不在其中的網域,我設法使主伺服器將查詢重新導向到備份伺服器。現在,我要做的最後一件事是根據客戶端的 IP 位址回應來自不同伺服器的查詢。
我有兩個包含 LAN 上的 IP 位址的清單:Linux 和 VPCS
我需要讓主 DNS 伺服器回應來自 Linux 的查詢,讓備份伺服器回應來自 VPCS 的查詢。每當我測試它時,我都會查詢主 DNS 伺服器中的網域,無論 PC 位於哪個清單中。我一直在使用視圖,並且成功地過濾了查詢,但我仍然無法將它們重定向到其他伺服器。我還嘗試創建另一個區域,但沒有成功。
主 DNS 伺服器的 IP 位址是 192.168.1.14 。備份 DNS 伺服器的 IP 位址是 192.168.2.3 。我正在使用 2 個 cisco 路由器在 gns3 上模擬整個 LAN,我檢查了它們並且設置正常,所以我懷疑它們是罪魁禍首。
這是我的named.conf.local
//
// Do any local configuration here
//
// Consider adding the 1918 zones here, if they are not used in your
// organization
//include "/etc/bind/zones.rfc1918";
include "/etc/bind/named.conf.options";
view "vpcs"{
match-clients{vpcs;};
forwarders {
192.168.1.14;
192.168.2.3;
};
# forward only;
# recursion yes;
zone"zonaP.gg" in {
type master;
file "/etc/bind/for.zonaP.gg";
masterfile-format text;
};
zone "168.192.in-addr.arpa" in {
type master;
file "/etc/bind/rev.zonaP.gg";
masterfile-format text;
};
};
view "linuxes"{
match-clients{any;};
zone "zonaP.gg" in {
type master;
file "/etc/bind/for.zonaP.gg";
masterfile-format text;
};
zone "168.192.in-addr.arpa" in {
type master;
file "/etc/bind/rev.zonaP.gg";
masterfile-format text;
};
};
這是我的named.conf.options
acl linuxes {
192.168.1.11;
192.168.1.3;
192.168.1.14;
192.168.2.4;
192.168.2.3;
192.168.1.19;
192.168.1.20;
};
acl vpcs {
192.168.1.10;
192.168.1.11;
192.168.1.12;
192.168.1.2;
192.168.1.4;
192.168.1.13;
192.168.1.15;
192.168.2.2;
192.168.3.2;
};
options {
directory "/var/cache/bind";
recursion yes;
allow-query {any;};
allow-query-cache {any;};
forwarders{192.168.2.3;};
dnssec-validation auto;
auth-nxdomain no;
listen-on-v6 { any; };
};