Modded Minecraft Server (Forge) with Twingate (Linux)
Host a private Forge modded Minecraft server on bare-metal Linux without Docker.
See all Minecraft guides to compare editions, or jump to vanilla Java, Bedrock, or the Forge Docker guide.
Overview
A modded Minecraft server adds extra setup on top of a vanilla server. The server needs Forge installed, mods loaded, and enough RAM to run them. Every player connecting must have the same mods (and same versions) installed on their client, or the server will reject the connection.
The Docker version of this guide includes automated CurseForge modpack installation, which downloads and configures mods automatically from a single URL. That feature is specific to the Docker image. This guide covers native Linux installation, where you install Forge and add mods manually. If you want CurseForge auto-install, use the Docker guide instead.
The Twingate setup is identical to a vanilla server. You install a native Twingate Connector on the Linux host alongside the Forge server, and players connect using the server’s private IP address through the Twingate Client.
Architecture
[Player's Device] ↓ Twingate Client[Twingate Cloud] ↓[Twingate Connector] ↓[Forge Server — port 25565]Prerequisites
- A Linux machine (physical or virtual) with at least 4 GB of RAM, 2 CPU cores, and 20 GB of free disk space. Ubuntu 22.04, Ubuntu 24.04, and Debian 12 are tested.
- Java 17 (for Minecraft 1.20.x) or Java 21 (for Minecraft 1.21 and later) installed on the server.
- A Twingate account with access to the Admin Console. Sign up for free if you do not have one.
- SSH or terminal access to the Linux machine.
How much RAM?
It depends on your modpack. Small packs (20-50 mods) run fine on 4 GB. Large kitchen-sink packs (200+ mods like All the Mods or RLCraft) need 6-8 GB. Check your modpack’s description for recommended specs. The Twingate Connector adds under 256 MB on top.
Java version
Minecraft 1.20.x requires Java 17. Minecraft 1.21 and later requires Java 21. Check your modpack’s requirements and install the matching version before proceeding.
Step 1: Create a Remote Network and Generate Connector Tokens
Follow Step 1 in the vanilla Minecraft guide to create a Remote Network and generate Connector tokens, then return here.
Step 2: Install and Configure the Forge Server
This section covers native Forge installation on Linux. If you want automated CurseForge modpack installation instead, use the Docker guide.
Create the Server User and Directory
- SSH into the Linux machine.
- Create a dedicated system user for the Minecraft server:
sudo useradd -r -m -d /opt/minecraft-forge -s /bin/bash minecraft- Create the server directory:
sudo mkdir -p /opt/minecraft-forge/serversudo chown -R minecraft:minecraft /opt/minecraft-forgeInstall Java
- Install Java 17 (for Minecraft 1.20.x):
sudo apt updatesudo apt install -y openjdk-17-jre-headlessFor Minecraft 1.21 and later, install Java 21 instead:
sudo apt updatesudo apt install -y openjdk-21-jre-headless- Verify the Java version:
java -versionDownload and Install Forge
-
Visit files.minecraftforge.net to find the Forge version that matches your Minecraft version and mods. Copy the Installer download link.
-
Download and run the Forge installer:
sudo -u minecraft bash -c 'cd /opt/minecraft-forge/server && \ curl -O "https://maven.minecraftforge.net/net/minecraftforge/forge/1.20.1-47.2.0/forge-1.20.1-47.2.0-installer.jar" && \ java -jar forge-1.20.1-47.2.0-installer.jar --installServer && \ rm forge-1.20.1-47.2.0-installer.jar'Replace the version numbers in the URL and filename (1.20.1-47.2.0) with the Forge version that matches your mods. Visit files.minecraftforge.net to find the correct installer.
The installer downloads Forge, Minecraft, and required libraries. This takes 1-2 minutes.
Accept the EULA
- Create the
eula.txtfile and accept the Minecraft End User License Agreement:
sudo -u minecraft bash -c 'echo "eula=true" > /opt/minecraft-forge/server/eula.txt'EULA
By setting eula=true, you agree to the Minecraft End User License Agreement. Review it before proceeding.
Add Mods
- Create the mods directory:
sudo -u minecraft mkdir -p /opt/minecraft-forge/server/mods- Copy your mod
.jarfiles to the server. From your local machine, usescporrsync:
scp /path/to/your/mods/*.jar user@your-server:/tmp/- Move the mods into the server directory:
sudo mv /tmp/*.jar /opt/minecraft-forge/server/mods/sudo chown -R minecraft:minecraft /opt/minecraft-forge/server/modsVersion matching
Every mod must be compatible with both your Minecraft version and your Forge version. Mixing versions is the most common cause of startup crashes. Check each mod’s requirements before adding it.
Configure Server Settings
- The Forge installer creates a
server.propertiesfile on first launch. You can pre-configure it now, or let it generate with defaults and edit it later. For now, create a basic configuration:
sudo -u minecraft bash -c 'cat > /opt/minecraft-forge/server/server.properties << EOFserver-port=25565max-players=10difficulty=normalgamemode=survivalmotd=Private Forge Serveronline-mode=trueEOF'Set Memory Allocation
- The Forge installer creates a
user_jvm_args.txtfile that controls Java memory settings. Edit it to set memory allocation:
sudo -u minecraft bash -c 'echo "-Xmx4G -Xms2G" > /opt/minecraft-forge/server/user_jvm_args.txt'The Forge installer generates a run.sh script that reads JVM arguments from user_jvm_args.txt. Edit this file to change memory allocation instead of modifying run.sh directly. -Xmx sets the maximum heap size (4 GB here), and -Xms sets the initial size (2 GB).
For large modpacks, increase -Xmx to 6G or 8G.
Make the Startup Script Executable
- The Forge installer creates
run.sh, but it may not be executable. Fix permissions:
sudo chmod +x /opt/minecraft-forge/server/run.shCreate a Systemd Service
- Create a systemd service file to manage the Forge server:
sudo tee /etc/systemd/system/minecraft-forge.service > /dev/null << 'EOF'[Unit]Description=Minecraft Forge Modded ServerAfter=network.target
[Service]User=minecraftGroup=minecraftWorkingDirectory=/opt/minecraft-forge/serverExecStart=/opt/minecraft-forge/server/run.sh --noguiRestart=on-failureRestartSec=10StandardOutput=journalStandardError=journalSyslogIdentifier=minecraft-forge
[Install]WantedBy=multi-user.targetEOFStart the Forge Server
- Reload systemd, enable the service, and start it:
sudo systemctl daemon-reloadsudo systemctl enable --now minecraft-forge- Watch the logs to verify startup:
sudo journalctl -u minecraft-forge -fWait until you see a line containing For help, type "help" (the full line reads Done (15.0s)! For help, type "help"). This confirms the server finished loading. Press Ctrl+C to exit the log view.
Forge servers take longer to start than vanilla. Expect 2-5 minutes on first launch, especially with many mods. Subsequent starts are faster because the world is already generated.
Install the Twingate Connector
- Install the native Twingate Connector on the same host. Replace the placeholder values with your tokens from Step 1:
curl "https://binaries.twingate.com/connector/setup.sh" | \ sudo TWINGATE_ACCESS_TOKEN="<YOUR_ACCESS_TOKEN>" \ TWINGATE_REFRESH_TOKEN="<YOUR_REFRESH_TOKEN>" \ TWINGATE_NETWORK="<YOUR_TWINGATE_NETWORK>" \ bash- Verify the Connector is running:
sudo systemctl status twingate-connectorThe status should show active (running).
Verify the Connector in Admin Console
- In the Twingate Admin Console, navigate to Remote Networks and select your network.
- Click on the Connector. Verify that the Controller and Relay statuses both show Connected.
Step 3: Add the Forge Server as a Resource
The Resource configuration is the same as a vanilla server: TCP port 25565.
Find Your Server’s Private IP Address
- On the Linux machine, run:
hostname -I | awk '{print $1}'Note the IP address (e.g., 192.168.1.50).
Create the Resource
- In the Twingate Admin Console, navigate to Resources and click Add Resource.
- Select the Remote Network from Step 1.
- Configure the Resource:
- Name:
Forge Server - Address: Your server’s private IP address (e.g.,
192.168.1.50) - Protocols: TCP port
25565
- Name:
- Click Create Resource.
Assign Access
- Select the Group that contains your players (the default Everyone Group works for getting started) and click Grant Access.
Step 4: Connect Players
Modded Minecraft has an extra step compared to vanilla: every player needs the same mods installed on their client. The server will refuse connections from clients with missing or mismatched mods.
Install the Twingate Client
Each player installs the Twingate Client:
- Windows / macOS: twingate.com/download
- Linux: Linux Client install guide
Then sign in with the Twingate Network address (e.g., yournetwork.twingate.com) and the account the server admin invited you with.
Install the Mods
Players need to install the same mods the server is running. There are two ways to do this:
Option A: Manual Mod Installation
- Download and run the Forge installer for the same Minecraft version the server is running.
- Select Install client and click OK.
- Get the same mod
.jarfiles the server uses. The server admin can share them, or you can download them from CurseForge or Modrinth. - Copy the mod files into your client’s
mods/folder:- Windows:
%appdata%\.minecraft\mods\ - macOS:
~/Library/Application Support/minecraft/mods/ - Linux:
~/.minecraft/mods/
- Windows:
- In the Minecraft Launcher, select the Forge profile and launch.
Option B: CurseForge Modpack Launcher
If the server admin assembled the mods as a CurseForge modpack:
- Install a mod launcher: CurseForge App, Prism Launcher, or ATLauncher.
- Search for the modpack name the server admin gave you.
- Install it. The launcher downloads Forge and all the mods automatically.
Mods must match
If a player’s mod list doesn’t match the server’s, they’ll see a “Mod rejections” screen listing the differences. Both the mod files and their versions need to be identical. Ask the server admin for the exact mod list if you’re unsure.
Add the Server in Minecraft
- In the modded Minecraft instance, click Multiplayer, then Add Server.
- Enter the server’s private IP address (e.g.,
192.168.1.50). - Click Done, then select the server and click Join Server.
You're in!
Players connect using the private IP address through Twingate, with no port forwarding. The modded server stays off the public internet.
Step 5: Manage Player Access
Access management works the same way as a vanilla server. Create a Twingate Group, add your players, and assign the Group to the Forge Server Resource. See Step 5 in the vanilla guide for the full walkthrough.
Customizing the Server
Server Properties
Edit /opt/minecraft-forge/server/server.properties to change server behavior:
| Property | Default | Description |
|---|---|---|
server-port | 25565 | Port the server listens on |
max-players | 20 | Maximum concurrent players |
difficulty | normal | peaceful, easy, normal, hard |
gamemode | survival | Default game mode: survival, creative, adventure, spectator |
motd | (none) | Message shown in the server browser |
online-mode | true | Require authenticated Minecraft accounts |
view-distance | 10 | Render distance in chunks (lower reduces RAM usage) |
After changing server.properties, restart the server:
sudo systemctl restart minecraft-forgeMemory Allocation
Edit /opt/minecraft-forge/server/user_jvm_args.txt to change memory settings:
-Xmx6G -Xms3GThen restart: sudo systemctl restart minecraft-forge.
Mod Configuration
Most mods create configuration files in /opt/minecraft-forge/server/config/. Each mod’s config is different. Check the mod’s documentation for details. After changing mod configs, restart the server.
Adding or Removing Mods
To add a new mod:
- Copy the
.jarfile to/opt/minecraft-forge/server/mods/. - Restart the server:
sudo systemctl restart minecraft-forge. - Give the same mod to all players.
To remove a mod:
- Delete its
.jarfile from/opt/minecraft-forge/server/mods/. - Restart the server.
- Have players remove the mod from their client
mods/folder.
Troubleshooting
“Mod Rejections” When Connecting
The server lists which mods are missing or have wrong versions. Compare the server’s mod list (/opt/minecraft-forge/server/mods/) with the player’s client mods/ folder. Both sides need the same files.
To see which mods the server has:
ls -1 /opt/minecraft-forge/server/mods/Ask the player to check their client’s mods/ folder and verify the filenames match exactly.
Server Crashes on Startup
- Check the logs:
sudo journalctl -u minecraft-forge -n 200. The most useful file is also/opt/minecraft-forge/server/logs/latest.log. - Look for
java.lang.OutOfMemoryError. If you see it, increase the-Xmxvalue inuser_jvm_args.txt. Large modpacks need 6-8 GB. - Look for mod conflict errors. Two mods that modify the same game mechanic can crash the server. Try removing the most recently added mod and restarting.
- Check Java version:
java -version. Minecraft 1.20.x requires Java 17. Minecraft 1.21+ requires Java 21.
Server Takes a Long Time to Start
This is normal. Forge loads every mod at startup, and large modpacks (200+ mods) can take 3-5 minutes. First-time startup is even slower because it generates the world.
If it takes more than 10 minutes, check the logs for errors: sudo journalctl -u minecraft-forge -f. A mod that hangs during initialization will stall the whole startup.
Permission Errors
If the server fails to start with permission errors:
sudo chown -R minecraft:minecraft /opt/minecraft-forgesudo chmod +x /opt/minecraft-forge/server/run.shsudo systemctl restart minecraft-forgeWrong Java Version
If the logs show Unsupported class file major version or similar:
- Check which Java version you have:
java -version. - Minecraft 1.20.x needs Java 17. Minecraft 1.21+ needs Java 21.
- Install the correct version (see Step 2) and restart the server.
Server Not Starting (run.sh Not Executable)
If the server fails silently:
sudo chmod +x /opt/minecraft-forge/server/run.shsudo systemctl restart minecraft-forgeConnector Shows Offline in Admin Console
- Are the
TWINGATE_ACCESS_TOKEN,TWINGATE_REFRESH_TOKEN, andTWINGATE_NETWORKvalues correct? - Does the host machine have outbound internet access? The Connector needs to reach Twingate Cloud.
- Check the Connector logs:
sudo journalctl -u twingate-connector -f.
Next Steps
- Vanilla Minecraft guide: Running an unmodded server alongside your Forge server.
- Bedrock Edition guide: Hosting Bedrock for mobile and Windows players.
- Forge Docker guide: Automated CurseForge modpack installation using Docker.
- Resources: Learn more about configuring Twingate Resources, including wildcard DNS and CIDR-based Resources.
- Security Policies: Add multi-factor authentication or device trust requirements for players connecting to your server.
- Protect Your Home Lab: Extend Twingate to secure other services running on your home network.
Have questions or want to share your setup? Join us on the community subreddit.
Last updated 6 days ago