Install FRP¶
本文发布时的最新frp版本为v0.36.2
,服务器以x64
架构为例,客户端以arm
架构为例
Config on Server¶
1. Download FRP¶
从fatedier/frp的release页面下载相应平台最新的预编译程序包。
在服务器的任意位置下载并解压
wget https://github.com/fatedier/frp/releases/download/v0.36.2/frp_0.36.2_linux_amd64.tar.gz
tar -zxvf frp*.tar.gz
2. Install FRPS¶
From Step2 to Step4 need ROOT authority, you need add
sudo
before each command if NOT a ROOT user.
3a. Configuration of FRPS(befor version 0.52.0)¶
编辑frp的config文件vim /etc/frps.ini
,按照如下的格式填写
[common]
bind_port = [your_port1]
token = [your_token]
vhost_http_port = [your_port2]
bing_udp_port = [your_port3]
vhost_https_port = [your_port4]
dashboard_port = [your_port5]
dashboard_user = [User_name]
dashboard_pwd = [your_Password]
[common]
之下的bind_port
和token
为必须项,其他均为可选项在较新的版本中,
bind_port
、vhost_http_port
、vhost_https_port
可以设置为同一端口
3b. Configuration of FRPS(newer then 0.52.0)¶
编辑frp的config文件vim /etc/frps.toml
,按照如下的格式填写
bindAddr = "0.0.0.0"
bindPort = [bind_port]
transport.tcpMux = true
transport.tls.force = false
vhostHTTPPort = [http_port]
vhostHTTPSPort = [https_port]
webServer.addr = "127.0.0.1"
webServer.port = [web_port]
webServer.user = "web_user_name"
webServer.password = "web_user_password"
auth.method = "token"
auth.token = "auth_token"
4. Register Service and Start On boot¶
mv systemd/frps.service /etc/systemd/system/frps.service
systemctl daemon-reload
systemctl start frps
systemctl enable frps
Config on Client¶
客户端的安装方式与服务器安装方式完全一致,仅在配置文件上有所不同,因此只对与服务器安装不同之处做出说明。
1. Download FRP for Client¶
2. Replace all frps
with frpc
¶
3a. Configuration of FRPC(before 0.52.0)¶
编辑frp的config文件vim /etc/frpc.ini
,按照如下的格式填写
[common]
server_addr = [your_ip]
server_port = [your_port]
token = [your_token]
[Service]
type = [tcp,http,https...]
local_ip = 127.0.0.1
local_port = [your_local_service_port]
remote_port = [your_remote_service_port]
server_addr
填写FRPS的ipv4地址server_port
为服务器的bind_port
对应的端口token
为服务器对应的token
3b. Configuration of FRPC(newer then 0.52.0)¶
编辑frp的config文件vim /etc/frpc.toml
,按照如下的格式填写
user = "user_name"
serverAddr = "srv_ip"
serverPort = [srv_bind_port]
loginFailExit = false
auth.method = "token"
auth.token = "auth_token"
transport.dialServerTimeout = 10
transport.tcpMux = true
transport.protocol = "tcp"
transport.connectServerLocalIP = "0.0.0.0"
transport.tls.enable = false
[[proxies]]
name = "proxy_name"
type = "tcp/http/https..."
localIP = "127.0.0.1"
localPort = [local_port]
Config HTTP Connection for Client¶
1. 在域名网站设置好域名解析¶
- 将某个自定义域名的A/AAAA记录解析到FRP服务器的公网IP地址
2. 添加客户端设置¶
[SERVICE_NAME]
type = http
local_ip = 127.0.0.1
local_port = 0000
custom_domains = CUSTOM_DOMAIN.com
One More Thing¶
FRP一键安装脚本 - linux平台,amd64架构 - 默认服务端口
7000
, - dashboard用户名、密码均为admin - Token 为随机! Onekey script only working for version 0.36.2
1. 下载一键安装脚本¶
2. 运行脚本¶
./install_frp.sh
ROOT authority needed, add
sudo
before each command if NOT a ROOT user.
REF¶
[1]. https://github.com/fatedier/frp