问题

在客户端输入了正确的密码rcon_password 123456后,使用rcon xxxx时显示Unable to connect to remote server

环境/提示

1.服务器可以供客户端正常进行游戏,服务端可以正常使用指令

2.csgo dedicated server已升级到最新版

3.防火墙已放通此端口

4.经过测试,此次问题与域名无关

5.正常情况下,若仅为密码错误问题,会提示Bad RCON password,与本问题不同

原因

默认情况下,csgo专用服务器监听27015端口,udp用于进行游戏,tcp用于客户端的rcon.而rcon默认监听127.0.0.1:27015,外界无法直接访问建立连接

解决方法

参考Valve的启动参数文档(适用于起源引擎游戏)

https://developer.valvesoftware.com/wiki/Command_Line_Options

-ip Specifies the address to use for the bind(2) syscall, which controls on which IP addresses the program is reachable on. It must either be a local address (an addresses of the host it runs on) or 0.0.0.0 (the wildcard). This has nothing to do with externally-visible addresses in NAT setups.

大概意思是指定哪些IP地址可以触及服务器程序。

游戏服务器启动参数中指定-ip 0.0.0.0后问题解决。

吐槽

国内百度找不到任何有用的信息,谷歌也没有找到对问题的具体分析解决方案,只能盲目测试。

V社这个文档写的真乱

最后找了一会才找到V社的官方文档,但第一时间没有找到具体原因,看了一会就关了

What is ipname?

在页面的下方才找到,原来有专门的Source Dedicated Server Command-line parameters.

这边写的倒是比较清楚了,找到了对-ip的详细解释。

插曲

跟朋友试了一下用nginx转发端口以尝试让监听127.0.0.1:27015 udp和tcp 的程序转发至0.0.0.0:27016以让外部连接,最后没有成功


I am a noob