TL;DR:
域的 DNS 解析必须映射到 IP:port(s)
,而不仅仅是 IP
。
例子,sub1.example.com
🡲 192.0.2.4:4567
sub2.example.com
🡲 192.0.2.4:5678
我可以修改 DNS 记录。
我拥有“Arboristal.com”域。我还在 arboristal.com 上私下拥有所有子域。例如 lg.arboristal 或 ft.arboristal.com。
在我的 DNS 设置下,Arboristal.com 设置为访问我们当前托管我们网站的网络主机。
我家有三台服务器运行在一个公共(public) IP 地址下。 (71.82.237.27)
我还有 Arboristal.com 的三个子域指向我的 IP 地址。
三台服务器中的每台都在各自的端口上运行(25565、25566、25567)
我希望每个子域都指向我的 IP 地址上的每个开放端口。
不幸的是,当您尝试使用其中一个子域连接到其中一台服务器时,它只会连接到您为其键入端口的服务器。
我的情况:
三台服务器,每台运行在不同的端口上。 (所有端口转发并作为服务器工作)
我的 DNS 提供商 (webs.com) 上运行了三个子域
当您使用 Minecraft 连接到其中一个时,它会通过端口 25565 自动连接,这意味着无论您尝试连接什么 URL,它始终会使用端口 25565 访问我的 IP。将您连接到 Minecraft 服务器一。您可以手动输入端口,但我宁愿让它尽可能美观和专业。
那么,既然你知道了我的情况,有什么方法可以让 mc.arboristal.com、tekkit.arboristal.com 和 pvp.arboristal.com 都在不同的端口下访问我的 IP 地址,而无需指定每个端口在提供的 URL 中连接到用户端?
我可以将 MX、A(使用此连接到服务器)、CNAME 和 TXT 记录添加到 DNS 设置
如果我需要使用第三方作为我的 DNS 提供商,我还可以将名称服务器添加到 DNS 设置中。 (如有必要我愿意做)
如果需要在 192.168.0.1 上配置任何内容,我还可以完全访问我的路由器。
我只是在上周才了解互联网的真正运作方式,所以我不确定这里是否真的有任何可能。我也可能没有关于互联网实际运作方式的正确信息。请原谅我可能假设的有关互联网的任何虚假信息。
最佳答案
您可以使用SRV records :
_service._proto.name. TTL class SRV priority weight port target.
Service: the symbolic name of the desired service.
Proto: the transport protocol of the desired service; this is usually either TCP or UDP.
Name: the domain name for which this record is valid, ending in a dot.
TTL: standard DNS time to live field.
Class: standard DNS class field (this is always IN).
Priority: the priority of the target host, lower value means more preferred.
Weight: A relative weight for records with the same priority.
Port: the TCP or UDP port on which the service is to be found.
Target: the canonical hostname of the machine providing the service, ending in a dot.
例子:
_sip._tcp.example.com. 86400 IN SRV 0 5 5060 sipserver.example.com.
所以我认为你正在寻找的是在你的 DNS hosts file 中添加这样的东西。 :_minecraft._tcp.arboristal.com. 86400 IN SRV 10 40 25565 mc.arboristal.com.
_minecraft._tcp.arboristal.com. 86400 IN SRV 10 30 25566 tekkit.arboristal.com.
_minecraft._tcp.arboristal.com. 86400 IN SRV 10 30 25567 pvp.arboristal.com.
(Minecraft 支持 SRV 记录,从 1.3.1 开始,服务名称为 minecraft
)附带说明一下,我强烈建议您与托管公司合作,而不是自己托管服务器。它只是要求您的家庭连接(DDoS 和带宽/连接速度)出现问题,但这取决于您。
关于networking - 如何将DNS重定向到不同的端口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19015138/