Exposing local web applications or APIs to the public internet for remote debuggging or hosting can be achieved through a free NAT tunneling solution.
This method allows developers to make their local services accessible over the internet without requiring a public IP address. It also enables users to repurpose idle machines or servers for hosting internet-facing services.
Seetting Up the Tunnel VKey
The service provider offers a free backend, so users only need to install and configure the client-side application.
1. Access the Management Portal
Navigate to the management portal using either of the following methods:
- Visit https://www.xujian.tech/monitor
- Or scan the QR code displayed on the page to access the "数字续坚" mini-program.
If the login fails, retry the process.
2. View Tunnel Information
Once logged in, click on "NAT Tunnel List" from the left sidebar. You will see a list of tunnels including their name, access URL, vkey, target host, traffic usage, and connection status.
3. Create or Modify a Tunnel
Select the appropriate protocol (e.g., HTTP for web services). For custom subdomains, contact the administrator (xujian_cq) to request one, ensuring it's registered with Alibaba Cloud.
4. Confirm Configuration
After saving the configuration, return to the list view. The vkey generated here is essential for setting up the client and should be kept secure.
Installing the Client
1. Download the NPC Client
Download the client from:
https://www.xujian.tech/raw/npc.zip
Alternatively, use the Baidu Netdisk link:
链接:https://pan.baidu.com/s/1kmZkVzIleO7i0Y6H7wo4fg
提取码:3wno
2. Extract and Configure
Extract the archive. Note that antivirus software might flag the executable due to its nature; add an exception if necessary.
Edit the configuration file conf/npc.conf to match the following:
[common]
server_addr=nat.xujian.tech:8024
conn_type=tcp
vkey=${YOUR_VKEY}
auto_reconnection=true
max_conn=1000
flow_limit=1000
rate_limit=1000
crypt=true
compress=true
disconnect_timeout=60
Replace ${YOUR_VKEY} with the value obtained in the previous step.
3. Launch the Client
Double-click npc.exe to start the client. A successful startup will show the service running in the interface.
At this point, the configured service is acessible via the internet.
Testing the Setup
1. Local Access
Ensure the local service is working before proceeding.
2. Internet Access
Access the service using the domain name associated with your tunnel from the first step.
Advanced Options
For advanced features, reach out to the administrator via WeChat (xujian_cq).