Article directory
- 1. Java environment construction
- 2. Install Minecraft service
- 3. Start Minecraft service
- 4. LAN test to connect to Minecraft server
- 5. Install cpolar intranet penetration
- 6. Create a tunnel mapping intranet port
- 7. Test public network remote connection
- 8. Configure a fixed TCP port address
- 9. Use a fixed public address to connect remotely
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 exe
the file, and after the download is complete, double-click the installation package to install it by default.
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
高级系统设置
Search and open the system properties in the start menu bar , click环境变量
click新建一个系统环境变量
- Variable name: JAVA_HOME
- Variable value: JDK installation path, in this example is
C:\Program Files\Java\jdk-17.0.5
In the list of system variables, double-clickPath变量
Click New on the right, add in front of the variable name value %JAVA_HOME%\bin
, and click OK
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.
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/
3. Start Minecraft service
Enter the minecraft service jar package download directory, click the file in the upper left corner
Open powershell and open it as an administrator
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.txt
the 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=false
eula=true
We can see the eula.txt file under the directory of the jar package
Open the file, change it inside eula的值
, true
then remember to save the file
Then we use the above command to start and run the jar package service again, and we can see that the port is25565
4. LAN test to connect to Minecraft server
Open the Minecraft Launcher, click to enter the game, select多人游戏
click添加服务器
- name of server
- Server address: fill in the local ip address + mc port number (the default is 25565), such as
127.0.0.1:25565
click完成
After selecting the server you just created, click加入服务器
Then there will be no connection, because the genuine verification needs to verify the genuine account, we need to close the verification
Check powershell and see related errors. Next, you need to modify the relevant configuration files. First, close powershell
Find the server.properties file in the installation directory, edit
Then make the following changes: online-mode=false (turn off genuine verification), save the changes
Then start the server.jar service again, you can see the following prompt, indicating that the modification is successful
Then we connect again and successfully enter the game
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
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创建
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 active
normal online status
状态
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
7. Test public network remote connection
Start Minecraft, you can directly add a new server, or edit the local server just added
In the server address bar, enter the public network address generated by cpolar 3.tcp.vip.cpolar.cn:10786
, and click Finish
Join the server, the public network remote connection is successful
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保留
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
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编辑
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更新
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.
9. Use a fixed public address to connect remotely
Next, we test the remote connection using a fixed public network TCP port address
The public network remote connection is successful!
Now, the public network address will no longer change randomly.