Auto-sync: 2026-04-26 20:02

This commit is contained in:
2026-04-26 20:02:45 +08:00
parent d42bc16120
commit b7d9d0f5d1
54 changed files with 3196 additions and 3021 deletions

98
wiki/concepts/frp.md Normal file
View File

@@ -0,0 +1,98 @@
---
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
frpFast 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 = <shared_secret> # 认证 token
dashboard_addr = 0.0.0.0
dashboard_port = 7500
dashboard_user = admin
dashboard_pwd = <password>
```
**frpc.ini**:
```ini
[common]
server_addr = <vps_ip>
server_port = 7000
token = <shared_secret> # 必须与 frps 一致
[service_name]
type = tcp
local_ip = 127.0.0.1
local_port = <local_port>
remote_port = <vps_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