Remotely connect to SQL Server database without public network IP [intranet penetration]

Article directory

      • 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

1. Preface

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 (https://www.microsoft.com/en-us/sql-server/sql-server-downloads)

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 Installation Mode option, also select the desired mode. Here, I chose the Basic installation mode.

20230321091003

The next step is all the way Next to complete the installation process

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 Connect Now 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 Download button on 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 complete, unzip the downloaded file, click the .msi file, and you will be able to enter the cpolar automatic installation program. Just click Next to complete the installation.

20230321091007

20230321091008

2.3 Cpolar intranet penetration registration

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 Register button on the upper right button of the cpolar official website to enter the user registration page, and then set the user name, password and other simple items. Information, you can complete the registration of new users.

20230321091009

20230321091010

3. Local webpage 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 Reserve button on the left side of the Dashboard page, and enter the “Reserve” page of the data tunnel.

20230321091011

On the reserved page of cpolar, we find the Reserved TCP address column, 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, and it can also be understood It is a blank data tunnel (after all, the tunnel entry set here has not been associated with the output port of the local software).

20230321091012

In the Reserved TCP Address 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 address column, which will be needed when setting the cpolar client. When we no longer need this data tunnel, we can also click the x on the right to delete 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 Create Tunnel button under the Tunnel Management item to set up the local data tunnel, and connect the tunnel entry created by the cpolar cloud with the local SQL The server is connected.

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

  1. Tunnel name: 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 Microsoft SQL;
  2. Protocol: This column is the application scenario of intranet penetration, such as publishing web pages, data transmission, hardware interconnection, etc. In this example, select TCP protocol;
  3. Local Address: This column needs to fill in the output port number of SQL Server, that is, port 1433 (the default port number of SQL Server);
  4. Port Type: This column is mainly the duration of the intranet penetration data tunnel. If you intend to use it for a long time, click Fixed TCP Port; if it is only for testing or temporary use, select Random temporary TCP port (It should be noted that the fixed TCP port needs to upgrade cpolar to professional version and above)
  5. Reserved TCP address: 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 in the fixed TCP port address that we just reserved successfully.

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

20230321091015

After the local data tunnel is created, the cpolar client will automatically jump to the Tunnel List page under the Tunnel Management item.

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

20230321091016

4. Public network access test

After completing the settings of the cpolar client, we can click the Online Tunnel List page under the Status item to find the address for remote access to the local SQL Server (that is, the tunnel entrance), and we will Paste this address into different remote database management software to connect to the local 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 Host column of the connection page (remove the first tcp://, and put the colon before the port number at the end: to 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 server name column (remove the front tcp://, and put the end Change the colon “:” before the numeric port number 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.