为了完全基于开源方法实现内网主机的网页端远控,采用 FRP + “公网主机”进行内网穿透,采用 noVNC 进行网页端远控,实测无卡顿。
FRP 部署
FRP 服务端部署
docker-compose.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
|
version: "3.0"
services:
frps:
image: snowdreamtech/frps
container_name: frps
ports:
- "20300:7000"
- "20310:80"
- "20320:7500"
- "20390:20390"
volumes:
- ./frps.toml:/etc/frp/frps.toml
|
frps.toml
1
2
3
4
5
6
7
8
9
|
bindPort = 7000 # 服务器端口
vhostHTTPPort = 80 # http代理端口
vhostHTTPSPort = 443 # https代理端口,不需要可以忽略
auth.method = "token" # 鉴权方式
auth.token = "authpwd" # 客户端连接需要的密码
webServer.port = 7500 # 控制台端口
webServer.addr = "0.0.0.0" # 可访问控制台的ip
webServer.user = "admin" # 控制台账号
webServer.password = "123456" # 控制台密码
|
FRP 客户端部署
Releases · fatedier/frp (github.com)
解压后,仅使用包含 frpc 的文件。
配置 frpc.toml
1
2
3
4
5
6
7
8
9
10
11
|
serverAddr = "39.107.111.206"
serverPort = 20300
auth.method = "token"
auth.token = "authpwd"
[[proxies]]
name = "test-http"
type = "tcp"
localIP = "127.0.0.1" # 需要暴露的服务的IP
localPort = 6080 # 将本地9000端口的服务暴露在公网的6060端口
remotePort = 20390 # 暴露服务的公网入口
|
启动服务
VNC 部署
Ubuntu VNC配置
桌面右上角三角符号 - setting - Sharing - Screen Sharing - 开启 - Require a password
如果没有 Screen Sharing 选项,则执行以下命令
1
2
3
4
5
6
7
8
|
sudo apt install vino
# 关闭共享加密策略
gsettings set org.gnome.Vino require-encryption false
# 关闭共享加密策略-方法二(未测试)
sudo apt-get install dconf-editor
dconf write /org/gnome/desktop/remote-access/require-encryption false
|
noVNC 部署
1
2
3
4
5
6
|
# 拉取项目
git clone https://github.com/novnc/noVNC.git
# 启动
cd noVNC
./utils/novnc_proxy --vnc localhost:5900
|