$TTL 60
b IN A 192.1.1.1
$TTL 100
a IN A 192.2.2.2
备注:域名不同,则返回的是各自的TTL。
$TTL 60
b IN A 192.1.1.1
$TTL 100
b IN MX 5 mx.taobao.com
备注:域名相同,类型不同,则返回的是各自的TTL。
$TTL 60
b IN A 192.1.1.1
$TTL 100
b IN A 192.2.2.2
与
$TTL 100
b IN A 192.1.1.1
$TTL 60
b IN A 192.2.2.2
备注:域名相同,类型相同,TTL的值为第一条rdata添加时TTL(与添加顺序有关),即上述配置dig A的TTL是不同的。
前提:dig@server某域名某类型,返回的TTL不同;
备注:bind将此zone的类型作为forward,@server作为forwarders,client dig时返回的TTL是最小值,与顺序无关;
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";
};
zone "." IN {
type hint;
file "named.root";
};
zone "test.com" IN {
type master;
file "test.zone";
allow-update { none; };
};
$TTL 200
@ IN SOA test.com. root.test.com. (
1053891162
3H
15M
1W
1D )
@ IN NS dns.test.com.
dns IN A 10.1.1.1
$TTL 60
b IN A 192.1.1.1
$TTL 100
a IN A 192.2.2.2
备注:域名不同,则返回的是各自的TTL。
$TTL 200
@ IN SOA test.com. root.test.com. (
1053891162
3H
15M
1W
1D )
@ IN NS dns.test.com.
dns IN A 10.1.1.1
$TTL 60
b IN A 192.1.1.1
$TTL 100
b IN MX 5 mx.taobao.com
备注:域名相同,类型不同,则返回的是各自的TTL。
$TTL 200
@ IN SOA test.com. root.test.com. (
1053891162
3H
15M
1W
1D )
@ IN NS dns.test.com.
dns IN A 10.1.1.1
$TTL 60
b IN A 192.1.1.1
$TTL 100
b IN A 192.2.2.2
$TTL 200
@ IN SOA test.com. root.test.com. (
1053891162
3H
15M
1W
1D )
@ IN NS dns.test.com.
dns IN A 10.1.1.1
$TTL 100
b IN A 192.1.1.1
$TTL 60
b IN A 192.2.2.2
备注:在相同域名、相同类型的情况下,bind会以第一条记录的TTL为准(即与添加顺序有关),后面新添加的记录不会覆盖之前的TTL。
options {
# recursion no;
directory "/home/jie.cj/named/zones/";
pid-file "named.pid";
};
zone "gds.1699.com" IN {
type forward;
forwarders {1.1.1.1;};
};
备注:forwarder需要将递归选项打开;
(1)dig @1.1.1.1 test-1-115.adns.com.gds.1699.com
(2)dig @bind_ip test-1-115.adns.com.gds.1699.com
备注:猜测bind将TTL值做了处理,即选择最小的TTL。
(3)dig @1.1.1.1 test-1-115.adns.com.gds.1699.com
(4)dig @bind_ip test-1-115.adns.com.gds.1699.com
备注:猜测正确,即bind作为forwarder时,会选取最小的TTL作为统一值。
(5)递归问题
Question:已经有forwarder,为什么还要去递归?(通过抓包,可以看到bind不仅会向forwarder发送查询请求,也会向root去递归)
Answer:
zone "gds.1699.com" IN {
type forward;
forward only; #设置forward only后,只会向1.1.1.1发送查询请求,而不会向root递归
forwarders {1.1.1.1;};
};