Files
nexus/wiki/concepts/FRP内网穿透.md

1.9 KiB
Raw Blame History

title, type, tags
title type tags
FRP内网穿透 concept
networking
self-hosted
reverse-proxy
tunneling

定义

FRPFast Reverse Proxy是一个高性能的内网穿透工具通过在公网 VPS 上部署 frps 服务端FRPS在内网机器上部署 frpc 客户端,将内网服务暴露到公网。

架构

[内网服务] ←localhost:port← [frpc 客户端] ←TCP/UDP← [frps 服务端] ←公网← [用户]
  • frpsFRP Server:运行在有公网 IP 的 VPS 上,监听连接请求
  • frpcFRP Client:运行在内网机器上,与 frps 保持心跳,转发请求到内网服务

核心配置frpc.toml

[[proxies]]
name = "ssh-tunnel"
type = "tcp"
localIP = "127.0.0.1"
localPort = 22
remotePort = 60022  # 公网 VPS 暴露的端口

在家庭基础设施中的应用

节点 frpc 版本 frps 服务器
Mac Mini 0.65.0 darwin arm64 VPS1 :7000
Synology NAS DS718 0.65.0 linux amd64 VPS1 :7000
Ubuntu1 0.65.0 linux amd64 VPS1 :7000
Ubuntu2 0.65.0 linux amd64 VPS1 :7000

关键优势

  • 不需要公网 IP利用 VPS 中转实现内网暴露
  • 支持 TCP/UDP/HTTP/HTTPS多种协议
  • 可配置 auth_method 实现加密通信
  • 通过 ini 或 toml 配置文件管理,版本可控

管理命令

服务器 启动方式 重启命令
Mac Mini launchdplist launchctl unload/load plist
Ubuntu1/2 systemd --user systemctl --user restart frpc

与其他方案的比较

  • frp vs ngrokfrp 完全自托管,无带宽限制,配置灵活
  • frp vs Cloudflare Tunnelfrp 需要 VPSCloudflare Tunnel 依赖 Cloudflare 基础设施

相关工具