Minecraft: Difference between revisions
Discussed latency penalty |
Wrote troubleshooting steps for connection failures |
||
| (6 intermediate revisions by the same user not shown) | |||
| Line 9: | Line 9: | ||
* Some sort of internet access | * Some sort of internet access | ||
== Step 1: Configure your firewall == | |||
Ensure you have a firewall program installed, and configure it so that only the desired ports are exposed. If you're using SSH, avoid exposing it to the internet unless you're willing to secure it against constant attack. Open port 25565 to TCP traffic to allow connections to your Minecraft server. For more information on firewall configuration, see [[Firewalling Basics]]. | |||
== Step 2: Set up 44Net Connect tunnel == | |||
Next, set up a single device tunnel on the machine that will host your Minecraft server. Go to the [[https://wiki.ampr.org/wiki/44Net_Connect/Single_Device_Tunnel#Tutorials list of single device tunnel tutorials]] and follow the one for your operating system. | |||
== Step 3: Set up your Minecraft server == | |||
=== Download the server jar === | |||
Download a Minecraft server jar file [https://www.minecraft.net/en-us/download/server from the official Minecraft website], and put it in its own folder. When you run the jar file, other server files will be generated in this folder. The official website recommends starting it with the following command: | |||
<code>java -Xmx4G -Xms4G -jar <server jar name>.jar nogui</code> | |||
The flag <code>-Xms4G</code> sets the minimum memory allocation to 4 gigabytes, and the flag <code>-Xmx4G</code> sets the maximum memory allocation to 4 gigabytes. This allocation should always be at least 1 gigabyte less than the amount of memory in your entire system, as the operating system needs some memory for itself. If you have exactly 4 GB of RAM, decrease the amount allocated in these flags. If you have more memory, you can set them higher, but it's not required. Setting them to be the same forces the memory allocation to be a fixed size, which improves performance by avoiding the need to request more memory in real time. | |||
=== Configure the server === | |||
The first time you start the server, it will tell you to agree to the End User License Agreement and create the <code>eula.txt</code> file, then quit. Read the [https://www.minecraft.net/en-us/eula Minecraft End User License Agreement], then change the last line of the <code>eula.txt</code> file from <code>eula=false</code> to <code>eula=true</code>. | |||
Since your server will be exposed to the internet, you may want to enable the whitelist to prevent random people from joining. To do this, edit the <code>server.properties</code> text file, and set <code>enforce-whitelist=true</code> as well as <code>white-list=true</code>. Each player who wants to join will need to be added to the whitelist by running the command <code>whitelist add <username></code> in the server console or in the client of a server operator. Add someone as an operator by running <code>op <username></code>, and remove them by running <code>deop <username></code>. | |||
After configuring the server, start it up again using the command specified in the previous section. Test connectivity by joining via the address of your 44Net Connect tunnel, which is visible in the 44Net Connect tunnels page, or in the configuration file for your tunnel. | |||
== Troubleshooting == | |||
=== Can't connect to Minecraft server from either LAN or 44Net === | |||
Check that the port for your Minecraft server is opened in the firewall. If using a firewall such as <code>firewalld</code> that allows interfaces to be moved between zones, ensure the rules have been added to the zones containing your LAN and WireGuard interfaces. | |||
=== Minecraft server is only accessible over LAN, not 44Net === | |||
Ensure that your 44Net tunnel is up. On Linux systems, check its status with <code>systemctl status <name of systemd unit</code>. The default <code>systemd</code> unit name for a WireGuard tunnel started with <code>wg-quick</code> is <code>wg-quick@wg0</code>. Also check the 44Net Connect tunnels page to see if the endpoint thinks your tunnel is connected. The webpage can take a few minutes to update after the tunnel is enabled. If after a few minutes, the device and endpoint still disagree on whether your tunnel is up, you may have configuration issues. Make sure your IPv4 address in the configuration file is set to a /32, not a /24, as this can prevent the endpoint from updating the status page properly. | |||
If the tunnel is up and you're still having issues, double check your firewall configuration. <code>firewalld</code> users should make sure port 25565 is open in the zone(s) containing the LAN and WireGuard interfaces. (The recommended configuration is to place the WireGuard interface for your tunnel in a less permissive zone for security purposes.) | |||
[[Category:Use Cases]] | [[Category:Use Cases]] | ||
Latest revision as of 19:31, 27 August 2026
If you want to host a Minecraft server, but are behind CGNAT or can't port forward for other reasons, 44Net Connect will let you make your server publicly accessible. This will add latency, since connections are routed first through the 44Net Connect endpoint and then to your Minecraft server. This latency can be minimized by picking a 44Net Connect node physically close to you and your players.
Prerequisites:
- 44Net Portal account
- Verified callsign
- Configuration file from 44Net Connect
- Some sort of internet access
Step 1: Configure your firewall
Ensure you have a firewall program installed, and configure it so that only the desired ports are exposed. If you're using SSH, avoid exposing it to the internet unless you're willing to secure it against constant attack. Open port 25565 to TCP traffic to allow connections to your Minecraft server. For more information on firewall configuration, see Firewalling Basics.
Step 2: Set up 44Net Connect tunnel
Next, set up a single device tunnel on the machine that will host your Minecraft server. Go to the [list of single device tunnel tutorials] and follow the one for your operating system.
Step 3: Set up your Minecraft server
Download the server jar
Download a Minecraft server jar file from the official Minecraft website, and put it in its own folder. When you run the jar file, other server files will be generated in this folder. The official website recommends starting it with the following command:
java -Xmx4G -Xms4G -jar <server jar name>.jar nogui
The flag -Xms4G sets the minimum memory allocation to 4 gigabytes, and the flag -Xmx4G sets the maximum memory allocation to 4 gigabytes. This allocation should always be at least 1 gigabyte less than the amount of memory in your entire system, as the operating system needs some memory for itself. If you have exactly 4 GB of RAM, decrease the amount allocated in these flags. If you have more memory, you can set them higher, but it's not required. Setting them to be the same forces the memory allocation to be a fixed size, which improves performance by avoiding the need to request more memory in real time.
Configure the server
The first time you start the server, it will tell you to agree to the End User License Agreement and create the eula.txt file, then quit. Read the Minecraft End User License Agreement, then change the last line of the eula.txt file from eula=false to eula=true.
Since your server will be exposed to the internet, you may want to enable the whitelist to prevent random people from joining. To do this, edit the server.properties text file, and set enforce-whitelist=true as well as white-list=true. Each player who wants to join will need to be added to the whitelist by running the command whitelist add <username> in the server console or in the client of a server operator. Add someone as an operator by running op <username>, and remove them by running deop <username>.
After configuring the server, start it up again using the command specified in the previous section. Test connectivity by joining via the address of your 44Net Connect tunnel, which is visible in the 44Net Connect tunnels page, or in the configuration file for your tunnel.
Troubleshooting
Can't connect to Minecraft server from either LAN or 44Net
Check that the port for your Minecraft server is opened in the firewall. If using a firewall such as firewalld that allows interfaces to be moved between zones, ensure the rules have been added to the zones containing your LAN and WireGuard interfaces.
Minecraft server is only accessible over LAN, not 44Net
Ensure that your 44Net tunnel is up. On Linux systems, check its status with systemctl status <name of systemd unit. The default systemd unit name for a WireGuard tunnel started with wg-quick is wg-quick@wg0. Also check the 44Net Connect tunnels page to see if the endpoint thinks your tunnel is connected. The webpage can take a few minutes to update after the tunnel is enabled. If after a few minutes, the device and endpoint still disagree on whether your tunnel is up, you may have configuration issues. Make sure your IPv4 address in the configuration file is set to a /32, not a /24, as this can prevent the endpoint from updating the status page properly.
If the tunnel is up and you're still having issues, double check your firewall configuration. firewalld users should make sure port 25565 is open in the zone(s) containing the LAN and WireGuard interfaces. (The recommended configuration is to place the WireGuard interface for your tunnel in a less permissive zone for security purposes.)