前提
需要有一个公网服务器,这里使用linux举例
服务端配置
-
frps.ini
[common] bind_port = 7000
-
后台运行
wget https://github.com/fatedier/frp/releases/download/v0.22.0/frp_0.22.0_linux_amd64.tar.gz nohub frp_0.22.0_linux_amd64/frps -c frp_0.22.0_linux_amd64/frps.ini & &> /dev/null
客户端(win)
-
frpc.ini
[common] server_addr = 11.12.13.14 # 上面服务器的ip server_port = 7000 # 上面配服务端配置的端口 [rdp] type = tcp local_ip = 127.0.0.1 local_port = 3389 # 本地实际端口 remote_port = 1234 # 服务端端口,server_ip:1234 --> 127.0.0.1:3389
-
自启服务
创建一个bat脚本 auto_frp.bat ,保存以下内容,根据实际情况替换
@echo off start "C:\Windows\System32\cmd.exe" cd C:\Soft\frp\ frpc -c frpc.ini exit
添加到服务自启,cmd执行以下命令,binPath为绝对路径
sc create frp binPath=C:\Soft\frp\auto_frp.bat start=auto
linux客户端一样的配置,自启、断线重连参考上一篇ssh内网穿透,windows 下的定时任务自动重连暂未研究。