Building a LAN Gaming Environment with ZeroTier
前言
ZeroTier是一个非常好用的软件定义局域网SDN,但在用来玩局域网游戏时可能会遇到一些问题,比如无法发现其他玩家或连接延迟高。
服务器端配置
1. 启用网络广播
要让游戏能够自动发现其他玩家,需要在ZeroTier网络设置中启用广播和组播:
- 登录管理面板(或者是ztncui)
- 添加新路由
- 添加以下两条路由规则:
- 目标:
255.255.255.255/32,via:0.0.0.0(启用广播) - 目标:
224.0.0.0/4,via:0.0.0.0(启用组播)
- 目标:
注意:虽然广播会降低网络效率,但对于游戏发现功能来说是必需的。
2. 优化MTU设置
大多数家用网络的MTU为1500(PPPoE环境下为1492),需要调整ZeroTier的MTU以避免数据包分片:
1 | |
客户端配置
1.安装WindowsIPBroadcast
某些游戏(文明6)只在第一个网络适配器上面广播,需要第三方软件广播到全部适配器上,WindowsIPBroadcast可以解决这个问题:
GitHub仓库下载最新版本
2.加钱上moon服务器
Introduction
ZeroTier is a very useful Software-Defined Network (SDN), but when used for playing LAN games, you might encounter issues such as being unable to discover other players or experiencing high connection latency.
Server-Side Configuration
1. Enable Network Broadcast
To allow the game to automatically discover other players, you need to enable broadcast and multicast in the ZeroTier network settings:
- Log into the management panel (or use ztncui).
- Add a new route.
- Add the following two routing rules:
- Destination:
255.255.255.255/32, via:0.0.0.0(enables broadcast) - Destination:
224.0.0.0/4, via:0.0.0.0(enables multicast)
Note: While broadcast reduces network efficiency, it is necessary for game discovery functionality.
2. Optimize MTU Settings
Most home networks have an MTU of 1500 (1492 in PPPoE environments). It’s necessary to adjust ZeroTier’s MTU to avoid packet fragmentation:
1 | |
Client-Side Configuration
1. Install WindowsIPBroadcast
Some games (like Civilization 6) only broadcast on the first network adapter. To handle this, you need third-party software to broadcast across all adapters. WindowsIPBroadcast can resolve this issue:
GitHub Repository Download the latest version.