高性能内网穿透工具 · 104K Star · Go语言
⭐ GitHub 104K Starfrp(Fast Reverse Proxy)是一个专注于内网穿透的高性能反向代理应用,采用 C/S 架构。将服务端部署在具有公网 IP 的机器上,客户端部署在内网或防火墙内的机器上,通过访问暴露在服务器上的端口,即可反向代理到处于内网的服务。
TCP/UDP/HTTP/HTTPS/KCP/QUIC
服务端Dashboard + 客户端Admin UI
TLS加密 + Token认证 + OIDC
TCP流复用 + 连接池 + 负载均衡
xtcp点对点通信,流量不经服务器
修改配置后无需重启客户端
| 要求 | 说明 |
|---|---|
| 公网服务器 | 一台有公网 IP 的服务器(用于部署 frps 服务端) |
| 内网机器 | 需要被穿透的内网机器(部署 frpc 客户端) |
| 操作系统 | 支持 Windows / macOS / Linux / FreeBSD |
| 防火墙 | 服务器需开放 frps 监听端口(默认7000) |
从 GitHub Release 页面下载对应系统的压缩包:
# 访问 GitHub 下载最新版本
https://github.com/fatedier/frp/releases
# Linux amd64 示例
wget https://github.com/fatedier/frp/releases/download/v0.67.0/frp_0.67.0_linux_amd64.tar.gz
tar -xzf frp_0.67.0_linux_amd64.tar.gz
cd frp_0.67.0_linux_amd64
frps(服务端)、frpc(客户端)和配置文件模板
在公网服务器上编辑 frps.toml 配置文件:
# frps 服务端配置
bindPort = 7000
# Dashboard 管理面板(可选)
webServer.addr = "0.0.0.0"
webServer.port = 7500
webServer.user = "admin"
webServer.password = "admin123"
# Token 认证(推荐设置)
auth.token = "your_secure_token"
启动服务端:
# 前台运行
./frps -c frps.toml
# 后台运行(推荐)
nohup ./frps -c frps.toml &
在内网机器上编辑 frpc.toml 配置文件:
# frpc 客户端配置
serverAddr = "你的服务器公网IP"
serverPort = 7000
auth.token = "your_secure_token"
# 示例1:暴露内网 Web 服务
[[proxies]]
name = "web"
type = "http"
localPort = 8080
customDomains = ["www.yourdomain.com"]
# 示例2:SSH 远程连接
[[proxies]]
name = "ssh"
type = "tcp"
localIP = "127.0.0.1"
localPort = 22
remotePort = 6000
启动客户端:
./frpc -c frpc.toml
客户端启动后,可以通过以下方式访问内网服务:
# SSH 远程连接(示例2的配置)
ssh -p 6000 user@你的服务器IP
# Web 服务(示例1的配置)
# 浏览器访问 http://www.yourdomain.com
# 查看 Dashboard 管理面板
# 浏览器访问 http://服务器IP:7500
适合给客户远程演示项目:
[[proxies]]
name = "my-project"
type = "http"
localPort = 3000
customDomains = ["demo.yourdomain.com"]
远程办公访问内网电脑:
[[proxies]]
name = "rdp"
type = "tcp"
localIP = "127.0.0.1"
localPort = 3389
remotePort = 3389
通过插件快速共享文件:
[[proxies]]
name = "file-server"
type = "tcp"
remotePort = 9000
[proxies.plugin]
type = "static_file"
localPath = "/path/to/share"
| 功能 | 说明 |
|---|---|
| Dashboard | 通过 Web 界面查看连接状态和流量统计 |
| P2P直连 | 使用 xtcp 类型实现点对点通信,流量不经服务器 |
| 负载均衡 | 多个 proxy 相同的 group 名称即可自动负载均衡 |
| 热重载 | 修改 frpc 配置后,执行 frpc reload 即可生效 |
| 健康检查 | 自动检测后端服务是否正常,异常时自动移除 |
| 带宽限速 | 可对每条隧道单独设置带宽限制 |
| 加密压缩 | 支持 TLS 加密传输,TOML 配置项开启压缩 |
bindPort(默认7000)auth.token 客户端和服务端是否一致# 创建 systemd 服务文件
sudo vim /etc/systemd/system/frps.service
[Unit]
Description=frps service
After=network.target
[Service]
Type=simple
ExecStart=/path/to/frps -c /path/to/frps.toml
Restart=on-failure
RestartSec=5s
[Install]
WantedBy=multi-user.target
# 启用并启动
sudo systemctl enable frps
sudo systemctl start frps
| 对比项 | tunnelto | frp |
|---|---|---|
| Star | 5.6K | 104K |
| 协议支持 | 主要 HTTP | TCP/UDP/HTTP/HTTPS/KCP/QUIC |
| 管理界面 | 无 | Dashboard + Admin UI |
| 稳定性 | 一般 | 生产级稳定 |
| 社区 | 相对小众 | 超活跃社区 |
和志同道合的朋友一起交流学习
抖音扫码加入