通过简单配置 TCP 类型的代理让用户访问到内网的服务器。
- 在具有公网 IP 的机器上部署 frps,修改 frps.ini 文件,这里使用了最简化的配置,设置了 frp 服务器用户接收客户端连接的端口:
[common] bind_port = 7000 - 在需要被访问的内网机器上(SSH 服务通常监听在 22 端口)部署 frpc,修改 frpc.ini 文件,假设 frps 所在服务器的公网 IP 为 x.x.x.x:
[common] server_addr = x.x.x.x server_port = 7000 [ssh] type = tcp local_ip = 127.0.0.1 local_port = 22 remote_port = 6000local_ip和local_port配置为本地需要暴露到公网的服务地址和端口。remote_port表示在 frp 服务端监听的端口,访问此端口的流量将会被转发到本地服务对应的端口。 - 分别启动 frps 和 frpc。
- 通过 SSH 访问内网机器,假设用户名为 test:
ssh -oPort=6000 test@x.x.x.xfrp 会将请求
x.x.x.x:6000的流量转发到内网机器的 22 端口。