有人能向我解释一下我做错了什么吗,或者根本做不到。只是为了学习,并了解子域委托的工作原理。
我有 1 个域名,例如:服务器和3 个 VPS 服务器,我想做的是将带有 subdomain.server.com 的自定义名称服务器设置为 VPS 服务器,例如:ns1.vps2.server.com ns2.vps2.server.com托管面板上的用户可以管理 DNS 设置。
域名 server.com 在 1vps vps1.server.com 上的 ns1.server.com ns2.server.com 上运行,一些域名更改为 ns1.server.com 和 ns2.server.com NS 已更改并可运行,可以从 vps1 托管 DNS 区域为它们更改所有 DNS。
对于 VPS2 和 VPS3 我无法使其工作。
我在托管 server.com 域名的 VPS1 上所做的
www.server.com. CNAME server.com.
vps1.server.com. A 1.1.1.1
vps2.server.com. A 2.2.2.2
ns1.server.com. A 1.1.1.1
ns2.server.com. A 1.1.1.2
server.com. NS ns1.server.com.
server.com. NS ns2.server.com.
ns1.vps2.server.com. A 2.2.2.2
ns2.vps2.server.com. A 2.2.2.3
vps2.server.com. NS ns1.vps2.server.com.
vps2.server.com. NS ns2.vps2.server.com.
SUCCESS: Getting information for Domain 'server.com' complete.
^ 但这个配置不起作用 ^
在 ns1.vps2.server.com 上使用 nslookup 时
router.asus.com can't find ns1.vps2.server.com: Server failed
在 server.com 上使用 nslookup 时
server.com nameserver=ns1.server.com
server.com nameserver=ns2.server.com
有人能帮我解决这种情况吗?也许有人会发现我做错了什么。
VPS2 命名.conf
// $Id: named.conf,v 1.1.1.1 2001/10/15 07:44:36 kap Exp $
// -- THE FOLLOWING LINES WERE GENERATED BY PLESK. IF YOU MODIFY THEM, THEY WILL BE OVERWRITTEN WHEN THESE SETTINGS ARE MANAGED IN PLESK UI. --
options {
allow-recursion {
any;
};
listen-on-v6 { any; };
version "none";
directory "/var";
auth-nxdomain no;
pid-file "/var/run/named/named.pid";
};
key "rndc-key" {
algorithm hmac-md5;
secret "20nyv==";
};
controls {
inet 127.0.0.1 port 953
allow { 127.0.0.1; } keys { "rndc-key"; };
};
zone "." {
type hint;
file "named.root";
};
zone "0.0.127.IN-ADDR.ARPA" {
type master;
file "localhost.rev";
};
// -- END OF LINES GENERATED BY PLESK. --
// -- PLEASE ADD YOUR CUSTOM DIRECTIVES BELOW THIS LINE. --
// ...
// -- END OF YOUR CUSTOM DIRECTIVES. --
// -- ALL LINES BELOW WERE GENERATED BY PLESK. IF YOU MODIFY THEM, THEY WILL BE OVERWRITTEN WHEN THESE SETTINGS ARE MANAGED IN PLESK UI. --
zone "vps2.server.com" {
type master;
file "vps2.server.com";
allow-transfer {
common-allow-transfer;
};
};
acl common-allow-transfer {
none;
};
VPS2 命名区域 /var/named/...vps2.server.com
; *** This file is automatically generated by Plesk ***
$TTL 300
@ IN SOA ns1.vps2.server.com. server.server.com. (
2020080553 ; Serial
18000 ; Refresh
3600 ; Retry
604800 ; Expire
10800 ) ; Minimum
vps2.server.com. IN NS ns2.vps2.server.com.
vps2.server.com. IN NS ns1.vps2.server.com.
ns2.vps2.server.com. IN A 1.1.1.2
ipv4.vps2.server.com. IN A 1.1.1.1
mail.vps2.server.com. IN A 1.1.1.1
webmail.vps2.server.com. IN A 1.1.1.1
ns1.vps2.server.com. IN A 1.1.1.1
www.vps2.server.com. IN CNAME vps2.server.com.
ftp.vps2.server.com. IN CNAME vps2.server.com.
vps2.server.com. IN MX 10 mail.vps2.server.com.
vps2.server.com. IN TXT "v=spf1 +a +mx +a:vps2.server.com -all"
_dmarc.vps2.server.com. IN TXT "v=DMARC1; p=none"
_imaps._tcp.vps2.server.com. IN SRV 0 0 993 vps2.server.com.
_pop3s._tcp.vps2.server.com. IN SRV 0 0 995 vps2.server.com.
_smtps._tcp.vps2.server.com. IN SRV 0 0 465 vps2.server.com.
VPS1 命名区域 /var/named/...vps2.server.com
; *** This file is automatically generated by Plesk ***
$TTL 300
@ IN SOA ns1.vps2.server.com. server.server.com. (
2020080576 ; Serial
60 ; Refresh
300 ; Retry
604800 ; Expire
1 ) ; Minimum
vps2.server.com. IN NS ns2.vps2.server.com.
vps2.server.com. IN NS ns1.vps2.server.com.
ns1.vps2.server.com. IN A 1.1.1.1
ns2.vps2.server.com. IN A 1.1.1.2
vps2.server.com. IN A 1.1.1.1
www.vps2.server.com. IN CNAME vps2.server.com.
vps2.server.com. IN MX 10 vps2.server.com.
来自 VPS2 $dig vps2.server.com
root@vps2:~# dig vps2.server.com
; <<>> DiG 9.10.3-P4-Debian <<>> vps2.server.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 29912
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;vps2.server.com. IN A
;; ANSWER SECTION:
vps2.server.com. 299 IN A 1.1.1.1
;; Query time: 28 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Thu Aug 06 07:57:31 EEST 2020
;; MSG SIZE rcvd: 57
来自 VPS1 $dig vps2.server.com
root@vps2:~# dig vps2.server.com
; <<>> DiG 9.10.3-P4-Debian <<>> vps2.server.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 45514
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 3
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;vps2.server.com. IN A
;; ANSWER SECTION:
vps2.server.com. 68 IN A 1.1.1.1
;; AUTHORITY SECTION:
vps2.server.com. 68 IN NS ns1.vps2.server.com.
vps2.server.com. 68 IN NS ns2.vps2.server.com.
;; ADDITIONAL SECTION:
ns1.vps2.server.com. 68 IN A 1.1.1.1
ns2.vps2.server.com. 68 IN A 1.1.1.2
;; Query time: 0 msec
;; SERVER: 80.208.229.143#53(80.208.229.143)
;; WHEN: Thu Aug 06 07:58:59 EEST 2020
;; MSG SIZE rcvd: 125
答案1
问题很可能不在于 vps1 上的区域文件中,而在于 vps2 上的区域文件中。
vps2 上的 Bind 需要配置 的区域文件,vps2.server.com
并在 中拥有适当的块named.conf
。 的 A 记录ns?.vps2.server.com
仅仅是粘合记录。
答案2
解决了。现在一切正常。
问题是我在 server.com 域 DNS 区域添加了 vps2.server.com 记录。
解决方案是,如果有人使用类似 plesk、cpanel、vestacp 等面板...请创建子域,不要在主域(例如 server.com 区域)中创建 DNS 记录。
谢谢你们。