QNAP builds Frp to achieve intranet penetration

1. Background

For unknown reasons, China Unicom has stopped the personal dynamic public IP of the entire province, so I need to find another way to access my NAS.

There are several ways to do this by searching online:

  • Use peanut shells or other ddns services
  • Use the open source frp solution

Inquired about the service charges for peanut shells as follows:

image-20220321202518926

368 yuan a year is not expensive, but the rate is only 1Mbps , converted to 128K/s, which is really too slow.

Frp needs to configure the server side by itself, and there are also third-party developers who provide free server side, such as: Free FRP Free FRP intranet penetration

At present, the price of domestic servers is relatively cheap, for example: [Tencent Cloud] Explosive 2-core 2G cloud server costs 40 yuan for the first year, and the company can get a maximum of 300 yuan JD Card for the first purchase

image-20220321203407987I bought the 2-core 4G package in the picture above. The 6Mbps bandwidth is calculated as 0.75M/s, which is not bad for daily use. You can use the LAN to synchronize large files after you get home.

2. Configure Frp Server

According to the instructions on the official website, modify the frps.ini file as follows:

[common]
bind_port = 443
token=[自己设置一个Token]

vhost_http_port = 80
vhost_https_port = 443

# 服务端 Dashboard 
dashboard_port = 7400
# dashboard 用户名密码,可选,默认为空
dashboard_user = admin
dashboard_pwd = admin

# TCP 多路复用 
tcp_mux = false
# 连接池上限
max_pool_count = 5

Then start the server according to the instructions:

./frps -c ./frps.ini

If you see the command line output as follows, it means that the server is started successfully:

C:\Users\Administrator\Downloads\frp_0.39.1_windows_amd64>frps.exe -c frps.ini
2022/03/21 20:43:09 [I] [root.go:200] frps uses config file: frps.ini
2022/03/21 20:43:09 [I] [service.go:193] frps tcp listen on 0.0.0.0:443
2022/03/21 20:43:09 [I] [service.go:236] http service listen on 0.0.0.0:80
2022/03/21 20:43:09 [I] [service.go:292] Dashboard listen on 0.0.0.0:8081
2022/03/21 20:43:09 [I] [root.go:209] frps started successfully

3. Install the client

Open QNAP's ContainerStation, enter: in the Create interface stilleshan/frpc, and search as follows:

image-20220321204704454

Click the install button to select the latest version

image-20220321204734521

Then click on Advanced Setting

image-20220321204857268

Network settings set bit host :

image-20220321204938116

Then the shared folder section is set as follows:

image-20220321205101387

The NAS directory is as follows:

image-20220321205218415

Then click create and wait for the creation to complete

4. Configure Frp client

Open the directory just configured on the NAS, upload the Frp project file, and edit the frpc.ini file:

[common]
server_addr = 服务器的ip
server_port = 服务器的 bind_port
token=服务器的token

# Admin UI 管理界面配置
admin_addr = 127.0.0.1
admin_port = 7400
admin_user = admin
admin_pwd = admin

# TCP 多路复用 
tcp_mux = false

# 连接池上限
max_pool_count = 1

[nas]
type = http
local_ip=127.0.0.1
local_port=80
custom_domains = 你的nas的域名

[nas_https]
type = https
custom_domains = 你的nas的域名
plugin = https2http
plugin_local_addr = 127.0.0.1:80
# HTTPS 证书相关的配置
# 在上图的 ssl 文件夹存放 你的证书 key 和 crt 或者 key 和 pem文件
plugin_key_path = /frp/ssl/nas.key
plugin_crt_path = /frp/ssl/nas.crt
plugin_host_header_rewrite = 127.0.0.1
plugin_header_X-From-Where = frp

Start frpc and check the results as follows, it is normal:

2022/03/21 20:43:10 [I] [service.go:175] [5f8e02cd963489f2] try to reconnect to server...
2022/03/21 20:43:10 [I] [service.go:327] [5f8e02cd963489f2] login to server success, get run id [5f8e02cd963489f2], server udp port [0]
2022/03/21 20:43:10 [I] [proxy_manager.go:144] [5f8e02cd963489f2] proxy added: [nas nas_https]
2022/03/21 20:43:10 [I] [control.go:181] [5f8e02cd963489f2] [nas] start proxy success
2022/03/21 20:43:10 [I] [control.go:181] [5f8e02cd963489f2] [nas_https] start proxy success

Then enter the domain name test result you just set up:

image-20220321205941908

5. Epilogue

Special thanks to Siyouyun - IOIOX - personal blog for the Dockers image and technical support.

Stille's blog:思有云- IOIOX - Personal blog

The Docker image address used: Docker Hub

If you have any questions about mirroring, please add an issue on GitHub: stilleshan/frpc

Guess you like

Origin blog.csdn.net/DevWiki/article/details/127850746