Linux DNS视图脑裂的实例操作(四)
DNS視圖
bind view:
??視圖,腦裂(split-brain)雙線接入。如:電信和聯通雙線接入
??根據客戶端來源的不同,將同一個名稱解析至不同的地址;
???
案例:我們接下來配置內外網雙向解析DNS服務器:同一個名稱解析,分配給不同的IP地址
實驗條件:我們這里為了方便理解操作直接在服務器上添加了兩塊網卡,(實際操作中只要能和DNS服務器能通信即可)實際操作如下!!
我們是講解的方法:方便操作設置以下地址(你懂得。)
??
實例:
主配置:主配置文件主要設置,把根域復制到輔配置文件中,看配置文件即可!!
?#vim /etc/named.conf
options {
?????? //listen-on port 53 { 127.0.0.1; };
?//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; };
//?recursion yes;------------------------主配置這里注釋掉,我們在view單獨指定
?//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";
};
logging {
??????? channel default_debug {
??????????????? file "data/named.run";
??????????????? severity dynamic;
??????? };
};
include "/etc/named.rfc1912.zones";
//include "/etc/named.root.key";
?
輔配置文件:
[root@localhost ~]# vim /etc/named.rfc1912.zones
// named.rfc1912.zones:
//
// Provided by Red Hat caching-nameserver package
//
// ISC BIND named zone configuration for zones recommended by
// RFC 1912 section 4.1 : localhost TLDs and address zones
// and http://www.ietf.org/internet-drafts/draft-ietf-dnsop-default-local-zones-02.txt
// (c)2007 R W Franks
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
view ning {--------------------------------------------------指定分裂區域名字可以自己隨意定義
??????? match-clients { 172.16.3.0/16; 127.0.0.1; };------指定內網來訪問的地址范圍
??????????? recursion yes;--------------------------支持遞歸查詢。
zone "hong.com" IN {------------------指定區域:
??????? type master;
??????? file "hong.com.zone1";--------------指定內網庫文件并要在/var/named/下創建的文件名字
??????? };
zone "." IN {-----------------從/etc/named.conf把根解析復制到/etc/named.rfc1912.zones這里
??????? type hint;
??????? file "named.ca";
};
zone "localhost.localdomain" IN {
??????? type master;
??????? file "named.localhost";
??????? allow-update { none; };
};
zone "localhost" IN {
??????? type master;
??????? file "named.localhost";
??????? allow-update { none; };
};
zone "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" IN {
??????? type master;
??????? file "named.loopback";
??????? allow-update { none; };
};
zone "1.0.0.127.in-addr.arpa" IN {
??????? type master;
??????? file "named.loopback";
??????? allow-update { none; };
};
zone "0.in-addr.arpa" IN {
??????? type master;
??????? file "named.empty";
??????? allow-update { none; };
};
//zone "ning.com." IN {
//????? type master;
//????? file "ning.com.zone";
//????? allow-update { none; };
//};
//zone "3.16.172.in-addr.arpa." IN {
//????? type master;
//????? file "172.16.3.zone";
//};
};
view liang {-------------------------指定分裂區域
??????? match-clients { any; };--------------指定除上面這些庫中,所有的都來這個解析。
??????? recursion no;------------------不支持遞歸查詢(外網訪問)
zone "hong.com" IN {----------指定區域
??????? type master;
??????? file "hong.com.zone2";---------------指定除內網的訪問的解析庫文件名字。
};
};
?
下面我們說下,,庫中的配置:
[root@localhost ~]# vim /var/named/hong.com.zone1
$TTL 3600
$ORIGIN hong.com.
@?????? IN????? SOA???? ns.hong.com ning.qq.com (
??????????????? 20140860
??????????????? 1H
??????????????? 3M
??????????????? 3D
??????????????? 1D )
??????? IN????? NS????? ns
ns????? IN????? A?????? 172.16.3.1
www???? IN????? A?????? 172.16.3.2-----內網解析址
[root@localhost ~]# vim /var/named/hong.com.zone2
$TTL 3600
$ORIGIN hong.com.
@?????? IN????? SOA???? ns.hong.com ning.qq.com (
??????????????? 20140860
??????????????? 1H
??????????????? 3M
??????????????? 3D
??????????????? 1D )
??????? IN????? NS????? ns
ns????? IN????? A?????? 172.16.3.1
www???? IN????? A?????? 192.168.1.2----外網的解析地址
測試:
????#dig -t A www.hong.com @127.0.0.1
在xp中的測試命令:
????
轉載于:https://blog.51cto.com/wodemeng/1536671
新人創作打卡挑戰賽發博客就能抽獎!定制產品紅包拿不停!總結
以上是生活随笔為你收集整理的Linux DNS视图脑裂的实例操作(四)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 当优化扩展到多核时
- 下一篇: BestCoder Round #33