疑难解答

Minecraft Java SRV与forced hosts搭配

指导srv搭配forced hosts时的问题

使用 SRV 解析时您可能会遇到forced hosts不起作用的问题,例如下面的情况:

设置了 _minecraft._tcp.inside.example.com 0 5 14514 cn-frp-1.qwq.fan的记录,并配置了下面这样的配置文件时:

此处以 Velocity 为例,Bungeecord等配置文件可能略有差异。
[servers]
    # Configure your servers here. Each key represents the server's name, and the value
    # represents the IP address of the server to connect to.
    lobby = "127.0.0.1:25565"
    survival = "127.0.0.1:25566"
    inside = "127.0.0.1:25567"
    # In what order we should try servers when a player logs in or is kicked from a server.
    try = ["lobby"]

[forced-hosts]
    # Configure your forced hosts here.
    "inside.example.com" = ["inside"]

您发现连接到 inside.example.com 时,仍然进入了lobby。

这是一个常见的问题,在 Minecraft 中,客户端处理 SRV 记录时,发送连接到服务器的host name仍然是 cn-frp-1.qwq.fan,这是 Minecraft 的游戏特性

为了让forced-hosts生效,可以使用CNAME记录搭配SRV记录使用,例如配置SRV记录为_minecraft._tcp.inside.example.com 0 5 14514 inside.backend.example.com 并将 inside.backend.example.com 使用 CNAME 记录指向 cn-frp-1.qwq.fan,并配置forced hosts为 "inside.backend.example.com"

此时再连接,forced hosts即会生效。