基于frp搭建内网穿透服务

基于frp搭建内网穿透服务

frp 是一个专注于内网穿透的高性能的反向代理应用,支持 TCP、UDP、HTTP、HTTPS 等多种协议。可以将内网服务以安全、便捷的方式通过具有公网 IP 节点的中转暴露到公网。

安装 frps

使用Frps安装脚本,源码地址:frps-onekey

下载脚本

1
2
wget https://raw.githubusercontent.com/MvsCode/frps-onekey/master/install-frps.sh -O ./install-frps.sh
chmod 700 ./install-frps.sh

执行脚本

1
./install-frps.sh install

安装完成后可以用frps的命令进行管理

1
/etc/init.d/frps {start|stop|restart|status|config|version}

配置 frps

打开frps配置文件

1
frps config

修改配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# [common] is integral section
[common]
# A literal address or host name for IPv6 must be enclosed
# in square brackets, as in "[::1]:80", "[ipv6-host]:http" or "[ipv6-host%zone]:80"
bind_addr = 0.0.0.0
bind_port = 7777
# udp port used for kcp protocol, it can be same with 'bind_port'
# if not set, kcp is disabled in frps
kcp_bind_port = 7777
# if you want to configure or reload frps by dashboard, dashboard_port must be set
dashboard_port = 6443
# dashboard assets directory(only for debug mode)
dashboard_user = 管理员用户名
dashboard_pwd = 管理员密码
# assets_dir = ./static
vhost_http_port = 80
vhost_https_port = 443
# console or real logFile path like ./frps.log
log_file = ./frps.log
# debug, info, warn, error
log_level = info
log_max_days = 3
# auth token
token = 令牌
# It is convenient to use subdomain configure for http、https type when many people use one frps server together.
subdomain_host = 域名
# only allow frpc to bind ports you list, if you set nothing, there won't be any limit
#allow_ports = 1-65535
# pool_count in each proxy will change to max_pool_count if they exceed the maximum value
max_pool_count = 50
# if tcp stream multiplexing is used, default is true
tcp_mux = true

安装客户端

这边我们使用openwrtfrp插件作为客户端

配置连接参数,令牌填写刚才服务端配置的token

接下来配置需要转发的服务

一般httphttps请求都可以通过tcp模式转发,服务名备注填写注意不要和其他服务的重复

通过frps的ip:6443可以登录frps面板,可以看到我们刚才配置的转发服务

作者

ero

发布于

2022-04-20

更新于

2022-06-11

许可协议

评论