Explore intranet penetration tools: Implement public network remote access methods for LAN SQL Server databases

1 Introduction

I believe everyone is aware of the importance of the database. As an electronic folder of various data, it may contain a variety of information, ranging from corporate employee information to website access or transaction data. Even in some scenarios, Database has become one of the essential conditions for the normal operation of enterprises. Like other tasks in an enterprise, the database also requires necessary maintenance. But after the test of the mask period, it seems necessary to set up a remote operation for your own database. Today, the author will introduce to you how to use cpolar intranet penetration, remote connection and operation of SQL Server.

2. Install and set up SQL Server locally

Microsoft SQL Server is a relatively well-known relational database management software. Although it is not the most widely used, as a product of Microsoft, it has good compatibility with its own Windows series operating systems, so it is very suitable for application in various Windows systems. operating system hardware and assumes the responsibility of data management software.

2.1 SQL Server download

Since SQL Server is produced by Microsoft, you can easily find the download on Microsoft's official website ( https://www.microsoft.com/en-us/sql-server/sql-server-downloads )

20230321091001

Click on the required version to download (I chose Developer), double-click the downloaded .exe file, and you can install it automatically.

20230321091002

In 安装模式the options, select the desired mode as well. Here, the author chose 基本the installation mode.

20230321091003

The next step is Nextto complete the installation process all the way

2.2 SQL Server local connection test

After completing the installation, SQL Server will automatically transfer to the operation interface. Here we click 立即连接the button below.

20230321091004

At this time, the SQLCMD command line window will pop up. As long as the displayed content is as shown in the figure below, our local SQL Server installation is complete.

20230321091005

2.3 Download and installation of Cpolar intranet penetration

Next, we continue to install the key software for remote connection to SQL Server: [Cpolar] ( Blog - cpolar Jidian Cloud ). Like Microsoft SQL Server, we can log in to Cpolar's official website ( www.cpolar.com ), click 下载the button at the top of the homepage, enter the cpolar download page, and download the required version of cpolar software. Of course, we choose the Windows version to download here.

20230321091006

After the Cpolar download is completed, unzip the downloaded file and click on the .msi file to enter the cpolar automatic installation program. The Nextinstallation can be completed in just one step.

20230321091007

20230321091008

2.3 Registration for Cpolar intranet penetration

Since cpolar distinguishes registered users, it creates a separate data tunnel for each user (whether free or paid), supplemented by an independent password and token code for each user, to ensure user data security. Therefore, before we use cpolar, we need to register. The registration process is also very simple. Just click the button on the upper right corner of the cpolar official website to enter the user 注册registration page, and then set a few simple information such as user name and password to complete the registration of the new user. register.

20230321091009

20230321091010

3. Local web publishing

At this time, we installed SQL Server and cpolar on the local computer. Next, we can use cpolar intranet penetration to create a data tunnel that can directly connect to the local SQL Server from the public Internet to achieve the purpose of remote access to SQL Server.

It should be noted that the data tunnel address set by the free version of cpolar is reset on a 24-hour cycle, while the VIP version can create a long-term stable data tunnel address that does not change. But we don’t know when we will need to connect to the database remotely (the author suffered a big loss due to temporary epidemic control), so I upgraded cpolar to the VIP version in order to create a long-term stable data tunnel.

3.1 Cpolar cloud settings

First, we log in to the cpolar client, 仪表台find 预留the button on the left side of the page, and enter the "Reservation" page of the data tunnel.

20230321091011

On the reserved page of cpolar, we find 保留的TCP地址the field and set a public network address for the SQL Server we want to connect to. This address can be regarded as the entrance to the data tunnel, or it can also be understood as a blank data tunnel (after all, the tunnel entrance is set here There are no output ports associated with local software yet).

20230321091012

In 保留的TCP地址the fields, we only need to make two simple settings:

  • Region: that is, the region where the server is located, we can just choose the nearest one
  • Description: Can be regarded as the annotation of this data tunnel, as long as it is easy to distinguish

20230321091013

After completing these two settings, you can click the "Reserve" button on the right to fix the entrance to this data tunnel.

20230321091014

Here we need to 地址copy the content of the field. This address will be needed when setting up the cpolar client. When we no longer need this data tunnel, we can also click on the right to xdelete this reserved tunnel to save precious tunnel quota.

The free version of the temporary data tunnel does not need to be set up on the cpolar cloud and can be set up directly on the cpolar client. However, it is not possible to set up a data tunnel that can exist stably for a long time.

3.2 Cpolar local settings

Next, we return to the cpolar client installed on the local computer (you can click the shortcut from the start menu, or you can directly enter localhost:9200 in the browser to access). On the left side of the cpolar client, we click the button 隧道管理under the item 创建隧道to set up the local data tunnel and connect the tunnel entrance created by cpolar cloud with the local SQL Server.

Of course, if you want to create a data tunnel, you still need to make some settings, specifically:

  1. 隧道名称: This column can also be regarded as the remarks of the data tunnel, used to distinguish it from other locally created tunnels. Here we enter 微软SQL;
  2. 协议: This column is the application scenario for intranet penetration, such as publishing web pages, data transmission, hardware interconnection, etc., selected in this example TCP协议;
  3. 本地地址: This column needs to be filled in with the output port number of SQL Server, that is, the port 1433(the default port number of SQL Server);
  4. 端口类型: This column is mainly the duration of the intranet penetration data tunnel. Click it if you plan to use it for a long time 固定TCP端口; if it is just for testing or temporary use, select it 随机临时TCP端口(it should be noted that fixed TCP ports require upgrading cpolar to the professional version and above)
  5. 预留的TCP地址: This field is limited to users who have selected "Fixed TCP Port". If the "Random Temporary TCP Port" option is checked, this field will not appear. Fill us out just now 保留成功的固定TCP端口地址.

After completing these settings, you can click the button below 创建to connect the blank data tunnel reserved in the cpolar cloud with the local SQL output port.

20230321091015

After completing the creation of the local data tunnel, the cpolar client will automatically jump to the page 隧道管理under the item 隧道列表.

Here, we can clearly see the operation status of all data tunnels (whether they are online or disconnected normally), and perform operations on a certain data tunnel, such as starting, stopping or deleting. If we want to perform operations on existing data tunnels, For information changes, you can also find the editing entrance here.

20230321091016

4. Public network access test

After completing the settings of the cpolar client, we can click on the page 状态under the item 在线隧道列表to find the address for remote access to the local SQL Server (that is, the tunnel entrance). We paste this address into different remote database management software to connect to the local on SQL Server.

20230321091017

For example, under the Windows command line (the first tcp:// of the public network address does not need to be copied)

sqlcmd -s 公网地址:公网端口号

20230321091018

Or use the Navicat tool 主机to fill in the address generated by cpolar in the field of the connection page (remove the first tcp://, and change the colon before the last numeric port number to a comma )

20230321091019

In the same way, we can also use the SSMS graphical interface for remote connection. Also in the connection interface, paste the address generated by cpolar into the field 服务器名称(remove the tcp:// at the front, and replace the colon ":" before the numeric port number at the end) Change to comma ",") to connect to the SQL Server on the local computer.

20230321091020

5 Conclusion

At this point, we have completed the remote login settings for the local Microsoft SQL Server, and using the address generated by cpolar, we can log in to the SQL Server from multiple database management software, which greatly increases the convenience of our work.

Insert image description here

Guess you like

Origin blog.csdn.net/cdtu_mid/article/details/132538166