No cloud server? Learn about intranet penetration

Intranet penetration is also called port mapping. In the simplest sentence, it is: map the private network connected to your computer to the public network, and others can access your local service through the domain name or ip you give. For specific principles, please refer to Baidu Encyclopedia.
This can achieve the effect of major vendors' cloud servers (Ali Cloud, Tencent Cloud, Baidu Cloud, Huawei Cloud, etc.), and access the server through the public network address.

Here are some websites that provide intranet penetration. The first three are the ones I have used, and they all feel pretty good (for reference only):

  1. Sunny-Ngrok : Free version, bandwidth: 10 Mbps, speed limit: 128 Kbps, current limit: unlimited, number of tunnels: 1 per protocol
  2. SAKURA FRP : Free version (requires one-yuan real-name authentication), bandwidth: 10 Mbps, speed limit: 4 Mbps, current limit: 5 GiB + speed limit flow (24 hours after entering this state, the flow will be reset and the speed limit will be restored to normal Speed ​​limit), number of tunnels: 5
  3. NATTUNNEL : Free version (the tunnel stops every day), bandwidth: 1 Mbps, speed limit: unlimited, current limit: unlimited, number of tunnels: 1
  4. Floating intranet penetration : free version, bandwidth: 5 Mbps, speed limit: 5 Mbps, current limit: 5GiB, number of tunnels: 2
  5. NATAPP : free version, bandwidth: 1 Mbps, speed limit: 1 Mbps, current limit: unlimited, number of tunnels: 0
  6. Peanut shell : free version, bandwidth: 1 Mbps, speed limit: 1 Mbps, current limit: 1GiB, number of tunnels: 2
  7. Netspan Cloud : Free version, bandwidth: 3 Mbps, speed limit: 3 Mbps, current limit: unlimited traffic for 7 days, after activation, traffic limit per month/1G, number of tunnels: 1
  8. ngrok : free version, bandwidth: unclear, speed limit: unclear, current limit: unclear, number of tunnels: 1
  9. Routerman : Free version, bandwidth: 1 Mbps, speed limit: 1 Mbps, current limit: 1GiB, number of tunnels: 2
  10. Magic tunnel : points redemption version, bandwidth: official website says 100M, speed limit: unclear, current limit: unclear, number of tunnels: unclear

Next, I will share with Sunny-Ngrok about the server setup . In fact, they are all the same. According to the official documents, it will be done slowly.

Here I briefly describe the two applications of intranet penetration, one is server construction, and the other is remote desktop construction.

The first is the server setup . Before that, we have to start the local server first. Here we take node as an example. The environment setup , static file service , local file online , and the lazy loading case used are mentioned in the previous article, here we go directly The topic

Open the local service to run the lazy loading case, and access the webpage through 127.0.0.1. I am running it under the VSCode plug-in (live server). Of course, you can also refer to the static file service to run the project under the node service. First of all, ensure that the webpage and interface are available Local operation access
My front-end port number is 5500, and the back-end interface port number is 1024

However, the Sunny-Ngrok free version only provides a tunnel with one port for the http protocol. At this time, we will use Nginx for port proxy. For Nginx configuration, please refer to the Nginx article . My configuration here is as follows

    server {
        listen       10240;#监听端口
        server_name  localhost;
        location / {
            proxy_pass http://127.0.0.1:1024/;#反向代理后端接口
        }
        location /client {
            proxy_pass http://127.0.0.1:5500/;#反向代理前端页面
        }
        
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
 
    }

At this time, by entering http://127.0.0.1:10240/client/, it will proxy to http://127.0.0.1:5500/ , and enter http://127.0.0.1:10240/ to be proxy to http:/ /127.0.0.1:1024/ under

Next, register a Sunny-Ngrok account, log in and purchase a free server, configure server settings, and finally download the penetration software

After the download is complete, click to start the tool, copy the newly created tunnel id in the tunnel management, paste it into the tunnel software, and press Enter to enter the connection interface

Refresh the tunnel management interface at this time, click to view the status, you can see the current connected ip, indicating that the intranet penetration is successful


Next, we open the gift domain name and path in the new page, such as: http://example.com/client/lazyLoad.html (example.com is the gift domain name), after opening it will prompt to enter the account password.
Enter http authentication username and password

But at this time, the interface for lazy loading request is the local 127.0.0.1, we need to modify it to http://example.com/getList?len=1000 , and finally open http://example.com/client/lazyLoad.html to display The following effect is achieved

here, and the server construction of the server's intranet penetration is completed.

Next, let's try to build a remote desktop

As before, buy a new free server and configure the tcp protocol. Here are two points to note:

  1. Locally mapped ip cannot use 127.0.0.1, but use the ip in the local area network, check the local ip in the local area network through ipconfig and copy
  2. The default port of the remote desktop is 3389

The following is the configuration of my remote desktop

tunnel management is the

same as above, just run the intranet penetration software (the reconnecting prompt may always appear , the reason is in the official website document , my solution is to kick off the tunnel management, Then connect several times)

We can use another computer or the mobile version of the remote desktop to connect to the current computer (the mobile version can go to Ku'an), the following is the effect of connecting with the mobile phone

Summary: Although the intranet penetration is cheaper than the server, you still have to consider the electricity bill and consumption of your computer, and the server needs to be on all the time, so you still have to compare, compare, and choose the solution that suits you.

Hope this article can help you

Guess you like

Origin blog.csdn.net/time_____/article/details/114664920