@zhangsiming65965
2020-06-28T03:35:45.000000Z
字数 1444
阅读 199
Network

A fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet.
| 条件 | 描述 |
|---|---|
| 一台具有公网ip的服务器 | 作为frp-server |
| 一台可以访问到公网的内网服务器 | 作为frp-client |

frp-client向frp-server发起请求协商,之后每次外网访问,都由具有公网ip的frp-server代为请求,进行与内网服务器的交互。
github地址:https://github.com/fatedier/frp
下载方式:
$ wget https://github.com/fatedier/frp/releases/download/v0.13.0/frp_0.13.0_linux_amd64.tar.gz$ tar xf frp_0.13.0_linux_amd64.tar.gz$ cd frp_0.13.0_linux_amd64
$ vim frps.ini[common]# 与客户端绑定的进行通信的端口bind_port = 7000# server的dashboard的端口,账号密码# token作为客户端和服务端协商的依据,需要一致dashboard_port = 7500token = 4J292QCXbhdashboard_user = admindashboard_pwd = admin# 作为代理服务器访问客户端web服务自定义的端口号vhost_http_port = 6065
后台启动server端:
$ nohup ./frps -c ./frps.ini &
$ vim frpc.ini[common]# 公网服务器ipserver_addr = 52.83.167.29# 与服务端bind_port一致server_port = 7000# frp的协商tokentoken = 4J292QCXbh# 名字自己起,定义一个ssh服务[ssh]# 服务类型type = tcp# 内网服务器iplocal_ip = 192.168.33.10# 内网服务器地址local_port = 22# 远端地址,及访问server的这个"remote_port"就相当于访问内网服务器的"local_port"remote_port = 6000#公网访问内部web服务器以http方式[pgadmin]# 访问协议类型type = http# 本地端口local_port = 8082# 访问域名,只有http类型支持,端口已经在server中指定(vhost_http_port);域名需要解析到公网服务器(frp-server)custom_domains = ipsec.shannonai.com
后台启动客户端:
$ nohup ./frpc -c ./frpc.ini &
ssh连接:
$ ssh -p 6000 ubuntu@ipsec.shannonai.com
访问http服务:
$ curl ipsec.shannonai.com:6065
在dashboard上面也可以看到相关的配置:

1.如果想要多个client,需要把client的配置在多个内网服务器中配置(不同的服务名和远端端口),并启动client的后台服务。