frp原理图
以ssh到内网服务器为实例
准备:
- 公网ip的服务器(frps运行)(学生可以去阿里云或者腾讯云购买,很便宜)
- 内网服务器(frpc运行)
记住一点就好,公网ip的服务器运行frps,内网运行frpc
frps配置:
# frps.ini
[common]
bind_port = 8881
# ./frps -c ./frps.ini
frpc配置:
# frpc.ini
[common]
server_addr = x.x.x.x
server_port = 8881
[ssh]
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = 6000
# ./frpc -c ./frpc.ini
- 通过 ssh 访问内网机器,假设用户名为 test:
ssh -oPort=6000 test@x.x.x.x