Netowrk - Configure FRP server and client

frp 是一个可用于内网穿透的高性能的反向代理应用,支持 tcp, udp 协议,为 http 和 https 应用协议提供了额外的能力,且尝试性支持了点对点穿透。

  • 服务器配置
[common]
bind_port = 7000
 
# 客户端认证
token = TOKEN
 
# HTTP 的访问端口
vhost_http_port = 8080
 
# HTTPS 的访问端口
vhost_https_port = 8443
 
# dashboard 管理界面
dashboard_port = 7500
dashboard_user = admin
dashboard_pwd = PASSWORD
 
# authentication_timeout means the timeout interval (seconds) when the frpc connects frps
# if authentication_timeout is zero, the time is not verified, default is 900s
authentication_timeout = 0
 
# 客户端的子域名将基于此,e.g. demo.proxy.domain.com
subdomain_host = proxy.domain.com
  • 启动服务端
$ ./frps -c frps.ini
2018/08/03 08:25:35 [I] [service.go:128] frps tcp listen on 0.0.0.0:7000
2018/08/03 08:25:35 [I] [service.go:161] http service listen on 0.0.0.0:8080
2018/08/03 08:25:35 [I] [service.go:182] https service listen on 0.0.0.0:8443
2018/08/03 08:25:35 [I] [service.go:205] Dashboard listen on 0.0.0.0:7500
2018/08/03 08:25:35 [I] [root.go:190] Start frps success
  • 客户端配置
[common]
server_addr = SERVER_HOST_ADDR
server_port = 7000
token = TOKEN
 
[ssh-1]
type = tcp
local_ip = 192.168.100.101
local_port = 22
remote_port = 7001
use_encryption = true
use_compression = true
 
[rdp-1]
type = tcp
local_ip = 192.168.100.102
local_port = 3389
remote_port = 7002
use_encryption = true
use_compression = true
 
[web-1]
type = http
local_ip = 192.168.100.103
local_port = 80
subdomain = demo
  • 启动客户端
$ ./frpc -c frpc.ini
2018/08/03 16:26:51 [I] [proxy_manager.go:300] proxy removed: []
2018/08/03 16:26:51 [I] [proxy_manager.go:310] proxy added: [demo ssh-1]
2018/08/03 16:26:51 [I] [proxy_manager.go:333] visitor removed: []
2018/08/03 16:26:51 [I] [proxy_manager.go:342] visitor added: []
2018/08/03 16:26:52 [I] [control.go:246] [cc798f680fe472ce] login to server success, get run id [cc798f680fe472ce], server udp port [0]
2018/08/03 16:26:52 [I] [control.go:169] [cc798f680fe472ce] [web-1] start proxy success
2018/08/03 16:26:52 [I] [control.go:169] [cc798f680fe472ce] [ssh-1] start proxy success
2018/08/03 16:26:52 [I] [control.go:169] [cc798f680fe472ce] [rdp-1] start proxy success
  • 注意
如果网络连接受限可能会遇到如下问题:

[control.go:113] login to server failed: EOF
EOF