Battlefield 1942 Linux Dedicated Server

Enhanced Multi-Instance Setup with Secure Runtime

View on GitHub

Automated Setup Script

This solution installs the legacy 32-bit Battlefield 1942 dedicated server on modern 64-bit Linux systems using a dedicated, non-privileged account. It handles dependency resolution, user creation, and server installation in a single pass with support for running multiple server instances.

Features

  • Single-Script Setup

    One unified script handles everything - standalone or BFSMD modes.

  • Multi-Instance Support

    Run unlimited servers on one machine with automatic port allocation.

  • Smart Configuration

    Interactive IP detection, port conflict prevention, resource validation.

  • Secure Runtime

    Runs entirely under a dedicated service account (bf1942_user).

  • Modern Compatibility

    Automatically installs required i386 libraries on Ubuntu 24.04+ / Debian 12+.

  • Management Tools

    Comprehensive CLI tool for monitoring and managing all instances.

  • Performance Optimized

    CPU affinity, memory limits, I/O tuning automatically configured.

  • Systemd Integration

    Managed via standard systemctl commands with auto-start on boot.

โš™๏ธ Port Configuration

Each instance gets automatically calculated ports based on its name. This prevents conflicts and makes managing multiple servers straightforward.

Instance NameGame PortQuery PortManagement Port
server114600 (UDP)23033 (UDP)14700 (TCP)
server214605 (UDP)23038 (UDP)14705 (TCP)
conquest14620 (UDP)23053 (UDP)14720 (TCP)
tdm14589 (UDP)23022 (UDP)14689 (TCP)

View your actual ports with: ./bf1942_manager.sh ports

๐Ÿš€ Quick Start (Ubuntu 24.04 LTS)

1๏ธโƒฃ Download Scripts

# Download main setup script
wget https://raw.githubusercontent.com/hootmeow/bf1942-linux/main/ubuntu/ubu_24.0.3_bfsmd_setup.sh

# Download management tool
wget https://raw.githubusercontent.com/hootmeow/bf1942-linux/main/ubuntu/bf1942_manager.sh

# Make executable
chmod +x ubu_24.0.3_bfsmd_setup.sh bf1942_manager.sh

2๏ธโƒฃ Install Your First ServerBFSMD Recommended

sudo ./ubu_24.0.3_bfsmd_setup.sh

Interactive Setup Prompts:

  • Choose installation mode (Standalone or BFSMD)
  • Select IP address (auto-detected options provided)
  • Choose BFSMD version (v2.0 recommended or v2.01 patched)
  • Configure firewall rules (optional UFW configuration)

3๏ธโƒฃ Create Additional Instances (Optional)

Add more servers by passing an instance name. Each gets unique ports automatically.

sudo ./ubu_24.0.3_bfsmd_setup.sh server2
sudo ./ubu_24.0.3_bfsmd_setup.sh conquest
sudo ./ubu_24.0.3_bfsmd_setup.sh tdm

๐Ÿ› ๏ธ Management Commands

Use the bf1942_manager.sh tool to manage all your server instances.

# View all instances
./bf1942_manager.sh list

# Check port assignments
./bf1942_manager.sh ports

# View detailed status
./bf1942_manager.sh status server1

# Show configuration paths
./bf1942_manager.sh config server1

# Health check all instances
./bf1942_manager.sh health

# Security audit
./bf1942_manager.sh security

# Service control (requires sudo)
sudo ./bf1942_manager.sh start server1
sudo ./bf1942_manager.sh stop server1
sudo ./bf1942_manager.sh restart server1

# View live logs
./bf1942_manager.sh logs server1

# Remove instance (with confirmation)
sudo ./bf1942_manager.sh remove server2

Direct Systemd Commands:

# BFSMD instance
sudo systemctl status bfsmd-server1.service
sudo systemctl restart bfsmd-server1.service
journalctl -u bfsmd-server1.service -f

# Standalone server
sudo systemctl status bf1942.service

๐ŸŽฎ Connect to BFRM (BFSMD Mode)

Default Credentials

Username: bf1942

Password: battlefield

Connection Steps

  1. Open BFRM client (Windows)
  2. Connect to your-server-ip:management-port
  3. Login with default credentials
  4. Change password immediately (Admin tab)
BFSMD Login Screen

Set Server IP

Navigate to IP settings and set your server's IP address explicitly.

Set Server IP Address

Secure Remote Console & Admin

Change default remote console password and create secure admin accounts.

Remote Console Security

Set Default Map

Add at least one map to the rotation before starting the server.

Set Default Map

Update Admin Passwords

Create secure admin accounts and disable defaults.

Set Admin Users

Firewall Configuration

During installation, you can configure UFW firewall rules. For the management port, choose a security level:

Option 1: Open to All

Easiest setup

  • Anyone can attempt connection
  • Still requires password
  • Good for testing or behind other firewall

Option 2: Restrict to IP

Recommended

  • Only specified IP can connect
  • Firewall + password protection
  • Good for static admin IP

Option 3: SSH Tunnel

Most secure

  • No direct internet access
  • All traffic encrypted via SSH
  • Good for maximum security

SSH Tunnel Example

# On your local machine
ssh -L 14700:localhost:14700 user@your-server-ip

# Then connect BFRM to localhost:14700

๐ŸŒ Network Scenarios

Home Server (Behind Router)

  • During Install: Choose Local IP (192.168.x.x)
  • Router Config: Forward Game + Query ports (UDP)
  • Players Connect To: Your public IP

Cloud Server (AWS, DigitalOcean, etc.)

  • During Install: Choose Local IP (10.x.x.x or private IP)
  • Cloud Firewall: Allow Game + Query from 0.0.0.0/0
  • Players Connect To: Instance's public IP

๐Ÿ”ง Troubleshooting

"Internal error!" Messages

This is normal! BFSMD v2.0/v2.01 shows these continuously when reading /proc on modern kernels. The server functions perfectly despite these messages.

journalctl -u bfsmd-server1.service -f | grep -v "Internal error"

Can't Connect to Server

# 1. Check service is running
systemctl is-active bfsmd-server1.service

# 2. Check firewall
sudo ufw status

# 3. Check ports are listening
sudo ss -tulnp | grep 14567

# 4. View logs
./bf1942_manager.sh logs server1

Port Conflict During Installation

If you get "port already in use", try a different instance name (generates different ports), check existing assignments with ./bf1942_manager.sh ports, or remove the conflicting instance.

๐Ÿ“ Configuration Files

Standalone Server

/home/bf1942_user/bf1942/mods/bf1942/settings/
โ”œโ”€โ”€ ServerSettings.con  # Game settings
โ””โ”€โ”€ MapList.con         # Map rotation

BFSMD Instance

/home/bf1942_user/instances/<name>/mods/bf1942/settings/
โ”œโ”€โ”€ servermanager.con   # BFSMD settings
โ”œโ”€โ”€ useraccess.con      # Admin accounts
โ”œโ”€โ”€ ServerSettings.con  # Game settings
โ””โ”€โ”€ MapList.con         # Map rotation

BFRM Downloads (Windows)

๐Ÿงช Supported Distributions

DistributionStatusNotes
Ubuntu 24.04 LTSโœ… TestedPrimary tested platform.
Ubuntu 22.04 LTS๐Ÿ“‹ PlannedMinor package name adjustments may be needed.
Debian 12 (Bookworm)๐Ÿ“‹ PlannedUses the same multiarch structure as Ubuntu.
Debian 11 (Bullseye)๐Ÿ“‹ PlannedShould work with adjustments.
Fedora / RHEL / CentOS๐Ÿ“‹ PlannedRequires converting apt commands to dnf/yum.

Maximum Recommended Instances: CPU Cores ร— 2 (e.g., 4 cores = 8 instances max)

๐Ÿ› ๏ธ Applying Patches

The patches folder contains Python scripts to improve various server bugs. See individual patch files for details and instructions.

๐Ÿ“œ License

Scripts released under the MIT License. All Battlefield 1942 game assets remain ยฉ Electronic Arts Inc.