近来一段时间都在鼓捣frp来进行远程连接.现总结如下.
背景介绍:
1.设备:(1)家庭电脑pcA. (2)win10系统跳板机,账户为win10_admin,可以同时访问内网外网.(3)ubutun22.04公网服务器,具有公网ip:假设为1.123.112.112,账户为linux_extern.(4)内网服务器:ip为192.10.10.10,账户为linux_intern
2.使用软件:https://github.com/fatedier/frp/releases/download/v0.42.0/frp_0.42.0_linux_amd64.tar.gz
https://github.com/fatedier/frp/releases/download/v0.42.0/frp_0.42.0_windows_amd64.zip
linux使用frps,windows使用frpc
配置步骤
1.使用frp需要linux开放7000与6000端口, 云服务器一般需要在安全组中开放相应端口.
netstat -nap //查看系统端口使用情况
lsof -i :7000 //查看端口是否开放
注:如果该端口未被使用,则可能不会显示
2.配置linux公网服务器中的frps.ini,此处默认为7000,如非必要可不用修改.
然后启动frps服务
./frps -c ./frps.ini
3.配置windows跳板机中的frpc.ini
server_addr填入linux公网服务器ip. server_port填入和frps.ini中一样的端口号. remote_port是连接时需要的端口号.
然后在windows跳板机中启动frpc服务:
./frpc -c ./frpc.ini
至此,frp配置就已经完成了,此时用任何一个可以连接公网的设备都可以连接到跳板机了
特别注意: windows一定要开启ssh_server服务, 
否则在个人电脑连接linux服务器时会报错:
kex_exchange_identification: Connection closed by remote host
同时windows frp窗口会报错:
[SSH] connect to local service [127.0.0.1:22] error: dial tcp 127.0.0.1:22: connectex: No connection could be made because the target machine actively refused it.
4.连接使用
在pcA的cmd中,连接跳板机
ssh -oPort=6000 win10_admin@1.123.112.112
建立隧道
ssh -CqTnN -L localhost:7708:192.10.10.10:22 win10_admin@1.123.112.112 -p 6000
连接内网服务器
ssh linux_intern@localhost -p 7708