一、前提条件
1.公网IP(公有云IP即可)、没有公网IP的内网nas。
2.frp 客户端、服务端版本为:0.57.0
二、搭建过程
1.使用frp搭建内网穿透
内网nas 使用frp docker 镜像搭建客户端。首先拉取镜像,建议选择star 数量最多的那个。
docker pull snowdreamtech/frpc
在docker文件夹中新建一个frp专用文件夹,并将创建好的配置文件放到该目录内作为客户端配置。
frpc.toml
serverAddr = "公网IP/公有云IP"
serverPort = 5000 #服务端监听端口
auth.method = "token" # 认证
auth.token = "123456" # 认证可自定义
[[proxies]]
name = "synology-web"
type = "http"
localPort = 5000 # 客户端本地监听
localIP = "127.0.0.1"
customDomains = ["公网IP/域名"]
transport.useEncryption = true
transport.useCompression = true
httpUser = "username" # web认证用户可自定义
httpPassword = "password" # 密码
使用群晖套件中docker 启动镜像。
使用最高权限执行镜像-》高级选项-》启用自动重新启动-》存储空间中添加文件(docker/frp/frpc.toml /etc/frp/frpc.toml)-》网络勾选与docker host相同网络-》应用启动docker容器。
2.公有云服务端配置
下载frp服务端(当前我用的是0.57.0):
https://github.com/fatedier/frp/releases?page=1
选择amd64版本包。
解压到磁盘任意路径。进入frp文件位置。
编辑frps.toml
bindPort = 5000 # 本机监听端口
vhostHTTPPort = 80 # http服务端口
auth.method = "token" # 认证方式
auth.token = "123456" # 认证token
启动server
./frps -c frps.toml &
如果有多个nas需要穿透,参考如下文章进行配置:
https://blog.csdn.net/baidu_33388963/article/details/137006776
评论区