--- title: "frp" type: concept tags: [networking, open-source, golang, tunneling, self-hosted] last_updated: 2026-04-03 --- ## Aliases - Fast Reverse Proxy - fatedier/frp - frps - frpc ## Definition frp(Fast Reverse Proxy)是一款开源的高性能内网穿透工具,由 Go 语言编写,通过客户端-服务端架构建立反向隧道,使处于 NAT 或防火墙后的内网服务可以被公网访问。包含两个核心组件:frps(服务端,运行在公网 VPS)和 frpc(客户端,运行在内网设备)。 ## Core Architecture ``` 公网用户 → VPS:7000(frps) ←——— 反向隧道 ←——— frpc(内网设备) ``` ## Key Components - **frps**(frp server):运行在公网 VPS,监听 7000 端口(默认),接收 frpc 连接,管理端口映射 - **frpc**(frp client):运行在内网设备,主动连接 frps,建立反向隧道 - **frps.ini / frps.toml**:frps 配置文件 - **frpc.ini / frpc.toml**:frpc 配置文件 ## Supported Protocol Types | 类型 | 说明 | 适用场景 | |------|------|---------| | TCP | 原始 TCP 流量 | SSH、任意 TCP 端口 | | UDP | 原始 UDP 流量 | DNS、视频流 | | HTTP/HTTPS | 应用层代理 | Web 服务 | | STCP | 加密 TCP | 安全内网访问 | | SUDP | 加密 UDP | 安全数据传输 | | XTCP | P2P UDP | 穿越对称型 NAT | ## Key Configuration Parameters **frps.ini**: ```ini [common] bind_addr = 0.0.0.0 bind_port = 7000 token = # 认证 token dashboard_addr = 0.0.0.0 dashboard_port = 7500 dashboard_user = admin dashboard_pwd = ``` **frpc.ini**: ```ini [common] server_addr = server_port = 7000 token = # 必须与 frps 一致 [service_name] type = tcp local_ip = 127.0.0.1 local_port = remote_port = # VPS 暴露端口 ``` ## Version Used in This Wiki - **frp v0.65.0**(当前使用版本) - 配置文件格式:`frpc.ini` / `frps.ini`(TOML 格式为 v0.52+,本 Wiki 使用 INI 格式) ## 在本 Wiki 中的应用 - [[通过VPS+内网反向代理实现域名访问内网穿透]]:完整实践指南(frps + Caddy + 阿里云 DNS) - [[ubuntu-安装-frp-0-65-0-x86-64-操作笔记]]:Ubuntu frpc 客户端安装配置 - [[mac-mini-安装-frp-0-65-0-arm64-操作笔记]]:Mac Mini ARM64 安装配置 - [[家庭监控方案-prometheus-grafana-node-exporter-cadvisor-blackbox]]:通过 frp 穿透 Grafana/Prometheus 端口 ## SSH 穿透注意事项 SSH 穿透使用 `type = tcp`,不走 HTTP/HTTPS 代理层(Caddy 不参与)。SSH 连接命令:`ssh -p 60022 user@vps_domain`(`60022` 是 remote_port)。 ## Troubleshooting 详见 [[通过VPS+内网反向代理实现域名访问内网穿透]] 故障排查章节: 1. 确认 frps 监听端口 `ss -lntup | grep frps` 2. 确认 token 与 frpc 一致 `journalctl -u frps -n 100` 3. 确认防火墙放行 7000 端口 4. telnet 诊断确认连接是否到达 frps 5. 强制重启 frps + frpc ## Related Concepts - [[内网穿透]]:frp 是实现内网穿透的工具 - [[TCP隧道]]:frp 的 TCP 类型映射建立 TCP 隧道 - [[反向代理]]:Caddy 通常在 frp 上层提供 HTTPS 访问 ## Related Entities - [[RackNerd]]:托管 frps 的 VPS 提供商 - [[VPS]]:运行 frps 的公网服务器 - [[阿里云 DNS]]:管理 frp 穿透所需的域名解析 ## References - GitHub: https://github.com/fatedier/frp - 文档: https://github.com/fatedier/frp#configuration