cloudflared 可以创建内网隧道,实测比frp稳定很多,也快很多。不仅可以创建vnc和ssh也可以反向代理web网页。
创建vnc server
vi .config/systemd/user/x0vncserver.service
[Unit]
Description=Remote desktop service (VNC)
[Service]
Type=simple
# wait for Xorg started by ${USER}
ExecStartPre=/bin/sh -c 'while ! pgrep -U root Xorg; do sleep 2; done'
ExecStart=/usr/bin/x0vncserver -rfbauth %h/.vnc/passwd
# or login with your username & password
#ExecStart=/usr/bin/x0vncserver -PAMService=login -PlainUsers=root -SecurityTypes=TLSPlain
[Install]
WantedBy=default.target
systemctl --user enable --now x0vncserver.service
下载cloudflared
创建tunnel
cloudflared tunnel login
sudo cloudflared tunnel create ${tunnel_name}
vi /etc/cloudflared/config.yml
tunnel: ${tunnel_id}
credentials-file: ${credentials_file_path}
ingress:
- hostname: ${ssh_domain}
service: ssh://localhost:22
- hostname: ${vnc_domain}
service: tcp://localhost:5900
- service: http_status:404
cloudflared tunnel route dns ${tunnel_name} ${ssh_domain}
cloudflared tunnel route dns ${tunnel_name} ${vnc_domain}
cloudflared service install
配置tunnel
打开配置地址https://dash.teams.cloudflare.com
可以参考:https://developers.cloudflare.com/cloudflare-one/tutorials/vnc-client-in-browser