• 欢迎加入MineBBS QQ讨论群:点击查看所有的官方讨论群
  • 我们将于近期对服务器进行迁移,服务可能中断至多2日。请各位安排好自己的访问计划,造成不便敬请谅解!
  • MineBBS入站考试已经上线!想要成为【正式会员】解锁更多功能吗?快来参与吧!【点我去看】

问题 用云服务器架设内网穿透后,用velocity代理服务器有玩家进服会爆ping

huangxi

【Lv:2】

正式会员
注册
2024/09/16
消息
6
金粒
931.00金粒
问题详情:我使用的是阿里云云服务器,架设内网穿透到自己家庭服务器中,家庭服务器位于广州(服务器配置足够,家庭宽带下行100M,上行50M),家庭服务器运行vc、大厅、生存以及资源世界,公网IP经过解析,玩家使用域名进入服务器,日活5-8人。
服务器偶尔会5-10人稳定,但偶尔时间段在生存世界进入玩家会瞬间爆ping(从人均50达到2000-4000),然后有概率将玩家从生存转去大厅。
本人尝试过:
1.尝试更换云服务器,从云服务器带宽100换为目前的200M
2.使用与家庭服务器同一网络的服主不再上线
3.尝试将vc直接放在云服务器端,大厅、生存、资源仍在家庭服务器中
云服务器情况
1755425875978.webp
1755426532824.webp
爆ping截图:
1755426075804.webp
当前配置:
vc端放在云服务器中,大厅、生存、资源世界在家里服务器,阿里云服务器配置:2 核 vCPU|4 GB 内存|50 GB ESSD|200 Mbps 限峰值带宽|BGP 公网线路类型|1 IPv4 固定公网地址.
vc日志
vc配置
# Config version. Do not change this
config-version = "2.7"

# What port should the proxy be bound to? By default, we'll bind to all addresses on port 25565.
bind = "0.0.0.0:40010"

# What should be the MOTD? This gets displayed when the player adds your server to
# their server list. Only MiniMessage format is accepted.
motd = "<#09add3>A Velocity Server"

# What should we display for the maximum number of players? (Velocity does not support a cap
# on the number of players online.)
show-max-players = 50

# Should we authenticate players with Mojang? By default, this is on.
online-mode = false

# Should the proxy enforce the new public key security standard? By default, this is on.
force-key-authentication = false

# If client's ISP/AS sent from this proxy is different from the one from Mojang's
# authentication server, the player is kicked. This disallows some VPN and proxy
# connections but is a weak form of protection.
prevent-client-proxy-connections = false

# Should we forward IP addresses and other data to backend servers?
# Available options:
# - "none": No forwarding will be done. All players will appear to be connecting
# from the proxy and will have offline-mode UUIDs.
# - "legacy": Forward player IPs and UUIDs in a BungeeCord-compatible format. Use this
# if you run servers using Minecraft 1.12 or lower.
# - "bungeeguard": Forward player IPs and UUIDs in a format supported by the BungeeGuard
# plugin. Use this if you run servers using Minecraft 1.12 or lower, and are
# unable to implement network level firewalling (on a shared host).
# - "modern": Forward player IPs and UUIDs as part of the login process using
# Velocity's native forwarding. Only applicable for Minecraft 1.13 or higher.
player-info-forwarding-mode = "modern"

# If you are using modern or BungeeGuard IP forwarding, configure a file that contains a unique secret here.
# The file is expected to be UTF-8 encoded and not empty.
forwarding-secret-file = "forwarding.secret"

# Announce whether or not your server supports Forge. If you run a modded server, we
# suggest turning this on.
#
# If your network runs one modpack consistently, consider using ping-passthrough = "mods"
# instead for a nicer display in the server list.
announce-forge = true

# If enabled (default is false) and the proxy is in online mode, Velocity will kick
# any existing player who is online if a duplicate connection attempt is made.
kick-existing-players = false

# Should Velocity pass server list ping requests to a backend server?
# Available options:
# - "disabled": No pass-through will be done. The velocity.toml and server-icon.png
# will determine the initial server list ping response.
# - "mods": Passes only the mod list from your backend server into the response.
# The first server in your try list (or forced host) with a mod list will be
# used. If no backend servers can be contacted, Velocity won't display any
# mod information.
# - "description": Uses the description and mod list from the backend server. The first
# server in the try (or forced host) list that responds is used for the
# description and mod list.
# - "all": Uses the backend server's response as the proxy response. The Velocity
# configuration is used if no servers could be contacted.
ping-passthrough = "all"

# If not enabled (default is true) player IP addresses will be replaced by <ip address withheld> in logs
enable-player-address-logging = true

[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:101"
sc = "127.0.0.1:102"
zy = "127.0.0.1:103"

# 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.
"lobby.example.com" = [
"lobby"
]
"factions.example.com" = [
"sc"
]
"minigames.example.com" = [
"zy"
]

[advanced]
# How large a Minecraft packet has to be before we compress it. Setting this to zero will
# compress all packets, and setting it to -1 will disable compression entirely.
compression-threshold = 256

# How much compression should be done (from 0-9). The default is -1, which uses the
# default level of 6.
compression-level = -1

# How fast (in milliseconds) are clients allowed to connect after the last connection? By
# default, this is three seconds. Disable this by setting this to 0.
login-ratelimit = 3000

# Specify a custom timeout for connection timeouts here. The default is five seconds.
connection-timeout = 5000

# Specify a read timeout for connections here. The default is 30 seconds.
read-timeout = 30000

# Enables compatibility with HAProxy's PROXY protocol. If you don't know what this is for, then
# don't enable it.
haproxy-protocol =false

# Enables TCP fast open support on the proxy. Requires the proxy to run on Linux.
tcp-fast-open = false

# Enables BungeeCord plugin messaging channel support on Velocity.
bungee-plugin-message-channel = true

# Shows ping requests to the proxy from clients.
show-ping-requests = false

# By default, Velocity will attempt to gracefully handle situations where the user unexpectedly
# loses connection to the server without an explicit disconnect message by attempting to fall the
# user back, except in the case of read timeouts. BungeeCord will disconnect the user instead. You
# can disable this setting to use the BungeeCord behavior.
failover-on-unexpected-server-disconnect = true

# Declares the proxy commands to 1.13+ clients.
announce-proxy-commands = true

# Enables the logging of commands
log-command-executions = false

# Enables logging of player connections when connecting to the proxy, switching servers
# and disconnecting from the proxy.
log-player-connections = true

# Allows players transferred from other hosts via the
# Transfer packet (Minecraft 1.20.5) to be received.
accepts-transfers = false

[query]
# Whether to enable responding to GameSpy 4 query responses or not.
enabled = true

# If query is enabled, on what port should the query protocol listen on?
port = 40010

# This is the map name that is reported to the query services.
map = "Velocity"

# Whether plugins should be shown in query response by default or not
show-plugins = false
 
领取红包用户
焦焦 77IN Nyarlath
轻量应用服务器是峰值带宽,不是独立带宽,在高峰期的时候绝对会卡爆,不过我那台轻量服问题还不大,跑Frp内网穿透还可以
轻量服就看你脸了,我估计是千兆带宽共享给十机台机器,如果你的邻居服务器放来吃灰,那你就不卡。相反,你的邻居一直跑满带宽,你肯定卡
 
阿里云好像有3天无理由退款的,你可以租几台试一下,哪台不卡就留下哪台,把剩下的退掉,也是要看运气
 
主要问题可能就出在内网穿透上。你想啊,数据包得先跑到内网穿透服务商那边再转一圈回来,多绕了一步,延迟自然就高了,说不定还会丢包,那 ping 值不就忽高忽低,也就是“爆 ping”嘛。
而且你看日志里写的,sc 服务器老是超时,Velocity 跟它连不上,玩家肯定就掉线或者卡得要死。你得去 sc 服务器的日志里看看是不是它自己挂了或者太卡了。顺便也检查下 Velocity 配置文件里的 tcp-proxy-timeout 这些时间设置,是不是太短了。
内网穿透服务商的质量也得考虑,说不定换个好点的,延迟能低不少。
还有就是云服务器本身也得够劲儿,带宽要是不够,大家一起进来肯定卡。
最简单的办法就是试试让玩家直接连云服务器上的 Velocity(绕过内网穿透),如果这样就不卡了,那基本就是内网穿透的锅了。
总的来说,用内网穿透本身就是个不太完美的方案,肯定会多一层网络延迟和不稳定。现在日志又显示 Velocity 和后端服务器之间也不稳,那就更卡了。
 
建议2:
定位 sc 服务器问题:
检查 sc 服务器日志: 这是最关键的一步。查看 sc 服务器(端口 102)的日志,寻找错误、警告、GC(垃圾回收)停顿、CPU/内存占用过高等信息。服务器内部连接超时 的直接原因是 sc 响应慢或无响应。
监控 sc 服务器性能: 使用 top, htop, jstat, jstack (如果是 Java 服务器) 等工具监控 sc 服务器的 CPU、内存、磁盘 I/O 和网络 I/O 使用情况。
优化 sc 服务器: 如果 sc 服务器过载或配置不当(例如,地图过大、实体过多、插件效率低),需要进行优化。
内网穿透优化:
更换服务商/方案: 如前所述,考虑更换更高质量的内网穿透服务。
直接绑定公网 IP: 如果云服务器有公网 IP,尽量避免使用内网穿透,直接将域名解析到云服务器 IP,让玩家直连 Velocity。
检查 forwarding.secret 文件: 确保 forwarding.secret 文件存在于 Velocity 目录下,并且内容正确,后端服务器也配置了相同的密钥。
调整超时设置(谨慎): 如果确定 sc 服务器偶尔会有短暂的高延迟,可以尝试稍微增加 read-timeout,但这只是缓解,并不能解决根本问题。
 

在线会员

  • 诞中
  • mcmanzi
  • hanyee
  • qwq220900
  • 妳得惯着她
  • Klinsky6
后退
顶部 底部