# How to set up a private Factorio server with Meshnet

## Introduction <a href="#introduction" id="introduction"></a>

[Factorio ](https://www.factorio.com/)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 ](https://nordvpn.com/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](https://nordvpn.com/blog/what-is-lan/) (LAN). This eliminates the need for [port forwarding](https://nordvpn.com/blog/port-forwarding/) and keeps your home network secure. Meshnet connects each device via encrypted network tunnels using the [NordLynx protocol](https://nordvpn.com/blog/nordlynx-protocol-wireguard/), 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.

## Configure your Factorio server <a href="#configure-your-factorio-server" id="configure-your-factorio-server"></a>

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.

### Method 1: Using in-game options <a href="#method-1-using-in-game-options" id="method-1-using-in-game-options"></a>

To get started quickly, you can launch your server with just a few clicks directly from the game.

1. Launch **Factorio**.
2. Select **Multiplayer** > **Host new game**.
3. Choose your game type and click **Next**.

   <div align="left"><figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FuytmdxZWipKx2UdXnTOA%2Ffactorio_game_mode.png?alt=media&#x26;token=1157c414-9a9e-4ee7-b51e-22f00ba7de80" alt="&#x22;Freeplay&#x22; game mode selected and clicking the &#x22;Next&#x22; button." width="563"><figcaption></figcaption></figure></div>

   &#x20;
4. If your selected game mode requires it, configure your map settings and click **Next** again.
5. 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.\
     &#x20;\
     **Example**

     <div align="left"><figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2Fdf88wENtCMphxXu9umQk%2Ffactorio_server_settings.png?alt=media&#x26;token=02d5c5c4-dcaa-41b2-8e90-369941ea9685" alt="Filled in server and and password fields, and the LAN option selected." width="356"><figcaption></figcaption></figure></div>

     &#x20;
6. 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](#inlineextension-connect-to-your-factorio-server-over-meshnet) section for further details.

### Method 2: Using a Factorio dedicated server <a href="#method-2-using-factorio-dedicated-server" id="method-2-using-factorio-dedicated-server"></a>

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.

{% tabs %}
{% tab title="Windows" %}
{% hint style="info" %}
**Note**

Running a headless Factorio instance on Windows will prevent you from opening the game on the same computer.
{% endhint %}

#### Prepare the server settings file <a href="#prepare-the-server-settings-file" id="prepare-the-server-settings-file"></a>

Factorio server details, including settings and map preferences, are stored in multiple [JavaScript Object Notation](https://www.json.org/json-en.html) (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.

1. Open **File explorer** and navigate to the Factorio installation directory.
2. Open the **data** folder.
3. Create a copy of the `server-settings.example.json` file and name it `server-settings.json`.
4. Open the new `server-settings.json` file using a text editor, such as Notepad.
5. 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.\
     &#x20;\
     **Example**

     <div align="left"><figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FdDnWot4pnISWvUFe5joy%2Ffactorio_win_desc_dark.png?alt=media&#x26;token=6132fbd0-9901-43af-af04-6fb1522cc04e" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FNc5orYjCUbkhrgcMEuZe%2Ffactorio_win_desc.png?alt=media&#x26;token=a99c8314-6ce2-43cd-b7ac-d6df1515e985" alt="&#x22;name&#x22; and &#x22;description&#x22; field values updated."></picture><figcaption></figcaption></figure></div>

     &#x20;
   * Under `"visibility"`, change the `"public"` field value to `false`.

     <div align="left"><figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2Fk5Uf2tqwQR6GiCRdBM1A%2Ffactorio_win_visibility_dark.png?alt=media&#x26;token=764af766-42f9-458b-92ec-3f3f82a59460" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2F0S8OTyI7XcxhHGRSwjda%2Ffactorio_win_visibility.png?alt=media&#x26;token=fb807076-5e73-4873-aca2-134decffc891" alt="&#x22;public&#x22; field value set to false."></picture><figcaption></figcaption></figure></div>

     &#x20;
   * Next to the `"game_password"` field, type in a secure password that other players must enter to join.\
     &#x20;\
     **Example**

     <div align="left"><figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FSzMR2FuzN8MjztTt3qcK%2Ffactorio_win_pwd_dark.png?alt=media&#x26;token=f9512584-6cd9-4236-b216-31082073c51e" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FF3XuZPqRKANTdZ3ra942%2Ffactorio_win_pwd.png?alt=media&#x26;token=2f409969-fc2d-434f-8add-fa3341f18495" alt="Password highlighted in the &#x22;game_password&#x22; field value."></picture><figcaption></figcaption></figure></div>

     &#x20;
6. Save your changes and close the text editor.

#### Start the server <a href="#start-the-server" id="start-the-server"></a>

1. Open **PowerShell**.
2. Using the `cd` command, navigate to the Factorio installation directory.\
   &#x20;

   **Example**

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">cd "C:\Program Files\Steam\steamapps\common\Factorio"
   </code></pre>

   &#x20;
3. Run the following command to create a new save file, where the server will store its progress.

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">.\bin\x64\factorio.exe --create .\saves\savefile.zip
   </code></pre>

   &#x20;
4. Use the command below to initialize your server with the newly created save file and the previously configured settings file:

   <pre class="language-powershell" data-overflow="wrap"><code class="lang-powershell">.\bin\x64\factorio.exe --start-server .\saves\savefile.zip --server-settings .\data\server-settings.json
   </code></pre>

   &#x20;\
   If the server is started successfully, the last few lines in PowerShell should read similar to the following:

   <div align="left"><figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2F0mZpo50uUFCnU8tnZ98j%2Ffactorio_win_start.png?alt=media&#x26;token=9c854b1b-8b56-45ab-98fb-e21a0a8e54b3" alt="PowerShell output indicating that the server has started successfully."><figcaption></figcaption></figure></div>

Your server is active and ready for other players to join. For further instructions, see the [Connect to your Factorio server over Meshnet](https://nordsec.atlassian.net/wiki/spaces/MHB/pages/13228277767/How+to+set+up+a+private+Factorio+server+with+Meshnet#connect-server) section below.

{% hint style="info" %}
**Note**

Detailed descriptions of the command-line parameters and additional options are available on the [Factorio wiki page](https://wiki.factorio.com/Command_line_parameters#Multiplayer).
{% endhint %}

#### (Optional) Automate server launch <a href="#optional-automate-server-launch" id="optional-automate-server-launch"></a>

To streamline the process of starting your Factorio server, you can create a [batch file](https://nordvpn.com/cybersecurity/glossary/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:

1. Open a text editor, such as Notepad.
2. Add the following lines to the file, replacing the placeholder `<\path\to\Factorio>` with the path to the Factorio installation directory.

   <pre class="language-batch" data-overflow="wrap"><code class="lang-batch">@echo off

   title Start your Factorio server

   echo Starting server... 
   cd /d "&#x3C;\path\to\Factorio>" 
   start /wait "" .\bin\x64\factorio --start-server .\saves\savefile.zip --server-settings .\data\server-settings.json

   pause
   </code></pre>

   &#x20;\
   **Example**

   <div align="left"><figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FEbZH4gxjgZuxD5dNrkRw%2Ffactorio_win_script_dark.png?alt=media&#x26;token=4edcc458-6e00-4c87-93b9-6fc369eb1c8b" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FccQpPJlMNpgt9ZkAwF3q%2Ffactorio_win_script.png?alt=media&#x26;token=5d486952-1854-4be4-8bf7-540c1870a07f" alt="Batch file content with path to the Factorio folder."></picture><figcaption></figcaption></figure></div>

   &#x20;
3. Click **File** > **Save As**.
4. From the **Save as type** list, select **All files**, and use a file name with a `.bat` extension. For example, `factorio-server.bat`.

   <figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FvgSaiDhzgQ27iTUamhnm%2Ffactorio_win_script_save_dark.png?alt=media&#x26;token=9add5d55-9b0d-4bdf-ab28-0d0dd3137249" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2Fu2IaxIKewQ5jwgxwmsJc%2Ffactorio_win_script_save.png?alt=media&#x26;token=4928a74a-7048-4593-97e8-562c3e73ae6c" alt="File name and type highlighted."></picture><figcaption></figcaption></figure>

   &#x20;
5. 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:

1. A Command Prompt window will open.
2. The Factorio executable will launch using the specified save and settings files.
3. The server will initialize and start running.
   {% endtab %}

{% tab title="macOS" %}
{% hint style="info" %}
**Note**

Running a headless Factorio instance on macOS will prevent you from opening the game on the same computer.
{% endhint %}

#### Prepare the server settings file <a href="#prepare-the-server-settings-file.1" id="prepare-the-server-settings-file.1"></a>

Factorio server details, including settings and map preferences, are stored in multiple [JavaScript Object Notation](https://www.json.org/json-en.html) (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.

1. Launch **Steam** and go to the **Library** tab.
2. Locate **Factorio**, right-click it, and select **Manage** > **Browse local files**.

   <div align="left"><figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FtNIu2okDpH7hHn2RQ8PD%2Ffactorio_mac_browse_files.png?alt=media&#x26;token=9d179fff-d180-4ef3-b3a5-d8ca18b01920" alt="Selecting Factorio > Manage > Browse local files in Steam." width="563"><figcaption></figcaption></figure></div>

   &#x20;
3. In the new Finder window, right-click **Factorio**, choose **Show package contents**, and navigate to **Contents** > **data**.
4. Create a copy of the `server-settings.example.json` file and name it `server-settings.json`.
5. Open the new `server-settings.json` file using a text editor, such as TextEdit.
6. 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.\
     &#x20;\
     **Example**

     <figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FCT9V9QbCpkGtaIeRxMnV%2Ffactorio_mac_desc_dark.png?alt=media&#x26;token=676b708b-3d15-485e-83ea-d36d12dd9282" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FQf5HhhGkSGJL7ZFk6pIJ%2Ffactorio_mac_desc.png?alt=media&#x26;token=da85dba2-d655-4ee6-8e32-847d54bc179e" alt="&#x22;name&#x22; and &#x22;description&#x22; field values updated."></picture><figcaption></figcaption></figure>

     &#x20;
   * Under `"visibility"`, change the `"public"` field value to `false`.

     <div align="left"><figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FY6uHtU5mhC1HLYHET0ok%2Ffactorio_mac_visibility_dark.png?alt=media&#x26;token=6b367a61-45e1-40dd-916d-5cd886a205fc" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FbqpzU3JQRNH3V1qk3LKE%2Ffactorio_mac_visibility.png?alt=media&#x26;token=e67218e4-a646-4088-bccd-f63dc88e79f0" alt="&#x22;public&#x22; field value set to false."></picture><figcaption></figcaption></figure></div>

     &#x20;
   * Next to the `"game_password"` field, type in a secure password that other players must enter to join.\
     \
     **Example**<br>

     <figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FRuMLqd0xIQlhvuLqo6Zu%2Ffactorio_mac_pwd_dark.png?alt=media&#x26;token=99e52292-ecd6-4557-b30e-44917d84b909" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FWjBo6Zuy4wAH30VMZCQT%2Ffactorio_mac_pwd.png?alt=media&#x26;token=53804916-f06a-4855-8e67-c987c9f37043" alt="Password highlighted in the &#x22;game_password&#x22; field value."></picture><figcaption></figcaption></figure>

     &#x20;
7. Save your changes and close the text editor.

#### Start the server <a href="#start-the-server.1" id="start-the-server.1"></a>

With the required files configured, you can start your server.

1. Open **Terminal**.
2. Navigate to the Factorio installation directory using the `cd` command below:

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">cd ~/Library/Application \ Support/Steam/steamapps/common/Factorio/factorio.app/Contents
   </code></pre>

   &#x20;
3. Run the following command to create a new save file, where the server will store its progress.

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">./MacOS/factorio --create ./saves/savefile.zip
   </code></pre>

   &#x20;
4. Use the provided command to initialize your server with the newly created save file and the previously configured settings file:

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">./MacOS/factorio --start-server ./saves/savefile.zip --server-settings ./data/server-settings.json
   </code></pre>

   &#x20;

   If the server is started successfully, the last few lines in Terminal should read similar to the following:

   <div align="left"><figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FfC76X0eVrgQdw2Ni3hXN%2Ffactorio_mac_start_dark.png?alt=media&#x26;token=75d4652b-2e3e-46bc-8cc5-9d291ab20ade" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FJdslhQODCCiunx9BkAHA%2Ffactorio_mac_start.png?alt=media&#x26;token=d682d3fe-ad6a-4599-a67a-671539dc8fd8" alt="Terminal output indicating that the server has started successfully."></picture><figcaption></figcaption></figure></div>

Your server is active and ready for other players to join. For further instructions, see the [Connect to your Factorio server over Meshnet](https://nordsec.atlassian.net/wiki/spaces/MHB/pages/13228277767/How+to+set+up+a+private+Factorio+server+with+Meshnet) section below.

{% hint style="info" %}
**Note**

Detailed descriptions of the command-line parameters and additional options are available on the [Factorio wiki page](https://wiki.factorio.com/Command_line_parameters#Multiplayer).
{% endhint %}
{% endtab %}

{% tab title="Linux" %}
For a more efficient server deployment on Linux, Factorio offers a lightweight, headless version specifically designed for running servers. This version eliminates the need to install the full game, focusing solely on the server functionality.

{% hint style="info" %}
**Note**

Running a headless Factorio instance on Linux may prevent you from opening the game as the same user.
{% endhint %}

#### Prepare the server settings file <a href="#prepare-the-server-settings-file.2" id="prepare-the-server-settings-file.2"></a>

Factorio server details, including settings and map preferences, are stored in multiple [JavaScript Object Notation](https://www.json.org/json-en.html) (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.

1. Visit the [Factorio downloads page](https://www.factorio.com/download) and download Factorio headless for Linux.

   <div align="left"><figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2F75m7mKNuheq50g6ilypu%2Ffactorio_linux_download.png?alt=media&#x26;token=b43d51bb-36de-427d-bc4b-8f3e7b673957" alt="Downloading the headless Factorio server for Linux." width="563"><figcaption></figcaption></figure></div>

   &#x20;
2. Using **Files**, navigate to your Downloads folder, and extract the downloaded archive to a convenient location.
3. Locate the extracted files and go to **factorio** > **data**.
4. Create a copy of the `server-settings.example.json` file and name it `server-settings.json`.
5. Open the new `server-settings.json` file using Text editor.
6. 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.\
     &#x20;

     **Example**

     <div align="left"><figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FmdGVYwCFrDuqFX3Iryz4%2Ffactorio_linux_desc_dark.png?alt=media&#x26;token=13adebd8-4a5c-4598-89f1-0609d588c47a" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FIeI2mreuxyYVxnukFupW%2Ffactorio_linux_desc.png?alt=media&#x26;token=dfb8f1c8-8d38-4f8f-9f59-747daba1411f" alt="&#x22;name&#x22; and &#x22;description&#x22; field values updated."></picture><figcaption></figcaption></figure></div>

     &#x20;
   * Under `"visibility"`, change the `"public"` field value to `false`.

     <div align="left"><figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2F7KrQSrZc0vtKrvA67JhS%2Ffactorio_linux_visibility_dark.png?alt=media&#x26;token=c1f8a440-a586-4903-985c-025fc227867e" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FWPG7RmNCNcI72YKAOEHA%2Ffactorio_linux_visibility.png?alt=media&#x26;token=02b06989-983c-4759-932c-8cd54109e21e" alt="&#x22;public&#x22; field value set to false."></picture><figcaption></figcaption></figure></div>

     &#x20;
   * Next to the `"game_password"` field, type in a secure password that other players must enter to join.\
     &#x20;

     **Example**

     <div align="left"><figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FboVdcxVUOLllr4BHDywN%2Ffactorio_linux_pwd_dark.png?alt=media&#x26;token=241d2296-0e8c-4a24-b5d3-0bafb42d960f" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FvixU9pGJoilGy560zVah%2Ffactorio_linux_pwd.png?alt=media&#x26;token=33e7b878-cf81-4cc8-96eb-ae11ebc54298" alt="Password highlighted in the &#x22;game_password&#x22; field value."></picture><figcaption></figcaption></figure></div>

     &#x20;
7. Save your changes and close Text editor.

#### Start the server <a href="#start-the-server.2" id="start-the-server.2"></a>

With the required files configured, you can start your server.

1. In the **factorio** folder, right-click and select **Open in Terminal**.&#x20;

   <div align="left"><figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FVjX5WBXVdcjz0e6KRJjG%2Ffactorio_linux_open_terminal_dark.png?alt=media&#x26;token=42f0bf78-93f2-493e-87a9-376de761c4b8" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FyLY33SqxJSWwWfhrXeGj%2Ffactorio_linux_open_terminal.png?alt=media&#x26;token=7be0391d-e2a7-4dfe-adf8-fd4ea5ebf3e4" alt="Clicking &#x22;Open in Terminal&#x22; from the context menu."></picture><figcaption></figcaption></figure></div>

   &#x20;
2. Run the following command to create a new save file, where the server will store its progress.

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">./bin/x64/factorio --create ./saves/savefile.zip
   </code></pre>

   &#x20;&#x20;
3. If the players joining your server don’t have the [Space Age expansion pack](https://wiki.factorio.com/Space_Age), you need to disable it in the mod settings before starting the server.
   * Go to the **factorio** > **mods** folder.
   * Open the `mod-list.json` file using Text editor.
   * Change the lower three `"enabled"` field values to `false`.

     <div align="left"><figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FgCY1PgW3zvV8xV0ygk6R%2Ffactorio_linux_mods_dark.png?alt=media&#x26;token=99210f0d-312b-4578-b95a-0b247541365f" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FCBajFOKEz5L9gJJhW07o%2Ffactorio_linux_mods.png?alt=media&#x26;token=441a72cc-dae1-42cd-94e5-988994e0e071" alt="" width="188"></picture><figcaption></figcaption></figure></div>

     &#x20;
   * Press **Ctrl** + **S** to save changes and then exit Text editor.
4. Back in **Terminal**, use the provided command to initialize your server with the newly created save file and the previously configured settings file:

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">./bin/x64/factorio --start-server ./saves/savefile.zip --server-settings ./data/server-settings.json
   </code></pre>

   &#x20;

   If the server is started successfully, the last few lines in Terminal should read similar to the following:

   <figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FFDqg1agiioN5AIFUZGgo%2Ffactorio_linux_start.png?alt=media&#x26;token=6c8323cd-2340-4368-9ffe-3d442a7b5e24" alt="Terminal output indicating that the server has started successfully."><figcaption></figcaption></figure>

Your server is active and ready for other players to join. For further instructions, see the [Connect to your Factorio server over Meshnet](https://nordsec.atlassian.net/wiki/spaces/MHB/pages/13228277767/How+to+set+up+a+private+Factorio+server+with+Meshnet) section below.

{% hint style="info" %}
**Note**

Detailed descriptions of the command-line parameters and additional options are available on the [Factorio wiki page](https://wiki.factorio.com/Command_line_parameters#Multiplayer).
{% endhint %}
{% endtab %}
{% endtabs %}

### Method 3: Using Docker <a href="#method-3-using-docker" id="method-3-using-docker"></a>

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.

#### Install Docker <a href="#installing-docker" id="installing-docker"></a>

To use this method, you must have [Docker](https://docs.docker.com/get-started/overview/) and [Docker Compose](https://docs.docker.com/compose/) installed on your device. Instructions on how to download and install these tools can be found on the Docker website:

* [Docker Desktop instructions for Windows](https://docs.docker.com/desktop/install/windows-install/)
* [Docker Desktop Instructions for Linux](https://docs.docker.com/desktop/install/linux-install/)
  * [Docker Engine instructions for Linux (CLI only)](https://docs.docker.com/engine/install/)
  * [Docker Compose instructions for Linux (CLI only)](https://docs.docker.com/compose/install/linux/)

{% hint style="info" %}
**Note**

Docker Compose comes pre-installed with Docker Desktop.
{% endhint %}

#### Prepare the Docker Compose file <a href="#preparing-the-docker-compose-file" id="preparing-the-docker-compose-file"></a>

Firstly, you must define the instructions for the Factorio server container in the [Docker Compose file](https://docs.docker.com/reference/compose-file/).

{% tabs %}
{% tab title="Windows" %}

1. Open **PowerShell**.
2. In your preferred location, create a new `factorio_server` folder and navigate to it using the following command:

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">mkdir factorio_server; cd factorio_serve
   </code></pre>

   &#x20;&#x20;
3. Create a `docker-compose.yml` file and open it using Notepad by running:

   <pre class="language-batch" data-overflow="wrap"><code class="lang-batch">notepad docker-compose.yml
   </code></pre>

   &#x20;

   When prompted to create the file, click **Yes**.

   <div align="left"><figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2Fmvv3WT7Gg52QS90ZJgzI%2Ffactorio_docker_notepad_dark.png?alt=media&#x26;token=f1793dcb-f093-4886-82bd-907570c617a3" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2Fxf76UJ3Zz2U4hq9B2ADu%2Ffactorio_docker_notepad.png?alt=media&#x26;token=b08bb9b0-561d-4531-a471-efc82570495e" alt="" width="245"></picture><figcaption></figcaption></figure></div>

   &#x20;
4. In **Notepad**, paste the following instructions for the Factorio server Docker container:

   <pre class="language-yaml" data-overflow="wrap"><code class="lang-yaml">services:
     factorio:
       container_name: factorio-server
       image: factoriotools/factorio:stable-2.0.23
       ports:
         - "34197:34197/udp"
         - "27015:27015/tcp"
       volumes:
        - .\factorio:/factorio
       environment:
        - DLC_SPACE_AGE=false
   </code></pre>

   &#x20;
5. 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](https://github.com/factoriotools/factorio-docker?tab=readme-ov-file#factorio---) GitHub repository.
6. Press **Ctrl** + **S** to save changes.
7. Exit **Notepad**.

{% hint style="info" %}
**Note**

If all players connecting to the server own the [Space Age expansion pack](https://wiki.factorio.com/Space_Age) and you wish to enable it for the server, set the `DLC_SPACE_AGE` value to `true` in the Compose file.
{% endhint %}
{% endtab %}

{% tab title="macOS and Linux" %}

1. Open **Terminal**.
2. In your preferred location, create a new `factorio_server` folder and navigate to it using the following command:

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">mkdir factorio_server &#x26;&#x26; cd factorio_server
   </code></pre>

   &#x20;
3. Create a `docker-compose.yml` file and open it using the Nano text editor by running:

   <pre class="language-bash" data-overflow="wrap"><code class="lang-bash">nano docker-compose.yml
   </code></pre>

   &#x20;
4. In the terminal window, paste the following instructions for the Factorio server Docker container:

   <pre class="language-yaml" data-overflow="wrap"><code class="lang-yaml">services:
     factorio:
       container_name: factorio-server
       image: factoriotools/factorio:stable-2.0.23
       ports:
         - "34197:34197/udp"
         - "27015:27015/tcp"
       volumes:
        - ./factorio:/factorio
       environment:
        - DLC_SPACE_AGE=false
   </code></pre>

   &#x20;
5. 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](https://github.com/factoriotools/factorio-docker?tab=readme-ov-file#factorio---) GitHub repository.
6. Press **Ctrl** + **X**, **Y**, and **Enter** to save changes and exit.

{% hint style="info" %}
**Note**

If all players connecting to the server own the [Space Age expansion pack](https://wiki.factorio.com/Space_Age) and you wish to enable it for the server, set the `DLC_SPACE_AGE` value to `true` in the Compose file.
{% endhint %}
{% endtab %}
{% endtabs %}

#### Deploy the Factorio server <a href="#deploying-the-factorio-server" id="deploying-the-factorio-server"></a>

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:

```bash
docker compose up -d
```

Docker will pull the Factorio server image from [Docker Hub](https://hub.docker.com/r/factoriotools/factorio/) and deploy the container. Once the container is up and running, you can connect to the server, as described in the section below.

## Connect to your Factorio server over Meshnet <a href="#inlineextension-connect-to-your-factorio-server-over-meshnet" id="inlineextension-connect-to-your-factorio-server-over-meshnet"></a>

{% hint style="info" %}
**Note**

If you're hosting the Factorio server using Docker on a Linux device, you must grant the [local network permission](https://meshnet.nordvpn.com/features/explaining-permissions/local-network-permissions) for the devices connecting to it. For more information, see [Common issues on Linux](https://meshnet.nordvpn.com/troubleshooting/linux).
{% endhint %}

Once the Factorio server is up and running, you and your friends can connect to it for a collaborative gaming experience.

1. Copy the Meshnet IP address of the device hosting the Factorio server from the NordVPN app.

   <div align="left"><figure><picture><source srcset="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FWcN8GHv2u1XwmeRwA8vX%2Ffactorio_copy_ip_dark.png?alt=media&#x26;token=7deb4b6f-23ac-48b5-a71f-7c9c57f6b8dd" media="(prefers-color-scheme: dark)"><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2Fr3RNNv7EBLPLQBVfz8s7%2Ffactorio_copy_ip.png?alt=media&#x26;token=a6fad99a-eab0-4940-ac90-40613f63d485" alt="Copying the Meshnet IP address from the NordVPN app."></picture><figcaption></figcaption></figure></div>

   &#x20;
2. Launch **Factorio**.
3. Select **Multiplayer** > **Connect to address**.
4. In the **IP address and port** field, paste the copied Meshnet IP address and click **Connect**.\
   &#x20;\
   **Example**

   <div align="left"><figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FLRATzRV7QtlCHlAeugrG%2Ffactorio_connect.png?alt=media&#x26;token=3b0b4d1f-3f22-4fa5-a276-da6dc63f2c40" alt="Entering the Meshnet IP address of the Factorio server and clicking &#x22;Connect&#x22;."><figcaption></figcaption></figure></div>

   &#x20;
5. 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.

<div align="left"><figure><img src="https://3559400189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0cTezbT2vN0lurEio8Z5%2Fuploads%2FkbPm6wfXqLCJXTJvhMmN%2Ffactorio_connected.png?alt=media&#x26;token=7e7dfc26-8e9b-4b56-b9cc-4df391bdfa00" alt="Two players loaded into the Factorio server."><figcaption></figcaption></figure></div>
