Skip to content

[Bug]: Cannot query lgsm server when crossplay is enabled (a2s_info won't connect) #4888

@peter-kraker

Description

@peter-kraker

User story

As a dedicated server host, using cloud service providers, I want to be able to query my lgsm server so that I can automate server operations (startup / shutdown).

Game

Valheim

Linux distro

Ubuntu 24.04

Command

command: details, command: monitor

Further information

Context

I've been hosting a Valheim Server for a group of friends off-and-on for several years. The game server is VM on GCP -- it starts lgsm / vhserver as soon as it boots. Then I built a discord bot that listens in our discord, and can turn the VM off/on using pub/sub messages attached to a "Cloud Function."

My Discord bot uses Steam's a2s_info query to determine if the server is up, and if so, state how many people are logged in. It uses the a2s_info query to tell people when the server is up (e.g. "Starting.... Started!"), so it's an important part of my setup.

Problem

When crossplay is enabled, Steam's server queries are broken (e.g. A2S_info, A2S_ping).

At first I thought this was a port forwarding issue, but I think there's a more significant reason why this doesn't work. Specifically, when crossplay is enabled, queries are broken on the host itself

With Crossplay Turned on

$ ./vhserver start
$ echo -n -e "\xff\xff\xff\xff\x54\x53\x6f\x75\x72\x63\x65\x20\x45\x6e\x67\x69\x6e\x65\x20\x51\x75\x65\x72\x79\x00" | nc -u 127.0.0.1 2457


With Crossplay Turned off:

$ ./vhserver start
$ echo -n -e "\xff\xff\xff\xff\x54\x53\x6f\x75\x72\x63\x65\x20\x45\x6e\x67\x69\x6e\x65\x20\x51\x75\x65\x72\x79\x00" | nc -u 127.0.0.1 2457
I$servername$$servername$valheim
dl1.0.0.0      ̧8@g=0.221.12,n=36,m=*

Prior Issue: #4748

Expected Behavior

Whether crossplay is enabled or not:

  1. Players can join the game via the Valheim game client.
  2. a2s_info server queries return server information.

Game Startup

With Crossplay

./valheim_server.x86_64 -name $servername -password $passwd -port 2456 -world $worldname -public 1 -savedir '/home/vhserver/.config/unity3d/IronGate/Valheim' -saveinterval 1800 -backups 4 -backupshort 7200 -backuplong 43200 -crossplay -instanceid 1

Without Crossplay

./valheim_server.x86_64 -name $servername -password $passwd -port 2456 -world $worldname -public 1 -savedir '/home/vhserver/.config/unity3d/IronGate/Valheim' -saveinterval 1800 -backups 4 -backupshort 7200 -backuplong 43200 -instanceid 1

Server Query

There are several ways to query a server.

  • URL, using the Steam API: https://api.steampowered.com/ISteamApps/GetServersAtAddress/v0001?addr=$ip_addr
    • Note: Replace $ip_addr with the public-facing IP of the game server.
    • If successful the servers: list in the reply will not be empty.
  • CLI: On the game server itself, attempt to send the A2S Challenge: echo -n -e "\xff\xff\xff\xff\x54\x53\x6f\x75\x72\x63\x65\x20\x45\x6e\x67\x69\x6e\x65\x20\x51\x75\x65\x72\x79\x00" | nc -u 127.0.0.1 2457
    • If successful, a chunk of data will be returned on the command line,:
I$server_name$valheim
^C1.0.0.0      8@g=0.221.12,n=36,m=*

If run from a remote host, the steam game server could issue a challenge, which looks like several random characters in response. Otherwise, a failure looks like nothing happens.

Network Setup

IP

The game server, hosted on GCP, has a static, publicly routable IP. It's pingable from my home workstation as well as from another VM.

Firewall

I've opened the following ports (ingress) from 0.0.0.0/0:

tcp:
2456-2458,
27015-27030,
27036-27037

udp:
2456-2458,
4380,
27000-27031,
27036

Relevant log output

### Without Crossplay Enabled ###

$ ./vhserver dt

Distro Details
================================================================================================================
Date:         Mon Mar 23 04:13:49 UTC 2026
Distro:       Debian GNU/Linux 13 (trixie)
Arch:         x86_64
Kernel:       6.12.73+deb13-cloud-amd64
Hostname:     instance-20260322-040156
Environment:  google
Uptime:       0d, 1h, 39m
tmux:         3.5a
glibc:        2.41

Server Resource
================================================================================================================
CPU         
Model:      AMD EPYC 7B13
Cores:      2
Frequency:  2449.998MHz
Avg Load:   0.14, 0.03, 0.01

Memory                                  
Mem:       total  used   free   cached  available
Physical:  7.8GB  1.3GB  6.4GB  866MB   6.4GB
Swap:      0B     0B     0B             

Storage      
Filesystem:  /dev/sda1
Total:       9.7G
Used:        5.2G
Available:   4.0G

Network       
IP:           0.0.0.0
Internet IP:  34.42.187.172

Valheim Resource Usage
================================================================================================================
CPU Used:  64.1%  
Mem Used:  13.4%  1065MB

Storage       
Total:        1.9G
Serverfiles:  1.7G

Valheim Server Details
================================================================================================================
Server name:      $servername
App ID:           896660
Server IP:        0.0.0.0:2456
Internet IP:      34.42.187.172:2456
Server password:  $passwd
Save interval:    1800s
Master server:    not listed
Status:           STARTED

vhserver Script Details
================================================================================================================
Script name:       vhserver
LinuxGSM version:  v25.2.0
glibc required:    2.15
IFTTT alert:       off
Update on start:   off
User:              vhserver
Location:          /home/vhserver

Backups
================================================================================================================
No Backups created

Command-line Parameters
================================================================================================================
 ./valheim_server.x86_64 -name $servername -password $passwd -port 2456 -world $worldname -public 1 -savedir '/home/vhserver/.config/unity3d/IronGate/Valheim' -saveinterval 1800 -backups 4 -backupshort 7200 -backuplong 43200 -instanceid 1  

Ports
================================================================================================================
Change ports by editing the parameters in:
/home/vhserver/lgsm/config-lgsm/vhserver

Useful port diagnostic command:
ss -tuplwn | grep valheim_server.

DESCRIPTION  PORT  PROTOCOL  LISTEN
Game         2456  udp       0
Query        2457  udp       1

Status: STARTED


core_exit.sh exiting with code: 0

$ ./vhserver qr 

Valheim Developer Query Raw
=================================

IP Addresses Variables
=================================

IP: 0.0.0.0
HTTP IP: 10.128.0.4
Public IP: 35.208.212.176
Telnet IP: 10.128.0.4
Display IP: 

Query IP Addresses
=================================

127.0.0.1
10.128.0.4
35.208.212.176

Game Server Ports
=================================
Port Name           Port Number   Status   TCP   UDP
Game:               2456          0              
Query:              2457          1              UNCONN
API:                                             
App:                                             
BattleEye:                                       
Beacon:                                          
ReliableMessaging:                               
Client:                                          
File:                                            
HTTP:                                            
HTTP Query:                                      
Web Interface:                                   
Game: Master:                                    
RAW UDP Socket:                                  
RCON:                                            
Steam:                                           
Steamworks P2P:                                  
Steam: Auth:                                     
Telnet:                                          
Stats:                                           
SourceTV:                                        
UDP Link:                                        
Voice:                                           
Voice (Unused):                                  

SS Output
=================================
Useful port diagnostic command:
ss -tuplwn | grep valheim_server.

udp   UNCONN 0      0              0.0.0.0:2457       0.0.0.0:*    users:(("valheim_server.",pid=37871,fd=36))
udp   UNCONN 0      0              0.0.0.0:36565      0.0.0.0:*    users:(("valheim_server.",pid=37871,fd=50))
udp   UNCONN 0      0                    *:47464            *:*    users:(("valheim_server.",pid=37871,fd=35))
tcp   LISTEN 0      128          127.0.0.1:39921      0.0.0.0:*    users:(("valheim_server.",pid=37871,fd=32))

Query Port (2457) - Gamedig Output
=================================

PORT: 2456
QUERY PORT: 2457

Is My Game Server Online?
=================================
Game server status: https://ismygameserver.online//35.208.212.176:2457

Gamedig Raw Output
=================================

Failure! gamedig not installed







Query Port (2457) - gsquery Output
=================================

./query_gsquery.py -a "127.0.0.1" -p "2457" -e ""

usage: usage: python3 query_gsquery.py [options]
query_gsquery.py: error: argument -e/--engine: invalid choice: '' (choose from protocol-valve, protocol-quake2, protocol-quake3, protocol-gamespy1, protocol-unreal2, ut3, minecraft, minecraftbe, jc2m, mumbleping, soldat, teeworlds)
./query_gsquery.py -a "10.128.0.4" -p "2457" -e ""

usage: usage: python3 query_gsquery.py [options]
query_gsquery.py: error: argument -e/--engine: invalid choice: '' (choose from protocol-valve, protocol-quake2, protocol-quake3, protocol-gamespy1, protocol-unreal2, ut3, minecraft, minecraftbe, jc2m, mumbleping, soldat, teeworlds)
./query_gsquery.py -a "35.208.212.176" -p "2457" -e ""

usage: usage: python3 query_gsquery.py [options]
query_gsquery.py: error: argument -e/--engine: invalid choice: '' (choose from protocol-valve, protocol-quake2, protocol-quake3, protocol-gamespy1, protocol-unreal2, ut3, minecraft, minecraftbe, jc2m, mumbleping, soldat, teeworlds)

Query Port (2457) - TCP Output
=================================

bash -c 'exec 3<> /dev/tcp/'127.0.0.1'/'2457''

bash: connect: Connection refused
bash: line 1: /dev/tcp/127.0.0.1/2457: Connection refused

TCP query FAIL
bash -c 'exec 3<> /dev/tcp/'10.128.0.4'/'2457''

bash: connect: Connection refused
bash: line 1: /dev/tcp/10.128.0.4/2457: Connection refused

TCP query FAIL
bash -c 'exec 3<> /dev/tcp/'35.208.212.176'/'2457''

bash: connect: Connection refused
bash: line 1: /dev/tcp/35.208.212.176/2457: Connection refused

TCP query FAIL

Game Port (2456) - TCP Output
=================================

TCP Raw Output
=================================

bash -c 'exec 3<> /dev/tcp/'127.0.0.1'/'2456''

bash: connect: Connection refused
bash: line 1: /dev/tcp/127.0.0.1/2456: Connection refused

TCP query FAIL
bash -c 'exec 3<> /dev/tcp/'10.128.0.4'/'2456''

bash: connect: Connection refused
bash: line 1: /dev/tcp/10.128.0.4/2456: Connection refused

TCP query FAIL
bash -c 'exec 3<> /dev/tcp/'35.208.212.176'/'2456''

bash: connect: Connection refused
bash: line 1: /dev/tcp/35.208.212.176/2456: Connection refused

TCP query FAIL

Steam Master Server Response
=================================

curl -m 3 -s https://api.steampowered.com/ISteamApps/GetServersAtAddress/v0001?addr=35.208.212.176

Response: false


core_exit.sh exiting with code: 0





### With Crossplay Enabled ###

vhserver@instance-20260322-040156:~$ ./vhserver dt

Distro Details
================================================================================================================
Date:         Mon Mar 23 04:59:58 UTC 2026
Distro:       Debian GNU/Linux 13 (trixie)
Arch:         x86_64
Kernel:       6.12.73+deb13-cloud-amd64
Hostname:     instance-20260322-040156
Environment:  google
Uptime:       0d, 2h, 25m
tmux:         3.5a
glibc:        2.41

Server Resource
================================================================================================================
CPU         
Model:      AMD EPYC 7B13
Cores:      2
Frequency:  2449.998MHz
Avg Load:   0.52, 0.17, 0.09

Memory                                  
Mem:       total  used   free   cached  available
Physical:  7.8GB  1.2GB  6.4GB  910MB   6.4GB
Swap:      0B     0B     0B             

Storage      
Filesystem:  /dev/sda1
Total:       9.7G
Used:        5.3G
Available:   4.0G

Network       
IP:           0.0.0.0
Internet IP:  35.208.212.176

Valheim Resource Usage
================================================================================================================
CPU Used:  65.3%  
Mem Used:  11.6%  924MB

Storage       
Total:        1.9G
Serverfiles:  1.7G

Valheim Server Details
================================================================================================================
Server name:      $servername
App ID:           896660
Server IP:        0.0.0.0:2456
Internet IP:      35.208.212.176:2456
Server password:  #passwd
Save interval:    1800s
Master server:    not listed
Status:           STARTED

vhserver Script Details
================================================================================================================
Script name:       vhserver
LinuxGSM version:  v25.2.0
glibc required:    2.15
IFTTT alert:       off
Update on start:   off
User:              vhserver
Location:          /home/vhserver

Backups
================================================================================================================
No Backups created

Command-line Parameters
================================================================================================================
 ./valheim_server.x86_64 -name $servername -password $passwd -port 2456 -world #worldname -public 1 -savedir '/home/vhserver/.config/unity3d/IronGate/Valheim' -saveinterval 1800 -backups 4 -backupshort 7200 -backuplong 43200 -crossplay -instanceid 1  

Ports
================================================================================================================
Change ports by editing the parameters in:
/home/vhserver/lgsm/config-lgsm/vhserver

Useful port diagnostic command:
ss -tuplwn | grep valheim_server.

DESCRIPTION  PORT  PROTOCOL  LISTEN
Game         2456  udp       0
Query        2457  udp       0

Status: STARTED


core_exit.sh exiting with code: 0

vhserver@instance-20260322-040156:~$ ./vhserver qr

Valheim Developer Query Raw
=================================

IP Addresses Variables
=================================

IP: 0.0.0.0
HTTP IP: 10.128.0.4
Public IP: 35.208.212.176
Telnet IP: 10.128.0.4
Display IP: 

Query IP Addresses
=================================

127.0.0.1
10.128.0.4
35.208.212.176

Game Server Ports
=================================
Port Name           Port Number   Status   TCP   UDP
Game:               2456          0              
Query:              2457          1              UNCONN
API:                                             
App:                                             
BattleEye:                                       
Beacon:                                          
ReliableMessaging:                               
Client:                                          
File:                                            
HTTP:                                            
HTTP Query:                                      
Web Interface:                                   
Game: Master:                                    
RAW UDP Socket:                                  
RCON:                                            
Steam:                                           
Steamworks P2P:                                  
Steam: Auth:                                     
Telnet:                                          
Stats:                                           
SourceTV:                                        
UDP Link:                                        
Voice:                                           
Voice (Unused):                                  

SS Output
=================================
Useful port diagnostic command:
ss -tuplwn | grep valheim_server.

udp   UNCONN 6400   0              0.0.0.0:2457       0.0.0.0:*    users:(("valheim_server.",pid=40717,fd=46))
udp   UNCONN 0      0              0.0.0.0:51794      0.0.0.0:*    users:(("valheim_server.",pid=40717,fd=52))
udp   UNCONN 0      0                    *:35262            *:*    users:(("valheim_server.",pid=40717,fd=45))
tcp   LISTEN 0      128          127.0.0.1:34247      0.0.0.0:*    users:(("valheim_server.",pid=40717,fd=33))

Query Port (2457) - Gamedig Output
=================================

PORT: 2456
QUERY PORT: 2457

Is My Game Server Online?
=================================
Game server status: https://ismygameserver.online//35.208.212.176:2457

Gamedig Raw Output
=================================

Failure! gamedig not installed







Query Port (2457) - gsquery Output
=================================

./query_gsquery.py -a "127.0.0.1" -p "2457" -e ""

usage: usage: python3 query_gsquery.py [options]
query_gsquery.py: error: argument -e/--engine: invalid choice: '' (choose from protocol-valve, protocol-quake2, protocol-quake3, protocol-gamespy1, protocol-unreal2, ut3, minecraft, minecraftbe, jc2m, mumbleping, soldat, teeworlds)
./query_gsquery.py -a "10.128.0.4" -p "2457" -e ""

usage: usage: python3 query_gsquery.py [options]
query_gsquery.py: error: argument -e/--engine: invalid choice: '' (choose from protocol-valve, protocol-quake2, protocol-quake3, protocol-gamespy1, protocol-unreal2, ut3, minecraft, minecraftbe, jc2m, mumbleping, soldat, teeworlds)
./query_gsquery.py -a "35.208.212.176" -p "2457" -e ""

usage: usage: python3 query_gsquery.py [options]
query_gsquery.py: error: argument -e/--engine: invalid choice: '' (choose from protocol-valve, protocol-quake2, protocol-quake3, protocol-gamespy1, protocol-unreal2, ut3, minecraft, minecraftbe, jc2m, mumbleping, soldat, teeworlds)

Query Port (2457) - TCP Output
=================================

bash -c 'exec 3<> /dev/tcp/'127.0.0.1'/'2457''

bash: connect: Connection refused
bash: line 1: /dev/tcp/127.0.0.1/2457: Connection refused

TCP query FAIL
bash -c 'exec 3<> /dev/tcp/'10.128.0.4'/'2457''

bash: connect: Connection refused
bash: line 1: /dev/tcp/10.128.0.4/2457: Connection refused

TCP query FAIL
bash -c 'exec 3<> /dev/tcp/'35.208.212.176'/'2457''

bash: connect: Connection refused
bash: line 1: /dev/tcp/35.208.212.176/2457: Connection refused

TCP query FAIL

Game Port (2456) - TCP Output
=================================

TCP Raw Output
=================================

bash -c 'exec 3<> /dev/tcp/'127.0.0.1'/'2456''

bash: connect: Connection refused
bash: line 1: /dev/tcp/127.0.0.1/2456: Connection refused

TCP query FAIL
bash -c 'exec 3<> /dev/tcp/'10.128.0.4'/'2456''

bash: connect: Connection refused
bash: line 1: /dev/tcp/10.128.0.4/2456: Connection refused

TCP query FAIL
bash -c 'exec 3<> /dev/tcp/'35.208.212.176'/'2456''

bash: connect: Connection refused
bash: line 1: /dev/tcp/35.208.212.176/2456: Connection refused

TCP query FAIL

Steam Master Server Response
=================================

curl -m 3 -s https://api.steampowered.com/ISteamApps/GetServersAtAddress/v0001?addr=35.208.212.176

Response: false


core_exit.sh exiting with code: 0

Steps to reproduce

  1. ./vhserver start
  2. echo -n -e "\xff\xff\xff\xff\x54\x53\x6f\x75\x72\x63\x65\x20\x45\x6e\x67\x69\x6e\x65\x20\x51\x75\x65\x72\x79\x00" | nc -u 127.0.0.1 2457

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    🆕 New Issues

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions