server1. eyuyao.com. GANSU IN A 10.1.1.1
*. eyuyao.com. DEFAULT IN CNAME www.taobao.com
(1)dig server1. eyuyao.com. A +subnet=GANSU:返回A记录10.1.1.1;
(2)dig server1. eyuyao.com. MX +subnet=GANSU:返回SOA+NOERROR;
(3)dig server1. eyuyao.com. A +subnet=OTHER:返回CNAME;
(4)dig server1. eyuyao.com. MX +subnet=OTHER:返回CNAME;
(5)dig other. eyuyao.com. A +subnet=GANSU:返回SOA+NXDOMAIN;
(6)dig other. eyuyao.com. MX +subnet=GANSU:返回SOA+NXDOMAIN;
(7)dig other. eyuyao.com. A +subnet=OTHER:返回CNAME;
(8)dig other. eyuyao.com. MX +subnet=OTHER:返回CNAME;
test.bug.com. default 600 IN A 1.1.1.1
*.bug.com. default 600 IN CNAME www.cname.com.
(1)dig test.bug.com. A:返回A记录1.1.1.1;
(2)dig test.bug.com. MX:返回SOA+NOERROR;
(3)dig other.bug.com. A:返回CNAME;
(4)dig other.bug.com. MX:返回CNAME;
acl "gansu" {
1.1.1.1;
};
acl "hubei" {
2.2.2.2;
};
include "etc/acllist.conf";
key "rndckey" {
algorithm hmac-md5;
secret "QFbp0H8FsqaD+Oct6TYYlg==";
};
controls {
inet 127.0.0.1 port 953
allow { 127.0.0.1; } keys { "rndckey"; };
};
logging {
channel query_log {
file "/home/jie.cj/named/logs/namequery.log" versions 3 size 20m;
severity info;
print-time yes;
print-category yes;
};
category queries {
query_log;
};
channel update_log {
file "/home/jie.cj/named/logs/nameupdate.log" versions 3 size 5m;
severity info;
print-time yes;
print-category yes;
};
category update {
update_log;
};
channel general_log {
file "/home/jie.cj/named/logs/namegeneral.log" versions 3 size 5m;
severity info;
print-time yes;
print-category yes;
};
category general {
general_log;
};
};
options {
recursion no;
directory "/home/jie.cj/named/zones/";
pid-file "named.pid";
};
view "gansu" { #IP 1.1.1.1
match-clients {gansu;};
zone "eyuyao.com" IN {
type master;
file "views/eyuyao.zone.gansu";
allow-update { none; };
};
};
view "default" {
match-clients {any;};
zone "eyuyao.com" IN {
type master;
file "views/eyuyao.zone.default";
allow-update { none; };
};
};
备注:#./sbin/named -gc etc/named-acl.conf -n 10。
server1. eyuyao.com. GANSU IN A 10.1.1.1
*. eyuyao.com. DEFAULT IN CNAME www.taobao.com
(1)dig server1. eyuyao.com. A +subnet=GANSU:返回A记录10.1.1.1;
(2)dig server1. eyuyao.com. MX +subnet=GANSU:返回SOA+NOERROR;
(3)dig server1. eyuyao.com. A +subnet=OTHER:返回CNAME;
(4)dig server1. eyuyao.com. MX +subnet=OTHER:返回CNAME;
(5)dig other. eyuyao.com. A +subnet=GANSU:返回SOA+NXDOMAIN;
(6)dig other. eyuyao.com. MX +subnet=GANSU:返回SOA+NXDOMAIN;
(7)dig other. eyuyao.com. A +subnet=OTHER:返回CNAME;
(8)dig other. eyuyao.com. MX +subnet=OTHER:返回CNAME;
@ IN SOA eyuyao.com. root.eyuyao.com. (
1053891162
3H
15M
1W
1D )
IN NS ns
ns IN A 1.1.1.1
server1 IN A 10.1.1.1
@ IN SOA eyuyao.com. root.eyuyao.com. (
1053891162
3H
15M
1W
1D )
IN NS ns
ns IN A 1.1.1.1
* IN CNAME www.taobao.com.
# dig server1.eyuyao.com +subnet=other
备注:因为bind是view->zone->node->rdata的架构,当subnet=other的时候,进入的是default view。
# dig server1.eyuyao.com MX +subnet=gansu(返回NOERROR)
# dig server1.eyuyao.com MX +subnet=other
备注:因为bind是view->zone->node->rdata的架构,当subnet=other的时候,进入的是default view,当subnet=gansu的时候,由于node存在,MX记录不存在,因此返回SOA+NOERROR。
# dig other.eyuyao.com +subnet=gansu(返回NXDOMAIN)
# dig other.eyuyao.com +subnet=other
备注:因为bind是view->zone->node->rdata的架构,当subnet=other的时候,进入的是default view,当subnet=gansu的时候,由于node不存在,因此返回SOA+NXDOMAIN。
# dig other.eyuyao.com MX +subnet=gansu(返回NXDOMAIN)
# dig other.eyuyao.com MX +subnet=other
备注:因为bind是view->zone->node->rdata的架构,当subnet=other的时候,进入的是default view,当subnet=gansu的时候,由于node不存在,因此返回SOA+NXDOMAIN。
test.bug.com. default 600 IN A 1.1.1.1
*.bug.com. default 600 IN CNAME www.cname.com.
(1)dig test.bug.com. A:返回A记录1.1.1.1;
(2)dig test.bug.com. MX:返回SOA+NOERROR;
(3)dig other.bug.com. A:返回CNAME;
(4)dig other.bug.com. MX:返回CNAME;
view "default" {
match-clients {any;};
zone "bug.com" IN {
type master;
file "bug.zone";
allow-update { none; };
}
};
备注:一旦使用了view语句,所有的zone就必须配置到views中。
@ IN SOA bug.com. root.bug.com. (
1053891162
3H
15M
1W
1D )
@ IN NS dns.bug.com.
dns IN A 1.1.1.1
test IN A 10.2.2.2
* IN CNAME www.taobao.com.
# dig test.bug.com
# dig test.bug.com MX
备注:因为bind是view->zone->node->rdata的架构,当node存在,类型不存在的时候,返回SOA+NOERROR。
# dig other.bug.com A
备注:因为bind是view->zone->node->rdata的架构,当node不存在的时候,查找泛域名。
# dig other.bug.com MX
备注:因为bind是view->zone->node->rdata的架构,当node不存在的时候,查找泛域名。