描述
amazondns 插件的行为是使用 Amazon DNS Server 作为后端的权威名称服务器。
Amazon DNS 服务器用于解析您在 Route 53 私有托管区域中指定的 DNS 域名。然而,该服务器充当缓存名称服务器。虽然 CoreDNS 具有 proxy 插件,我们可以将 Amazon DNS 服务器配置为后端,但它不能成为权威名称服务器。在我的情况下,需要权威名称服务器来处理子域的委托职责。这就是我创建此插件的原因。
语法
amazondns ZONE [ADDRESS] {
soa RR
ns RR
nsa RR
}
- ZONE 此插件的区域范围。
- ADDRESS 特别定义 Amazon DNS 服务器地址。如果没有 ADDRESS 条目,此插件将使用 实例元数据 自动解析。
- soa RR 采用 RFC 1035 样式的 SOA 记录。
- ns RR 采用 RFC 1035 样式的 NS 记录。
- nsa RR 采用 RFC 1035 样式的 NS 的 A 记录。IP 地址将是运行此插件的 CoreDNS 所在的 EC2 实例的私有 IP 地址。注意:您需要在 VPC 中的 EC2 实例上启动 CoreDNS,因为我们无法从 VPC 外部访问 Amazon DNS 服务器。
示例
使用两个名称服务器(ns1.sub.example.org
和 ns2.sub.example.org
)为 sub.example.org
创建权威名称服务器。
. {
amazondns sub.example.org {
soa "sub.example.org 3600 IN SOA ns1.sub.example.org hostmaster.sub.example.org (2018030619 3600 1200 1209600 900)"
ns "sub.example.org 3600 IN NS ns1.sub.example.org"
ns "sub.example.org 3600 IN NS ns2.sub.example.org"
nsa "ns1.sub.example.org 3600 IN A 192.168.0.10"
nsa "ns2.sub.example.org 3600 IN A 192.168.0.130"
}
}