远程桌面双通道配置文档
概述
本文档记录如何通过 Tailscale 和 frp 两种方式同时访问宿舍电脑远程桌面,实现冗余和高可用性。
环境信息
- 宿舍电脑:Windows,内网 IP(无公网 IP)
- 教室电脑:Windows,通过校园网/热点连接
- 阿里云服务器:公网 IP 112.74.113.55,作为 frp 中转节点
- frp 版本:0.52.3
方案一:Tailscale(P2P 直连,推荐)
优势
- 延迟低(同校园网约 20ms)
- 无需公网服务器
- 配置简单
连接方式
在教室电脑的远程桌面连接中输入:
100.x.x.x
使用宿舍电脑的 Tailscale IP 地址。
注意事项
- 确保两端 Tailscale 均处于在线状态
- 确保宿舍电脑未休眠(设置 → 系统 → 电源 → 睡眠 → 从不)
- 确保宿舍电脑已开启远程桌面功能
方案二:frp 内网穿透
优势
- 不依赖 Tailscale
- 可作为备用通道
- 适合跨运营商/远距离场景
架构
教室电脑 → 阿里云(112.74.113.55:33891) → frpc → 宿舍电脑(127.0.0.1:3389)
宿舍电脑配置(frpc.ini)
`ini [common] server_addr = 112.74.113.55 server_port = 7000 token = 你的密钥
[dorm_mstsc] type = tcp local_ip = 127.0.0.1 local_port = 3389 remote_port = 33891 use_compression = true compression = zlib `
阿里云服务器配置(frps.toml)
配置文件位置:~/tools/frp_0.52.3_linux_amd64/frps.toml
` oml bindAddr = “0.0.0.0” bindPort = 7000
webServer.addr = “0.0.0.0” webServer.port = 7500 webServer.user = “admin” webServer.password = “admin@123”
auth.method = “token” auth.token = 密钥,要与上方一样 `
阿里云安全组配置
需要在阿里云控制台添加入方向规则:
| 协议 | 端口范围 | 授权对象 | 说明 |
|---|---|---|---|
| TCP | 33891/33891 | 0.0.0.0/0 | frp 远程桌面穿透端口 |
| TCP | 7000/7000 | 0.0.0.0/0 | frp 服务端通信端口 |
启动 frpc
`ash # 手动启动 cd D:_0.52.3_0.52.3_windows_amd64 frpc.exe -c frpc.ini
后台启动(隐藏窗口)
start /min frpc.exe -c frpc.ini `
教室电脑连接方式
在远程桌面连接中输入:
112.74.113.55:33891
开机自启设置
已在以下路径创建启动脚本:
C:\Users\hu\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\frpc_start.bat
脚本内容:
atch @echo off cd /d "D:\AAAsoftware\frp_0.52.3\frp_0.52.3_windows_amd64" start /min frpc.exe -c frpc.ini exit
故障排查
1. frpc 启动失败
错误信息:port already used
原因:远程桌面端口 3389 已被其他程序占用(如 Tailscale 或 Windows 远程桌面服务本身)
解决:确保 frpc 和 Tailscale 不同时绑定同一端口,或修改 frpc 的 localPort
2. 连接超时
可能原因: - 阿里云安全组未放行 33891 端口 - frpc 未启动或已退出 - 宿舍电脑防火墙拦截
排查步骤: `ash # 检查 frpc 进程 tasklist | findstr frp
测试阿里云端口连通性
telnet 112.74.113.55 33891
检查 frpc 日志
Get-Content “D:_0.52.3_0.52.3_windows_amd64.log” `
3. Tailscale 连接失败
排查步骤: `ash # 检查 Tailscale 状态 tailscale status
测试连通性
tailscale ping 100.x.x.x
Ping 测试
ping 100.x.x.x `
4. 延迟过高
- Tailscale:同校园网应约 20ms,若高于 50ms 检查是否走了 DERP 中继
- frp:延迟取决于阿里云到教室的距离,通常 30-80ms
连接方式对比
| 项目 | Tailscale | frp |
|---|---|---|
| 连接地址 | 100.x.x.x | 112.74.113.55:33891 |
| 延迟 | 20ms(同校园网) | 30-80ms(取决于阿里云) |
| 带宽 | 受限于校园网 | 受限于阿里云带宽 |
| 依赖 | Tailscale 客户端 | 阿里云服务器 + frp |
| 适用场景 | 同校/近距离 | 跨地区/备用通道 |
常用命令
宿舍电脑(Windows)
`powershell # 查看 frpc 进程 tasklist | findstr frp
停止 frpc
Stop-Process -Name “frpc” -Force
重新启动 frpc
cd D:_0.52.3_0.52.3_windows_amd64 frpc.exe -c frpc.ini
查看 Tailscale 状态
tailscale status
测试 Tailscale 连通性
tailscale ping 100.x.x.x `
阿里云服务器(Linux)
`ash # 检查 frps 进程 ps aux | grep frps
重启 frps
cd ~/tools/frp_0.52.3_linux_amd64 ./frps -c frps.toml
检查端口监听
ss -tlnp | grep -E ‘7000|33891’
查看防火墙状态
sudo ufw status `
更新日志
- 2026-07-13:初始配置完成,Tailscale 和 frp 双通道同时运行
- 2026-07-13:frp remotePort 从 33890 改为 33891,避免与 Tailscale 端口冲突
- 2026-07-13:设置 frpc 开机自启,隐藏启动窗口
附录:文件路径
| 组件 | 路径 |
|---|---|
| frpc 客户端 | D:_0.52.3_0.52.3_windows_amd64.ini |
| frps 服务端 | ~/tools/frp_0.52.3_linux_amd64/frps.toml |
| 开机启动脚本 | C:Menu_start.bat |
| Tailscale 配置 | 默认路径 %APPDATA% |
Comments NOTHING