Security warning
Use at your own risk. The author takes no responsibility for the security of this software or for any damage, loss, or compromise resulting from its use. This relay forwards the ancient Microsoft DirectPlay protocol used by the 1998 game. Do not assume that its late-1990s design meets modern security expectations.
How it works and which ports to open
One relay process serves many independent two-player rooms. Each room has one host and one joiner. Both game computers connect outbound to the relay, which forwards their game packets without interpreting the simulation.
In the restored game, both players select TCP/IP Relay Server for DirectPlay. The host chooses Setup Game and enters the relay address; the other player chooses Connect to Game and enters the same address, then selects the hosted session. Use relay.example.com or relay.example.com:47624. The last address is saved in the game's registry.json. The original, unmodified game does not provide this custom relay connection type.
- Open the configured TCP port, default 47624, inbound on the relay server, including any cloud firewall or router forwarding in front of it.
- Players need outbound TCP access to that server/port. Relay mode needs no inbound player ports, no UDP relay port, and no DirectPlay 2300–2399 forwarding.
- The control CLI uses a local Unix socket, so it needs no network admin port. Run it on the server, or through SSH.
Build
Requires Linux, a C++20 compiler, CMake 3.20 or newer, and Ninja. On Ubuntu/Debian, install the tools, then build from the extracted relay/ directory:
sudo apt-get update
sudo apt-get install --no-install-recommends clang cmake ninja-build
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=clang++
cmake --build build
This produces build/rebexe-relay and build/rebexe-relayctl.
Configuration and foreground operation
The supplied rebexe-relay.conf uses key = value lines. Whitespace is trimmed; # starts a comment. Values are unquoted, with no environment-variable expansion. Unknown keys, invalid numbers, or an unreadable configuration file stop startup with an error.
| Key | Meaning |
|---|---|
listen | IPv4 bind address; default 0.0.0.0 listens on every IPv4 interface. Use 127.0.0.1 for local access. |
port | TCP listening port, 1–65535; default 47624. |
max_games | Maximum games actively in progress, 0–1024; omitted or 0 means unlimited. Waiting and paired rooms do not count. Can be changed with reload. |
motd | One-line room greeting (up to 1,024 bytes) shown in the lobby chat to the Host when the room is created and to each Join client on entry. Defaults to Welcome to Rebellion Relay Server; leave empty to disable. Can be changed with reload for newly created rooms. |
allow_ips | Comma-separated source IPv4 addresses or CIDR networks, for example 203.0.113.42, 198.51.100.0/24. Omitted or empty allows everyone. A bare IP matches exactly; /0 allows all IPv4 addresses. |
log | Append-only log file. Empty or omitted means /var/log/rebexe-relay.log. Use an absolute, writable path. |
control_socket | Local CLI socket path. The example uses /run/rebexe-relay/admin.sock; omitted or empty disables the socket. |
control_group | Existing group allowed to use the socket, with mode 0660. Without a group, its mode is 0600. The supplied example uses ubuntu. |
The server accepts --config PATH, --listen IPv4, --port PORT, and --help. Command-line listen/port options override the file. Without --config, built-in defaults apply; no configuration file is loaded automatically. --prepare-log prepares the configured log's ownership/permissions and exits; it is the privileged service pre-start helper, not a command to start the relay.
For an unprivileged local check, use writable paths instead of the service paths:
cat > build/local.conf <<EOF
listen = 127.0.0.1
port = 47624
log = $PWD/build/relay.log
control_socket = $PWD/build/admin.sock
EOF
./build/rebexe-relay --config build/local.conf
It runs in the foreground; Ctrl+C stops it. In another terminal in the same directory, query it with ./build/rebexe-relayctl --socket "$PWD/build/admin.sock" -h status.
When max_games is reached, another start is rejected with a busy notice; the paired players remain connected and the host can retry when capacity is free. The native client shows relay notices in the setup chat. Losing the host removes its room; in-progress reconnection is not implemented.
Install as a systemd service
Run these commands from relay/ as your regular user. They install both binaries and the supplied configuration/unit, replacing the example ubuntu group in both files with a dedicated administrative group:
sudo groupadd --system --force rebexe-relay-admin
sudo usermod -aG rebexe-relay-admin "$(id -un)"
sudo cmake --install build --prefix /usr/local
sudo install -m 0644 rebexe-relay.conf /etc/rebexe-relay.conf
sudo install -m 0644 rebexe-relay.service /etc/systemd/system/rebexe-relay.service
sudo sed -i 's/^control_group = .*/control_group = rebexe-relay-admin/' /etc/rebexe-relay.conf
sudo sed -i 's/^SupplementaryGroups=.*/SupplementaryGroups=rebexe-relay-admin/' /etc/systemd/system/rebexe-relay.service
sudo systemctl daemon-reload
sudo systemctl enable --now rebexe-relay
sudo systemctl status rebexe-relay
The unit uses a dynamic service account, creates /run/rebexe-relay, and prepares the log with the configured group's write access. control_group and the unit's SupplementaryGroups must match. A custom control socket should stay in that runtime directory. A log outside /var/log also needs its directory added to the unit's ReadWritePaths, with appropriate filesystem permissions.
Edit /etc/rebexe-relay.conf with sudo vi /etc/rebexe-relay.conf, then run sudo rebexe-relayctl reload to apply allow_ips, max_games, and motd without restarting the service. The commented example in the supplied configuration shows both an IP and a CIDR network. Use the source addresses seen by the relay, which may be players' public addresses after NAT. The updated rules apply to new TCP connections; existing players and games stay connected. Removing or emptying allow_ips welcomes everyone.
Reload re-reads and validates the same file passed with --config at startup. Missing, unreadable, or invalid configuration is reported in the CLI and server log; the CLI exits with an error and the active allow list and game limit stay unchanged. A lower max_games never kicks players out or stops current games. New starts are rejected while the active game count is at or above the limit; hosts can retry after capacity becomes available. Raising the limit or setting it to 0 allows further starts immediately. Only allow_ips, max_games, and motd are applied live. Existing rooms retain their original greeting for Join clients. Other settings still require sudo systemctl restart rebexe-relay, which disconnects existing games. For upgrades, reinstall the rebuilt binaries and restart, preserving your existing configuration.
Control CLI and monitoring
rebexe-relayctl [-h|--human-readable] [--socket PATH] [status|clients|games|reload]
| Argument | What it does |
|---|---|
status (default) | Connected clients, registered rooms, games in progress, configured game limit, and total TCP bytes received/sent since server startup. |
clients | Client ID, remote address, reported name, host/joiner/unassigned role, room ID, connection age, and TCP bytes received/sent for that connection. |
games | Room/session ID and name, state (waiting, paired, in_progress, closed), host/joiner client IDs, active playing time, and payload bytes forwarded each way. |
reload | Re-read the server's startup configuration and apply allow_ips, max_games, and motd. Prints the new game limit and allow-list acknowledgment, or an error. Failed reloads return a nonzero exit status. It does not edit the file. |
-h, --human-readable | Labeled output with readable durations and decimal KB/MB/GB units. -h is not help. Omit it for compact raw output in seconds/bytes. |
--socket PATH | Override /run/rebexe-relay/admin.sock; must match the server's control_socket. The CLI does not read the config file. |
--help | Show usage and exit. |
sudo rebexe-relayctl -h status
sudo rebexe-relayctl -h clients
sudo rebexe-relayctl -h games
sudo rebexe-relayctl reload
sudo tail -f /var/log/rebexe-relay.log
sudo journalctl -u rebexe-relay -n 50 --no-pager
Group members can omit sudo after logging out and back in. Monitoring commands are read-only; reload updates the running allow list and game limit. Use systemctl to stop or restart the service. Client names are client-reported; the native game initially reports its machine hostname, not the in-game player name. Room traffic counts forwarded payload; server/client counters include relay framing. Logs record connections, room changes, game starts/ends, durations, traffic, and explicitly reported chat. The native game does not currently report chat text to the relay log. The relay log appends across restarts and is not rotated automatically.