Overview
GamePanelX’s network management system enables you to manage game servers across multiple physical servers, both local and remote. The network module handles IP address allocation, SSH connectivity, and remote command execution.Multi-Server Support
Manage servers across multiple physical machines and locations
IP Management
Track and allocate IP addresses and ports automatically
Remote Control
Execute commands via SSH on remote servers
Load Balancing
Distribute servers based on network load monitoring
Network Architecture
GamePanelX supports two deployment types:Local Servers
Characteristics:- Game servers run on the same machine as the web panel
- Commands executed via PHP
exec()function - Direct file system access
- No SSH required
- Faster operations
- Small installations
- Development/testing environments
- Single-server game hosting
Remote Servers
Characteristics:- Game servers run on separate physical machines
- Commands executed via SSH (PHPSecLib)
- Encrypted credentials
- Parent-child network hierarchy
- Distributed infrastructure
- Multi-server hosting providers
- Geographic distribution
- Load balancing across hardware
- Dedicated game server nodes
Network Server Management
Creating Network Servers
TheNetwork::create() method adds new network servers:
Create Network Server
Validation
- Validates IP address format
- Checks for duplicate IP addresses
- Verifies required parameters
Local Setup
For local servers:
- Verifies
exec()function is available - Checks script permissions in
_SERVERS/scripts/ - Confirms scripts are executable
Remote Setup
For remote servers:
- Tests SSH connectivity
- Verifies login credentials
- Checks script installation with
CheckInstall - Creates callback token for remote communication
- Syncs existing user accounts to remote server
Remote servers require the GamePanelX Remote package to be installed at
/usr/local/gpx/. The CheckInstall script verifies proper installation.Network Hierarchy
GamePanelX supports parent-child network relationships:- Physical machine running game servers
- Has SSH credentials
- Manages all child IPs
- Field:
parentid = 0
- Additional IP addresses on the same physical machine
- Inherit parent’s SSH credentials
- Share the same physical resources
- Field:
parentid = <parent_id>
Deleting Network Servers
Delete Network Server
- Checks if any servers use this network ID
- Prevents deletion if servers exist
- Deletes associated templates
- Removes parent and all child IPs
Remote Command Execution
Running Commands
TheNetwork::runcmd() method is the core of remote operations:
Execute Remote Command
- Local Execution
- Remote Execution
- Prepends script path:
_SERVERS/scripts/ - Sets
$HOMEenvironment variable - Redirects stderr to stdout
- Executes via
exec(),shell_exec(), orsystem()
SSO vs Admin Commands
GamePanelX uses different authentication for different commands:SSO User Commands
SSO User Commands
These commands run as the game server owner:
RestartStopUpdateServerDeleteServerCheckGameServerOutputServerSendCMDConfigUpdateMoveServerLocal
gpx + username (e.g., gpxjohn)Admin Commands
Admin Commands
These commands run as the main GPX user:
AutoInstallCheckCreateServerStatusCheckInstallCheckTemplatesCreateUserCreateTemplateCreateServerDeleteUserDeleteTemplateChangePasswordUsernameChangeSteamCMDInstallSteamInstall
Command Security
All commands are sanitized before execution:Command Sanitization
IP Address Management
Automatic IP/Port Allocation
GamePanelX can automatically find available IP/port combinations:Find Available Port
Load Balancing
- Queries
loadavgtable for server loads - Selects network server with lowest load average
- Falls back to first available if no load data exists
Default Port
- Retrieves default port from game configuration
- Checks each IP address for default port availability
- Returns first IP where default port is free
Alternative Ports
- If default port unavailable on all IPs
- Increments port from default+10 to default+60
- Returns first available port on any IP
Port Conflict Detection
Before creating servers, GamePanelX validates IP/port availability:Check IP/Port Combination
Network Information Retrieval
Getting Network Details
TheNetwork::netinfo() method retrieves network server configuration:
Get Network Info
- SSH connection details (decrypted)
- Local vs remote status
- Parent and child IP relationships
- Home directory path
- Server working directory and PID file location
Checking Local vs Remote
Check Server Type
Load Monitoring
GamePanelX tracks network server resources:Load Average Table
Load averages are used for automatic server placement. Servers are preferentially created on network nodes with the lowest load.
Database Schema
Network Table
Callback System
Remote servers communicate back to the panel via callbacks:Callback URL Format
token- Unique security token (32 characters)id- Server or network ID- Optional:
status,msg,progress
Callback Uses
- Server Installation
- Server Updates
- Load Monitoring
installing to completeBest Practices
Network Organization
Network Organization
- Use descriptive datacenter and location names
- Group related IPs under the same parent server
- Document hardware specifications in location fields
- Maintain consistent SSH credentials across servers
Security
Security
- Use SSH key authentication instead of passwords (custom setup)
- Restrict SSH access to specific IP addresses
- Regularly rotate encryption keys
- Use non-standard SSH ports (not 22)
Performance
Performance
- Distribute servers across multiple network nodes
- Monitor load averages and add capacity as needed
- Use local servers when possible for faster operations
- Keep SSH connections alive with timeout settings
Reliability
Reliability
- Test SSH connectivity before adding network servers
- Verify callback URLs are accessible from remote servers
- Maintain synchronized time (NTP) on all servers
- Monitor disk space on network nodes
Troubleshooting
SSH Connection Failures
- Verify SSH credentials are correct
- Check firewall allows connections on SSH port
- Test connectivity:
telnet <ip> <port> - Verify SSH service is running on remote server
- Check PHPSecLib has correct permissions
Callback Issues
- Verify callback URL is accessible from remote server
- Check token matches in database
- Review web server access logs
- Test callback manually:
wget -qO- "<callback_url>" - Ensure
includes/callback.phpexists and is executable
Port Allocation Problems
- Check if IP addresses are properly configured
- Verify port range isn’t exhausted
- Review
serverstable for orphaned entries - Manually specify ports if auto-allocation fails
- Add additional IP addresses to network pool
Load Data Not Updating
- Verify GPXManager is running on remote server
- Check manager cron job or service status
- Test callback URL from remote server
- Review
loadavgtable for stale data - Check remote server system time is synchronized