Syncthing file synchronization - free open source file automatic synchronization server and remote access to the public network [private cloud disk]

1 Introduction

In the current era of data explosion, massive amounts of data are generated every day. These data may be new photos taken in our mobile phones, file files received at work, documents edited and written by hand, or newly downloaded videos, etc. These data are quickly It can fill up smart devices (mobile phones, tablets, etc.) with worrying capacity. Because of this, cloud storage has been in the limelight for a while, not only allowing these massive data to have a place to live, but also sharing it with those who need it at any time. However, there are always many problems with the cloud disks of big manufacturers, so they can only build their own cloud disks to ensure safety.

In fact, the current private cloud disk software has been developed very well, which can not only meet the basic large-capacity storage needs, but also not be troubled by speed restrictions. Of course, some private cloud disk software can also provide many special functions. Today, the author will introduce to you how to install Syncthing, a software that can synchronize and backup data by itself, and how to cooperate with cpolar, so that we can operate Syncthing on the public Internet.

2. Syncthing website construction

Syncthing is very similar to the well-known Resilio Sync, both of which are based on P2P distributed technology, which enables real-time synchronization of files between devices (you can also choose a device to upload files only). However, from the point of view of its functional design, it may be more inclined to the "file/folder" synchronization tool, but it does not prevent us from using it as a cloud disk server tool.

2.1 Download and install Syncthing

Although Syncthing is controlled by a web page, its installation does not need to put web files into the running environment like other web deployments, but directly provides a very convenient .exe file installation method for Windows systems (why Speaking of Windows? Because the author uses Windows), we only need to download the corresponding operating system software on the download page of its official website [ https://syncthing.net/downloads/ ]. Of course, Syncthing also provides software downloads for other mainstream operating system versions.

20230428105001

20230428105002

20230428105003

Syncthing.exeAfter the Syncthing software compressed package is downloaded, decompress the compressed package, find the program in the decompressed folder , and double-click to run it. During the installation process, Windows Firewall may pop up asking, we just 允许其访问need to.

20230428105004

20230428105005

After the installation process is finished, Syncthing will automatically open the browser 8384端口(the default output port of Syncthing) and enter the main interface of Syncthing, where we can configure Syncthing, such as synchronizing content, device access, and so on.

20230428105006

On the setting page, we can also find the output port number of Syncthing, and our subsequent operation is mainly to turn this Syncthing page that can only be accessed in the LAN into a private cloud disk entrance that can be accessed on the public Internet.

20230428105007

2.2 Syncthing Webpage Test

Of course, in order to make sure that we can access the Syncthing webpage in the LAN and ensure that the Syncthing webpage is running correctly, we can conduct a small test, that is, enter the Syncthing address + port number in the incognito mode of the browser, and if the Syncthing can be accessed normally Web page, which proves that our Syncthing is working properly.

20230428105008

It should be noted that when Syncthing is not added to the Windows service list and is enabled to run in the background, it needs to keep the command line window running. If it is closed, Syncthing will terminate.

2.3 Register and install cpolar intranet penetration

After completing the installation of Syncthing, you can switch to the installation of the cpolar intranet penetration tool. Like Syncthing, the installation and registration of cpolar is also very simple. We can find the button directly on the official website of cpolar 下载.

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

20230428105009

The author uses the Windows operating system, so choose the Windows version to download.

20230428105010

After the download of Cpolar is complete, decompress the downloaded file, double-click the decompressed .msifile, and the installation program can be executed automatically. Then just go all the way Nextto complete the installation.

20230428105011

20230428105012

Since cpolar intranet penetration will create an independent data tunnel for each user, supplemented by user passwords and token codes to ensure data security, we need to register users before using cpolar. The registration process is also very simple. Just click on the upper right corner of the cpolar homepage 用户注册and fill in the necessary information on the registration page to complete the registration.

20230428105013

20230428105014

3. Local web publishing

Now, we have the Syncthing software that can run normally, and the cpolar intranet penetration that can establish an intranet penetration data tunnel. Next, we can use cpolar to create a public Internet address that can connect to the local test page. Let us Syncthing can be set up to operate on the public Internet.

3.1 Cpolar cloud settings

File syncing may be random and continuous, but cpolar free version's data tunnel resets every 24 hours. I believe that no one would want to reconnect the data tunnel every day, so you can upgrade cpolar to the VIP version in order to obtain a long-term stable intranet penetration data tunnel.

In the next step, we set about setting up the intranet penetration data tunnel. To obtain a long-term and stable intranet penetration data tunnel, you need to log in to cpolar’s ​​official website first, find the button on the left side of the user’s main page, and click to enter the cpolar 预留data Tunnel reserved page.

A public Internet address is generated here (it can also be regarded as the entrance of the data tunnel). Since this address is not connected to the local software output port at this time, it can also be regarded as a blank data tunnel.

20230428105015

On the reservation page, you can see many kinds of data tunnels that can be reserved. Here we select 保留二级子域名the field.

20230428105016

In 保留二级子域名the field, you need to make simple settings for several items of information, the setting content is:

  • 地区: The area where the server is located, just select the nearest one
  • 二级域名: Will eventually appear in the generated public Internet address as one of the identifiers of the network address
  • 描述: It can be regarded as the description of this data tunnel, which can be distinguished from other tunnels

After completing these settings, you can click 保留the button on the right to keep this data tunnel.

20230428105017

Of course, if this data tunnel is no longer intended to be used, you can click the "x" on the right to delete it easily, saving valuable tunnel quota.

20230428105018

3.2 Cpolar Local Settings

After completing the setting of the cpolar intranet to penetrate the cloud and retaining the blank data tunnel, we open the local cpolar client and connect the blank data tunnel generated by the cloud with the local test page.

After opening and logging in the cpolar client locally (you can directly access it by typing in the browser localhost:9200, or click the shortcut of the cpolar client in the start menu).

20230428105019

Click the "Create Tunnel" button under the "Tunnel Management" item on the left side of the main interface of the client to enter the local tunnel creation page (if you want to create a temporary data tunnel, you can directly set it here instead of logging in to the cpolar official website to set a blank data tunnel).

On this page, several information settings also need to be made, including:

1. 隧道名称– It can be regarded as cpolar’s ​​local tunnel information comment, as long as it is convenient for us to distinguish;
2. 协议– Since Syncthing is displayed on the web page, the http protocol is selected;
3. 本地地址– The local address is the output port number of Syncthing, and Syncthing The default output port is 8384, so fill in 8384 here;
4. 域名类型– In this example, we have reserved the data tunnel of the second-level subdomain name in the cpolar cloud, so check the "Second-level subdomain name" (if reserved If you want a custom domain name, check the custom domain name), and Sub Domainfill in the reserved second-level subdomain name in the next column, which is "Syncthingweb" in this example (if you plan to create a temporary data tunnel, directly check "random Domain name", the network address is generated by the cpolar client itself);
5. 地区– It is the same as the information reserved in the cpolar cloud, we can fill it in according to the actual use;

20230428105020

After completing these simple settings, you can click 创建the button at the bottom of the page to connect the blank data tunnel on the cpolar cloud with the local Syncthing page.

We can manage this data tunnel on the "Tunnel List" page under "Tunnel Management", including opening, closing or deleting this tunnel, or click the "Edit" button to update the information of this data tunnel to modify.

20230428105021

4. Public network access test

Finally, we can find the public Internet address of this page by clicking the button 状态under the item on the left.在线隧道列表

20230428105022

However, Syncthing has a host header check function, so we also need to make a small modification to the data tunnel of cpolar to access the local Syncthing web page on the public Internet.

We go back to 隧道管理the -- 隧道列表page, find the tunnel of "Syncthing page", and click on the right编辑

20230428105023

Go to the "Syncthing Page", click 高级the button, and edit one for this data tunnel 新的host头.

20230428105024

Click on the "Advanced" setting page, find it Host头域, and fill in the space with the address of Syncthing's local webpage, that is localhost:8384, when public Internet visitors access the local Syncthing webpage through cpolar, cpolar can be used 重写host头. After filling in, click 更新the button at the bottom of the page to save the host header changes we made.

20230428105025

After completing the setting of the host header, we go back to 在线隧道列表the page, find the public Internet address of the Syncthing page, paste this address into the browser, and we can see the local Syncthing page, allowing us to access the Syncthing page on the public Internet.

20230428105026

20230428105027

5 Conclusion

Of course, using the data tunnel created by cpolar to access the local Syncthing page is not the only use of cpolar intranet penetration. We can use cpolar intranet penetration to create any intranet penetration data tunnel pointing to the local tcp or http port, and the local web page Or the software is released to the public Internet and can be accessed normally.

Guess you like

Origin blog.csdn.net/2301_76783165/article/details/130486136