我有一个具有root权限的虚拟服务器。 此外,我有一个指向该服务器( *.example.com
)的域。
我想有一个指向我的家庭服务器(可通过home.dyndns.org
访问)的子域( home.dyndns.org
),所以我可以通过test.example.com
与我的虚拟服务器不同的IP地址访问我的家庭服务器test.example.com
。 为此,我通常会添加子域test.example.com
并在提供程序的DNS区域设置中设置CNAME别名。
但是,我无法编辑DNS区域设置,因为我的提供商不提供DNS区域设置。 我的提供者告诉我要在我的虚拟服务器上设置一个DNS服务器。 所以我安装了dnsmasq
并添加到/etc/dnsmasq.conf
:
cname=test.example.com,home.dyndns.org
我在服务器上的/etc/resolv.conf
如下所示:
nameserver 127.0.0.1 # local dnsmasq nameserver 208.67.222.222 # OpenDNS nameserver 208.67.220.220 # OpenDNS
但是,当我尝试ping test.example.com
,IP地址被parsing到虚拟服务器而不是我的主服务器。 我错过了什么吗? 提前致谢!
编辑: $ cat /etc/hosts 127.0.0.1 localhost.localdomain localhost [IPv4 of VPS] vmanager2515.xxxxxx.de vmanager2515 ::ffff:[IP of VPS] vmanager2515.xxxxxx.de 2001:[IPv6] vmanager2515.xxxxxx.de
$ dig test.example.com @127.0.0.1 ;; ANSWER SECTION: test.example.com. 83303 IN A [IP of VPS]
$ dig test.example.com @127.0.0.1 ;; ANSWER SECTION: test.example.com. 83303 IN A [IP of VPS]