我在 Strato 有多个域名。我想设置自己的外部 DNS 来管理我的域名。
为了在 Strato 上执行此操作,我使用了“Domainverwaltung: NS-Records ändern”选项。我必须为此配置提供 2 个名称服务器。系统接受了我的配置。
我在 DEBIAN9 上有一个主(主)BIND9 DNS 和一个辅助(从)BIND9 DNS。
root@server1:/etc/bind# named -v
BIND 9.10.3-P4-Debian <id:ebd72b3>
MASTER 的配置
/etc/bind/named.conf.options
acl trusted {
127.0.0.1;
xxx.xxx.xxx.43; # NS1
xx.xx.xx.107; # NS2
81.169.148.38; # Strato DNS
};
options {
directory "/var/cache/bind";
// If there is a firewall between you and nameservers you want
// to talk to, you may need to fix the firewall to allow multiple
// ports to talk. See http://www.kb.cert.org/vuls/id/800113
// If your ISP provided one or more IP addresses for stable
// nameservers, you probably want to use them as forwarders.
// Uncomment the following block, and insert the addresses replacing
// the all-0's placeholder.
// forwarders {
// 0.0.0.0;
// };
//========================================================================
// If BIND logs error messages about the root key being expired,
// you will need to update your keys. See https://www.isc.org/bind-keys
//========================================================================
dnssec-validation auto;
listen-on port 53 { any; };
recursion no;
allow-query { any; };
auth-nxdomain no; # conform to RFC1035
listen-on-v6 { any; };
allow-notify { trusted; };
allow-transfer { trusted; };
};
/etc/bind/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";
zone "my-domain.com" {
type master;
file "/etc/bind/forward.my-domain.com";
allow-transfer { xx.xx.xx.107; };
};
/etc/bind/forward.my-domain.com
$TTL 604800
@ IN SOA primary.my-domain.com. root.primary.my-domain.com. (
6 ; Serial
604820 ; Refresh
86600 ; Retry
2419600 ; Expire
604600 ) ; Negative Cache TTL
;Name Server Information
@ IN NS primary.my-domain.com.
@ IN NS secondary.my-domain.com.
;IP address of Your Domain Name Server(DNS)
primary IN A xxx.xxx.xxx.43
secondary IN A xx.xx.xx.107
;A Record for Host names
@ IN A xxx.xxx.xxx.43
www IN A xxx.xxx.xxx.43
;CNAME Record
ftp IN CNAME www.my-domain.com.
从站的配置
/etc/bind/named.conf.options
acl trusted {
127.0.0.1;
xxx.xxx.xxx.43; # NS1
xx.xx.xx.107; # NS2
81.169.148.38; # Strato DNS
};
options {
directory "/var/cache/bind";
// If there is a firewall between you and nameservers you want
// to talk to, you may need to fix the firewall to allow multiple
// ports to talk. See http://www.kb.cert.org/vuls/id/800113
// If your ISP provided one or more IP addresses for stable
// nameservers, you probably want to use them as forwarders.
// Uncomment the following block, and insert the addresses replacing
// the all-0's placeholder.
// forwarders {
// 0.0.0.0;
// };
//========================================================================
// If BIND logs error messages about the root key being expired,
// you will need to update your keys. See https://www.isc.org/bind-keys
//========================================================================
dnssec-validation auto;
listen-on port 53 { any; };
recursion no;
allow-query { any; };
auth-nxdomain no; # conform to RFC1035
listen-on-v6 { any; };
allow-notify { trusted; };
allow-transfer { trusted; };
};
/etc/bind/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";
zone "my-domain.com" {
type slave;
file "/etc/bind/forward.my-domain.com";
masters { xxx.xxx.xxx.43; };
};
/etc/bind/forward.my-domain.com
$TTL 604800
@ IN SOA primary.my-domain.com. root.primary.my-domain.com. (
6 ; Serial
604820 ; Refresh
86600 ; Retry
2419600 ; Expire
604600 ) ; Negative Cache TTL
;Name Server Information
@ IN NS primary.my-domain.com.
@ IN NS secondary.my-domain.com.
;IP address of Your Domain Name Server(DNS)
primary IN A xxx.xxx.xxx.43
secondary IN A xx.xx.xx.107
;A Record for Host names
@ IN A xxx.xxx.xxx.43
www IN A xxx.xxx.xxx.43
;CNAME Record
ftp IN CNAME www.my-domain.com.
为了测试这一点我使用了:
挖
~$ dig my-domain.com @xxx.xxx.xxx.43
; <<>> DiG 9.11.3-1ubuntu1.2-Ubuntu <<>> my-domain.com @xxx.xxx.xxx.43
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 31536
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 3
;; WARNING: recursion requested but not available
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;my-domain.com. IN A
;; ANSWER SECTION:
my-domain.com. 604800 IN A xxx.xxx.xxx.43
;; AUTHORITY SECTION:
my-domain.com. 604800 IN NS secondary.my-domain.com.
my-domain.com. 604800 IN NS primary.my-domain.com.
;; ADDITIONAL SECTION:
primary.my-domain.com. 604800 IN A xxx.xxx.xxx.43
secondary.my-domain.com. 604800 IN A xx.xx.xx.107
;; Query time: 16 msec
;; SERVER: xxx.xxx.xxx.43#53(xxx.xxx.xxx.43)
;; WHEN: Tue Oct 16 14:42:09 CEST 2018
;; MSG SIZE rcvd: 136
和 NSLOOKUP:
~$ nslookup my-domain.com xxx.xxx.xxx.43
Server: xxx.xxx.xxx.43
Address: xxx.xxx.xxx.43#53
Name: my-domain.com
Address: xxx.xxx.xxx.43
但是,没有直接指向我的 NS,我的提供商的 NS 正在回答:
挖:
~$ dig my-domain.com
; <<>> DiG 9.11.3-1ubuntu1.2-Ubuntu <<>> my-domain.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 7286
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;my-domain.com. IN A
;; ANSWER SECTION:
my-domain.com. 69 IN A 81.169.145.157
;; Query time: 0 msec
;; SERVER: 127.0.0.53#53(127.0.0.53)
;; WHEN: Tue Oct 16 14:44:23 CEST 2018
;; MSG SIZE rcvd: 58
NS查找:
~$ nslookup my-domain.com
Server: 127.0.0.53
Address: 127.0.0.53#53
Non-authoritative answer:
Name: my-domain.com
Address: 81.169.145.157
Name: my-domain.com
Address: 2a01:238:20a:202:1157::
Strato 表示:“请注意,由于 DNS 的分散结构,这些设置的更改在激活后 24 小时内才会完全生效。”
但即使过了 24 小时,我的检查仍未指向我的 NS-Server。我可以执行任何测试来发现可能的问题吗?
Strato 还指出:(抱歉,自动翻译)原文在这里。
设置记录(仅适用于专用服务器)
如果主名称服务器发生故障,您可以使用辅助名称服务器创建备份。这将确保仍可访问域。主名称服务器和辅助名称服务器是冗余的(通过区域传输,所有与域相关的配置都同步),因此辅助名称服务器可以为域发出正确的 DNS 记录,例如 A 记录、MX 记录等。必须允许 STRATO 辅助名称服务器 81.169.148.38 的 IP 地址进行区域传输。此 IP 地址是静态的,因此将来不需要更改(对于 BIND,例如通过允许传输)。
使用 STRATO 辅助名称服务器时,无需运行两个自己的名称服务器。如果您允许从主名称服务器到 sns.serverkompetenz.de 进行区域传输,它将获取您在主名称服务器上设置的域的 DNS 配置。如果主名称服务器发生故障,域仍然可以访问。
在域区域中,sns.serverkompetenz.de 也必须列为 NS 集中的名称服务器。
答案1
您可以先执行dig +trace my-domain.com.
。这将从 ROOT-SERVERS 名称服务器开始,然后(希望)一直跟踪 NS 委派路径到您自己的名称服务器。确保在每个点返回的 NS 记录都是您希望看到的记录。例如,这是我的域的(已过滤)跟踪的样子:
$ dig +trace guzzijason.com. | grep -E 'IN\s*NS'
. 509129 IN NS b.root-servers.net.
. 509129 IN NS h.root-servers.net.
. 509129 IN NS g.root-servers.net.
. 509129 IN NS i.root-servers.net.
. 509129 IN NS m.root-servers.net.
. 509129 IN NS k.root-servers.net.
. 509129 IN NS f.root-servers.net.
. 509129 IN NS j.root-servers.net.
. 509129 IN NS e.root-servers.net.
. 509129 IN NS c.root-servers.net.
. 509129 IN NS d.root-servers.net.
. 509129 IN NS l.root-servers.net.
. 509129 IN NS a.root-servers.net.
com. 172800 IN NS a.gtld-servers.net.
com. 172800 IN NS b.gtld-servers.net.
com. 172800 IN NS c.gtld-servers.net.
com. 172800 IN NS d.gtld-servers.net.
com. 172800 IN NS e.gtld-servers.net.
com. 172800 IN NS f.gtld-servers.net.
com. 172800 IN NS g.gtld-servers.net.
com. 172800 IN NS h.gtld-servers.net.
com. 172800 IN NS i.gtld-servers.net.
com. 172800 IN NS j.gtld-servers.net.
com. 172800 IN NS k.gtld-servers.net.
com. 172800 IN NS l.gtld-servers.net.
com. 172800 IN NS m.gtld-servers.net.
guzzijason.com. 172800 IN NS ns01.guzzijason.com. # Note: delegation NS record hosted by gtld-servers
guzzijason.com. 172800 IN NS ns02.guzzijason.com. # Note: delegation NS record hosted by gtld-servers
guzzijason.com. 7200 IN NS ns01.guzzijason.com. # authoritative NS record served by guzzijason.com nameservers
guzzijason.com. 7200 IN NS ns02.guzzijason.com. # authoritative NS record served by guzzijason.com nameservers
我还注意到哪些是上游委派记录以及哪些记录是由我的权威名称服务器提供的。
答案2
感谢 guzzijason 分享 dig 的 +trace 选项。
测试自己的名称服务器的另一种选择DENIC->服务->工具->NAST. 这是一项服务德尼克网站。
您可以在此处输入要设置的域名、名称服务器 1、名称服务器 2 以及名称服务器的 IP。在此处查看结果:
这表明我的设置是正确的。所以我可以更深入地研究这个主题。
我的问题是:在我的域名提供商 Strato 的 Web 界面中,我输入了上面提到的根服务器的 IP:xxx.xxx.xxx.43 和 xx.xx.xx.107。
Strato 的正确配置是输入服务器 DNS-HOSTNAME,例如:strato 服务器的“h1234567.stratoserver.net”或 1und1 服务器的“b123123.online-server.cloud”。
也许这会对某些人有帮助......