How to set up a private Factorio server with Meshnet
Learn how Meshnet can help you run a personal Factorio server.
Last updated
Learn how Meshnet can help you run a personal Factorio server.
Last updated
Factorio is a highly acclaimed simulation game that has gained widespread popularity due to its engaging mechanics, where players scavenge resources and build factories to escape an alien planet. With its sandbox-style gameplay and creative freedom, it's no wonder Factorio consistently ranks among the most popular games.
Factorio can be enjoyed as a single-player or multiplayer experience. Building and managing factories with friends can lead to unforgettable moments. However, setting up and maintaining your own Factorio server can seem overwhelming.
With the help of Meshnet, the process becomes much easier. Meshnet allows you to seamlessly connect various devices from different locations into a single virtual device network, as if they were physically on the same local area network (LAN). This eliminates the need for port forwarding and keeps your home network secure. Meshnet connects each device via encrypted network tunnels using the NordLynx protocol, ensuring the best combination of speed and security.
This guide provides step-by-step guidance on how you set up a private Factorio server on Windows, macOS, or Linux allowing you and your friends to enjoy the game together from anywhere in the world using Meshnet.
Several options are available for creating and running your own Factorio server, allowing you to choose the method that best suits your needs and preferences.
To get started quickly, you can launch your server with just a few clicks directly from the game.
Launch Factorio.
Select Multiplayer > Host new game.
Choose your game type and click Next.
If your selected game mode requires it, configure your map settings and click Next again.
In the Multiplayer server settings window, make the following changes:
In the Server name field, enter a custom name for your server.
In the Server password field, type in a secure password that other players must enter to join.
Under Visibility, ensure that only the LAN server visibility option is selected. Example
Click Play.
Once you’re loaded into the map, you can invite others to join your server. See the Connect to your Factorio server over Meshnet section for further details.
The Factorio executable supports command-line interaction, enabling you to run the server with minimal resource usage, as no graphics or audio are loaded on the server machine. Follow the steps below to deploy your server using Factorio in headless mode.
Note
Running a headless Factorio instance on Windows will prevent you from opening the game on the same computer.
Factorio server details, including settings and map preferences, are stored in multiple JavaScript Object Notation (JSON) files. These files serve as the backend for the Multiplayer server settings window accessible within the game. To get started, you’ll need to back up and modify the server settings file.
Open File explorer and navigate to the Factorio installation directory.
Open the data folder.
Create a copy of the server-settings.example.json
file and name it server-settings.json
.
Open the new server-settings.json
file using a text editor, such as Notepad.
Make the following changes to the JSON file:
Next to the "name"
and "description"
fields, change the string values to identify and describe your server.
Example
Under "visibility"
, change the "public"
field value to false
.
Next to the "game_password"
field, type in a secure password that other players must enter to join.
Example
Save your changes and close the text editor.
Open PowerShell.
Using the cd
command, navigate to the Factorio installation directory.
Example
Run the following command to create a new save file, where the server will store its progress.
Use the command below to initialize your server with the newly created save file and the previously configured settings file:
If the server is started successfully, the last few lines in PowerShell should read similar to the following:
Your server is active and ready for other players to join. For further instructions, see the Connect to your Factorio server over Meshnet section below.
Note
Detailed descriptions of the command-line parameters and additional options are available on the Factorio wiki page.
To streamline the process of starting your Factorio server, you can create a batch file. This method saves time by eliminating the need to manually enter lengthy commands into the command line each time. Simply run the script file, and it will automatically handle the server launch for you.
Take the following steps to create your server launch script file:
Open a text editor, such as Notepad.
Add the following lines to the file, replacing the placeholder <\path\to\Factorio>
with the path to the Factorio installation directory.
Example
Click File > Save As.
From the Save as type list, select All files, and use a file name with a .bat
extension. For example, factorio-server.bat
.
Choose a convenient location where the file should be saved, such as Desktop, and click Save.
Now, when you want to start your server, open the .bat
file and the following sequence of actions will take place:
A Command Prompt window will open.
The Factorio executable will launch using the specified save and settings files.
The server will initialize and start running.
The third alternative for running your server is deploying it via Docker. This approach is the most efficient, as it minimizes system resource usage by running the server in a lightweight container, eliminating the need to install the game directly on the server.
To use this method, you must have Docker and Docker Compose installed on your device. Instructions on how to download and install these tools can be found on the Docker website:
Note
Docker Compose comes pre-installed with Docker Desktop.
Firstly, you must define the instructions for the Factorio server container in the Docker Compose file.
Open PowerShell.
In your preferred location, create a new factorio_server
folder and navigate to it using the following command:
Create a docker-compose.yml
file and open it using Notepad by running:
When prompted to create the file, click Yes.
In Notepad, paste the following instructions for the Factorio server Docker container:
Ensure that the version declared in the image:
row matches the version of your game. If required, modify the version accordingly. For more information about versioning, see the Readme file of the factoriotools/factorio-docker GitHub repository.
Press Ctrl + S to save changes.
Exit Notepad.
Note
If all players connecting to the server own the Space Age expansion pack and you wish to enable it for the server, set the DLC_SPACE_AGE
value to true
in the Compose file.
Lastly, you can create and deploy your Factorio server by using the data declared in the Compose file. While in the factorio_server
directory, run the following command:
Docker will pull the Factorio server image from Docker Hub and deploy the container. Once the container is up and running, you can connect to the server, as described in the section below.
Note
If you're hosting the Factorio server using Docker on a Linux device, you must grant the local network permission for the devices connecting to it. For more information, see Common issues on Linux.
Once the Factorio server is up and running, you and your friends can connect to it for a collaborative gaming experience.
Copy the Meshnet IP address of the device hosting the Factorio server from the NordVPN app.
Launch Factorio.
Select Multiplayer > Connect to address.
In the IP address and port field, paste the copied Meshnet IP address and click Connect. Example
If required, enter the server’s password.
Within a few moments, you should be connected to the server and you can begin your factory-building journey.