frp内网穿透

环境准备

  • 需要一台拥有公网ip的服务器
  • 内网服务器
  • frp,尽量使用最新版本

服务端和客户端搭建

1
2
3
4
5
6
# 服务端和客户端安装步骤一致
# 更具不同平台下载对应包即可
wget https://github.com/fatedier/frp/releases/download/v0.10.0/frp_0.10.0_linux_amd64.tar.gz
tar zxf frp_0.10.0_linux_amd64.tar.gz
cd frp_0.10.0_linux_amd64
# 这是已经build好的包,所以不需要在build

服务端配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
$ vim frps.ini
[common]
bind_addr = 0.0.0.0 //绑定公网ip,客服端需要连接这个ip
bind_port = 7000
vhost_http_port = 80
vhost_https_port = 430
dashboard_port = 7500 //frp web管理端口
dashboard_user = admin //web认证用户
dashboard_pwd = admin //web认证密码
log_file = ./frps.log
log_level = debug
log_max_days = 3
privilege_token = 12345678 //token客户端必须和服务端保持一致
privilege_allow_ports = 2000-3000,3001,3003,4000-50000
max_pool_count = 5
authentication_timeout = 900
subdomain_host = akhack.com
tcp_mux = true

启动服务端

1
./frps -c frps.ini //默认前台运行

客户端配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
$ vim frpc.ini
[common]
server_addr = 0.0.0.0 //服务端ip
server_port = 7000 //服务端端口
log_file = ./frpc.log
log_level = info
log_max_days = 3
privilege_token = 12345678
pool_count = 5
tcp_mux = true
user = your_name
[ssh]
type = tcp
local_ip = 127.0.0.1
local_port = 22
use_encryption = false
use_compression = false
remote_port = 6000

frp项目

Github
中文文档

当前网速较慢或者你使用的浏览器不支持博客特定功能,请尝试刷新或换用Chrome、Firefox等现代浏览器