下载 & 安装

Linux

wget https://github.com/fatedier/frp/releases/download/v0.49.0/frp_0.49.0_linux_amd64.tar.gz
tar -zxvf frp_0.49.0_linux_amd64.tar.gz

Windows

https://github.com/fatedier/frp/releases/latest/

配置 systemd

  1. 安装
# yum
yum install systemd
# apt
apt install systemd
  1. 创建 frps.service 文件
[Unit]
# 服务名称,可自定义
Description = frp server
After = network.target syslog.target
Wants = network.target

[Service]
Type = simple
# 启动frps的命令,需修改为您的frps的安装路径
ExecStart = /path/to/frps -c /path/to/frps.ini

[Install]
WantedBy = multi-user.target
  1. 使用 systemd 命令,管理 frps
# 启动 frp
systemctl start frps
# 停止 frp
systemctl stop frps
# 重启 frp
systemctl restart frps
# 查看 frp 状态
systemctl status frps
# 配置 frps 开机自启
systemctl enable frps

配置 frps

[common]
bind_port = 7000 # frps 连接 frpc 的端口
token = abc123456 # 鉴权,需与客户端一致

配置 frpc

[common]
server_addr = x.x.x.x # 服务器 ip
server_port = 7000
token = abc123456

[ssh]
type = tcp
local_ip = 127.0.0.1
local_port = 3389 # Windows 远程桌面默认端口
remote_port = 6000 # 连接远程桌面的端口

启动

./frpc -c frpc.ini