Public network remote access to LAN SQL Server database [no public network IP intranet penetration]

Table of contents

1 Introduction

2. Install and configure SQL Server locally

2.1 SQL Server download

2.2 SQL Server local connection test

2.3 Download and installation of Cpolar intranet penetration

2.3 Registration of Cpolar intranet penetration

3. Local web publishing

3.1 Cpolar cloud settings

3.2 Cpolar Local Settings

4. Public network access test

5 Conclusion


Forwarded from the article of CSDN remote penetration: No need for public network IP, remote connection to SQL Server database [intranet penetration]

1 Introduction

I believe everyone understands the importance of the database. As an electronic folder of various data, it may contain all kinds of information, from enterprise employee information to website access or transaction data. In some scenarios, Database has become one of the indispensable conditions for the normal operation of enterprises. Like everything else in a business, databases require necessary maintenance. But after the test of the mask era, it is necessary to set up a remote operation for our 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 configure SQL Server locally

Microsoft SQL Server is a relatively well-known relational database management software. Although it is not the most widely used, it is produced by Microsoft and has good compatibility with its own Windows series operating systems, so it is very suitable for applications in various Windows installations. Operating system hardware, and assume 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 ( SQL Server Downloads | Microsoft )

20230321091001

Click the required version to download (the author chose Developer), double-click the downloaded .exe file, and then it can be installed automatically.

20230321091002

In 安装模式the options, also select the desired mode. Here, the author chooses 基本the installation mode.

20230321091003

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

2.2 SQL Server local connection test

After the installation is complete, SQL Server will automatically switch to the operation interface, where we click 立即连接the button below.

20230321091004

At this time, the SQLCMD command line window will pop up. As long as the display content is as shown in the figure below, it means that 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. 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 download of Cpolar is complete, unzip the downloaded file, click the .msi file, and you will be able to enter the automatic installation program of cpolar, and the Nextinstallation can be completed as long as you go all the way.

20230321091007

20230321091008

2.3 Registration of Cpolar intranet penetration

Since cpolar distinguishes registered users, it creates a separate data tunnel for each user (whether it is free or paid), supplemented by each user's independent password and token code, so as to ensure the user's 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 button 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 new users. register.

20230321091009

20230321091010

3. Local web publishing

At this time, we have installed SQL Server and cpolar on the local computer, and then 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 every 24 hours, while the VIP version can create a long-term stable data tunnel address. But we don't know when we will need to connect to the database remotely (the author has suffered a lot due to the temporary control of the epidemic), 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 of the data tunnel, or it can be understood as a blank data tunnel (after all, the tunnel entrance set here output ports that have not yet been associated with local software).

20230321091012

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

  • Region: the region where the server is located, we can choose the nearest one

  • Description: It can be regarded as the comment of this data tunnel, as long as it is convenient to distinguish

20230321091013

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

20230321091014

Here we need to 地址copy the content of the field, and this address will be needed when setting 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 directly on the cpolar client, but it is also impossible to set up a data tunnel that can exist stably for a long time.

3.2 Cpolar Local Settings

Then, we go back 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 the 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 a remark of the data tunnel, which is used to distinguish it from other locally created tunnels, here we enter 微软SQL;

  2. 协议: This column is the application scenario of intranet penetration, such as publishing web pages, data transmission, hardware interconnection, etc., select in this example TCP协议;

  3. 本地地址: This column needs to be filled 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 if you plan to use it for a long time 固定TCP端口; if it is only for testing or temporary use, select it 随机临时TCP端口(it should be noted that the fixed TCP port needs to upgrade 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 out what we just did 保留成功的固定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 the creation of the local data tunnel is completed, the cpolar client will automatically jump to the page 隧道管理under the item 隧道列表.

Here, we can clearly see the running status of all data tunnels (whether they are online or disconnected), and operate on a certain data tunnel, such as start, stop or delete, if you want to modify the existing data tunnel Information changes, the edit entry can also be found here.

20230321091016

4. Public network access test

After completing the setting of the cpolar client, we can click the page 状态under the item 在线隧道列表to find the address of remote access to the local SQL Server (that is, the tunnel entrance). We paste this address into different remote database management software, and then we can connect to the local SQL Server. 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 public network address: public network port number

20230321091018

Or use the Navicat tool, 主机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 digital port number to a comma )

20230321091019

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

20230321091020

5 Conclusion

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

Guess you like

Origin blog.csdn.net/m0_64550837/article/details/129958787