Build a Minecraft server by yourself and connect to Minecraft with public network partners through cpolar intranet penetration

Today, I would like to share with you that it only takes a few simple steps to build a Minecraft server in the windwos system, and use the cpolar intranet penetration tool to expose the local service to the public network connection, so as to realize online games with friends.

1. Java environment construction

Take the windows10 system as an example, configure the java environment, build a minecraft server, and download the latest version of java

https://www.oracle.com/java/technologies/downloads/#jdk17-windows

Select exethe file, and after the download is complete, double-click the installation package to install it by default.

20230106114635

After the java installation is complete, open the folder, find java, and copy the jdk installation path. In this example, it isC:\Program Files\Java\jdk-17.0.5

20230106115401

高级系统设置Search and open the system properties in the start menu bar , click环境变量

20230106115042

click新建一个系统环境变量

20230106115738

  • Variable name: JAVA_HOME
  • Variable value: JDK installation path, in this example isC:\Program Files\Java\jdk-17.0.5

20230106115915

In the list of system variables, double-clickPath变量

20230106120755

Click New on the right, add in front of the variable name value %JAVA_HOME%\bin, and click OK

20230106123303

Whether the verification is successful: search for cmd in the start menu bar, open the command prompt, enter java -version, and the version information appears, indicating that the configuration is successful.

image-20230401233557828

2. Install Minecraft service

Download the MC server, the latest version of the server can be downloaded from the official website

https://www.minecraft.net/zh-hans/download/server/

20230106133906

3. Start Minecraft service

Enter the minecraft service jar package download directory, click the file in the upper left corner

image-20230401234113614

Open powershell and open it as an administrator

image-20230401234852919

Execute the java run command to run the jar package service

java -jar server.jar --nogui

After running, it prompts an error, which means that it is subject to the EULA. One is automatically generated when the server is run for the first time eula.txt. Open it with a text editor such as Notepad , and change eula.txtthe file to . This means that you have read and understood the content of the EULA and will abide by it when using the server. If you don't, the server will shut down as soon as you try to start it.eula=falseeula=true

image-20230401235223955

We can see the eula.txt file under the directory of the jar package
image-20230402113514171

Open the file, change it inside eula的值, truethen remember to save the file
image-20230401235417205

Then we use the above command to start and run the jar package service again, and we can see that the port is25565

image-20230401235640804

4. LAN test to connect to Minecraft server

Open the Minecraft Launcher, click to enter the game, select多人游戏

20230105164215

click添加服务器

20230105164407

  • name of server
  • Server address: fill in the local ip address + mc port number (the default is 25565), such as127.0.0.1:25565

click完成

20230105164535

After selecting the server you just created, click加入服务器

20230105165431

Then there will be no connection, because the genuine verification needs to verify the genuine account, we need to close the verification

image-20230402113417967

Check powershell and see related errors. Next, you need to modify the relevant configuration files. First, close powershell
image-20230401235503928

Find the server.properties file in the installation directory, edit
image-20230402114309235

Then make the following changes: online-mode=false (turn off genuine verification), save the changes

image-20230402113816013

Then start the server.jar service again, you can see the following prompt, indicating that the modification is successful
image-20230402113702085

Then we connect again and successfully enter the game

image-20230402114503803

5. Install cpolar intranet penetration

cpolar official website: https://www.cpolar.com/

For windows system, you can directly download the zip compressed package suitable for Windows platform from the official website, get the cpolar installation package after decompression, and then double-click the installation package to install it by default.

6. Create a tunnel mapping intranet port

After the successful installation of cpolar intranet penetration, access the cpolar web UI management interface on the browser (the default is the local port 9200), and access it in the form of [http://local ip address:9200], such as http://127.0.0.1 :9200/, and log in with the cpolar account

20230106104443

After successful login, click Tunnel Management on the left - Create Tunnel:

  • 隧道名称: You can customize the name, be careful not to duplicate the existing tunnel name
  • 协议: select tcp protocol
  • 本地地址: 25565 (Minecraft default port number)
  • 端口类型: random ephemeral TCP port
  • 地区:China vip

click创建

20230105184838

After the tunnel is successfully created, the page automatically jumps to the tunnel list page, and you can see that the status is normally displayed as activenormal online status

20230105184901

状态Click —— on the left dashboard 在线隧道列表, and you can see that the tunnel that has just been successfully created has already generated a corresponding public network address. Let’s copy it. Note that there is tcp://no need to copy it. In this example, it is3.tcp.vip.cpolar.cn:10786

20230105184936

7. Test public network remote connection

Start Minecraft, you can directly add a new server, or edit the local server just added

20230105185016

In the server address bar, enter the public network address generated by cpolar 3.tcp.vip.cpolar.cn:10786, and click Finish

20230105185052

Join the server, the public network remote connection is successful

20230105185139

8. Configure a fixed TCP port address

It should be noted that the above steps use a random temporary tcp port address, and the generated public network address is a random temporary address, which will change randomly within 24 hours. In order to facilitate the remote connection of small partners, we will configure a fixed TCP port address for it next. This address will not change, which is convenient for small partners to connect remotely without repeatedly modifying the server address every day.

To configure a fixed tcp port address, you need to upgrade cpolar to a professional package or above.

8.1 Reserve a fixed tcp address

Log in to the cpolar official website, click on the reservation on the left, find the reserved tcp address, let's reserve a fixed tcp address for Minecraft:

  • 地区: Select China VIP
  • 描述: Remarks, customizable

click保留

20230105185311

After the address is successfully reserved, the system will generate a corresponding fixed public network address. In this example 5.tcp.vip.cpolar.cn:12637, copy it

20230105185336

8.2 Configure fixed tcp address

Access port 9200 on the browser, http://127.0.0.1:9200/, log in to the cpolar web ui management interface, click the tunnel management on the left dashboard - tunnel list, find the minecraft tunnel, click on the right编辑

20230105185409

Modify the tunnel information and configure the successfully reserved fixed tcp address into the tunnel

  • 端口类型: Modify to a fixed tcp port
  • 预留的tcp地址: Fill in the successfully reserved address, in this example5.tcp.vip.cpolar.cn:12637

click更新

20230105185445

After the tunnel is successfully updated, click the status on the left dashboard - online tunnel list, find the minecraft tunnel, and you can see that the public network address has been updated to a fixed tcp address.

20230105185503

9. Use a fixed public address to connect remotely

Next, we test the remote connection using a fixed public network TCP port address

20230105185542

The public network remote connection is successful!

Now, the public network address will no longer change randomly.

20230105185616

Guess you like

Origin blog.csdn.net/m0_59281987/article/details/132492418