三种内网穿透方案技术对比

描述

背景与适用场景

运维工程师经常遇到这种情况:本地开发的服务需要暴露给外网调试、云服务器在 NAT 后面需要从家里访问、树莓派在家里需要远程管理、多台服务器之间需要互相通信但不在同一个局域网。这些场景都需要内网穿透技术。

内网穿透的核心问题是:如何让 NAT 后的设备从外部访问?常见解法有三种思路:

端口映射:在出口路由器做端口转发(需要控制路由器)

反向代理:通过有公网 IP 的中转服务器转发流量(frp、ngrok)

VPN 隧道:建立加密隧道,组成虚拟局域网(WireGuard、Tailscale)

本文从运维实际出发,对比 frp、WireGuard、Tailscale 三种方案,告诉你什么场景该用什么、怎么部署、常见问题怎么排查。

适合阅读本文的场景:

本地开发需要暴露 Webhook 给外网

远程办公需要访问公司内网服务器

树莓派、NAS 需要远程管理

多台云服务器需要组成私有网络

IoT 设备需要远程监控和管理

临时测试环境需要快速组网

frp 内网穿透

工作原理

frp(Fast Reverse Proxy)是最传统的内网穿透方案。采用 C/S 架构,需要一台有公网 IP 的服务器作为中转:

 

[内网设备] --frpc--> [公网服务器 frps] ---> [外部用户]
         <--frpc----              <------

 

frp 的特点是完全可控、不依赖第三方服务、数据经过中转服务器。缺点是流量都经过中转,有带宽瓶颈和延迟。

服务端部署

 

# 1. 下载 frp(服务端是 frps,客户端是 frpc)
# releases 页面:https://github.com/fatedier/frp/releases
# 下载对应架构的版本(Linux amd64 为例)
wget https://github.com/fatedier/frp/releases/download/v0.60.0/frp_0.60.0_linux_amd64.tar.gz
tar -xzf frp_0.60.0_linux_amd64.tar.gz
cd frp_0.60.0_linux_amd64

# 2. 创建 frps 配置文件
cat > frps.ini << 'EOF'
[common]
# frps 监听地址(公网服务器 IP)
bind_addr = 0.0.0.0
bind_port = 7000

# 用于客户端认证的 token
token = your-secret-token-here

# HTTP 服务监听端口
vhost_http_port = 80
vhost_https_port = 443

# Dashboard(可选,监控 frp 连接状态)
dashboard_addr = 0.0.0.0
dashboard_port = 7500
dashboard_user = admin
dashboard_pwd = your-dashboard-password

# 日志配置
log_file = /var/log/frps.log
log_level = info
log_max_days = 3
EOF

# 3. 创建 systemd 服务
cat > /etc/systemd/system/frps.service << 'EOF'
[Unit]
Description=Frp Server Service
After=network.target

[Service]
Type=simple
User=root
ExecStart=/opt/frp/frps -c /opt/frp/frps.ini
Restart=on-failure
RestartSec=5s

[Install]
WantedBy=multi-user.target
EOF

# 4. 启动 frps
mkdir -p /opt/frp
cp frps frps.ini /opt/frp/
systemctl daemon-reload
systemctl enable frps
systemctl start frps

# 5. 验证 frps 运行状态
systemctl status frps
netstat -tlnp | grep frps

 

客户端部署(Linux)

 

# 1. 下载 frpc(客户端)
# releases 页面:https://github.com/fatedier/frp/releases
# 选择对应架构版本
wget https://github.com/fatedier/frp/releases/download/v0.60.0/frp_0.60.0_linux_amd64.tar.gz
tar -xzf frp_0.60.0_linux_amd64.tar.gz
cd frp_0.60.0_linux_amd64

# 2. 创建 frpc 配置文件
cat > frpc.ini << 'EOF'
[common]
# frps 服务器地址
server_addr = your-frps-ip
server_port = 7000

# 认证 token,要和 frps 一致
token = your-secret-token-here

# 日志配置
log_file = /var/log/frpc.log
log_level = info
log_max_days = 3

# SSH 穿透示例
[ssh]
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = 2222

# Web 服务穿透示例
[web]
type = http
local_ip = 127.0.0.1
local_port = 8080
custom_domains = your-domain.com

# TCP 穿透示例(访问内网的 MySQL)
[mysql]
type = tcp
local_ip = 127.0.0.1
local_port = 3306
remote_port = 13306
EOF

# 3. 创建 systemd 服务
cat > /etc/systemd/system/frpc.service << 'EOF'
[Unit]
Description=Frp Client Service
After=network.target

[Service]
Type=simple
User=root
ExecStart=/opt/frp/frpc -c /opt/frpc.ini
Restart=on-failure
RestartSec=5s

[Install]
WantedBy=multi-user.target
EOF

# 4. 启动 frpc
mkdir -p /opt/frp
cp frpc frpc.ini /opt/frp/
systemctl daemon-reload
systemctl enable frpc
systemctl start frpc

# 5. 验证
systemctl status frpc

 

客户端部署(Windows)

 

# 1. 下载 Windows 版本
# https://github.com/fatedier/frp/releases

# 2. 创建 frpc.ini(同 Linux)

# 3. 创建启动脚本 start-frpc.bat
@echo off
cd /d %~dp0
frpc.exe -c frpc.ini
pause

# 4. 可选:注册为 Windows 服务(需要 NSSM 或 winsw)
# 下载 winsw: https://github.com/winsw/winsw/releases
# 创建 frpc.xml 配置文件
# 管理员权限运行:winsw.exe install frpc.xml

 

配置文件详解

 

# frps.ini 完整配置示例
[common]
# 基本配置
bind_addr = 0.0.0.0
bind_port = 7000

# 认证
token = your-secret-token-here

# 端口配置
# vhost_http_port 和 vhost_https_port 是 frps 监听的 HTTP/HTTPS 端口
vhost_http_port = 80
vhost_https_port = 443

# 如果 frps 有多个 IP,可以指定只监听特定 IP
# bind_addr = 1.2.3.4

# 允许客户端使用的端口范围(可选)
# 客户端 remote_port 在这个范围内时,frps 会自动分配
# allow_ports = 2000-3000, 3005, 5000-6000

# 连接超时
max_pool_count = 5
max_ports_per_client = 0

# 心跳配置
heartbeat_interval = 10
heartbeat_timeout = 90

# 带宽限制(可选)
# 单个代理带宽上限
# bandwidth_limit_type = server
# bandwidth_limit = 1MB

# 认证超时
authentication_timeout = 900

# 端口白名单(可选)
# allow_ports = 1000-2000, 3000

# 日志
log_file = /var/log/frps.log
log_level = info
log_max_days = 3
# frpc.ini 完整配置示例
[common]
server_addr = 1.2.3.4
server_port = 7000
token = your-secret-token-here

# 日志
log_file = /var/log/frpc.log
log_level = info

# 认证方式(除了 token 还有 oidc 认证)
# oidc_audience = your-audience
# oidc_client_id = your-client-id
# oidc_client_secret = your-client-secret

# 泛域名 HTTP 穿透示例
[web]
type = http
local_ip = 127.0.0.1
local_port = 8080
# 泛域名需要 DNS 解析到 frps 服务器
subdomain = app
custom_domains = app.your-domain.com

# 多个 Web 服务共享 80 端口
[web1]
type = http
local_ip = 127.0.0.1
local_port = 3000
subdomain = api

[web2]
type = http
local_ip = 127.0.0.1
local_port = 4000
subdomain = admin

# HTTPS 穿透示例
[web_https]
type = https
local_ip = 127.0.0.1
local_port = 443
custom_domains = secure.your-domain.com
# frps 会自动处理 TLS termination
plugin = https2http
plugin_local_addr = 127.0.0.1:8080

# TCP 穿透示例
[ssh]
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = 2222

# UDP 穿透示例(远程桌面、游戏服务器等)
[minecraft]
type = udp
local_ip = 127.0.0.1
local_port = 25565
remote_port = 25565

# STCP 穿透(安全 TCP,需要双方都运行 frpc)
[secret_ssh]
type = stcp
local_ip = 127.0.0.1
local_port = 22
# 访问者需要知道这个 secret_key
sk = your-secret-key

# XTCP 穿透(打洞,p2p 直连,失败后走中转)
[xtcp]
type = xtcp
local_ip = 127.0.0.1
local_port = 9000
sk = your-secret-key

 

frp 常见问题排查

 

# 1. 查看 frps 日志
tail -f /var/log/frps.log

# 2. 查看 frpc 日志
tail -f /var/log/frpc.log

# 3. 测试 frps 端口是否通
# 在客户端测试
nc -zv your-frps-ip 7000
telnet your-frps-ip 7000

# 4. 客户端连接失败排查
# 1. 检查 token 是否一致
# 2. 检查防火墙是否开放 7000 端口
# 3. 检查 frps 是否正常运行
systemctl status frps

# 5. HTTP 穿透不生效排查
# 1. 检查域名 DNS 是否正确解析到 frps IP
nslookup app.your-domain.com

# 2. 检查 frps 的 vhost_http_port 是否和域名配置一致
# 3. 检查 frpc 的 custom_domains 是否正确

# 6. frpc 连接不稳定排查
# 1. 调整心跳间隔
# frpc.ini 添加:
heartbeat_interval = 5
heartbeat_timeout = 20

# 7. 带宽受限排查
# frps.ini 可以设置单连接带宽限制
# bandwidth_limit_type = server
# bandwidth_limit = 10MB

 

WireGuard 虚拟局域网

工作原理

WireGuard 是新一代 VPN 协议,比 OpenVPN、IPSec 更快、更简单、更安全。它不是传统意义上的"内网穿透",而是把多台机器组成一个虚拟局域网:

 

[机器 A] <-- WireGuard 隧道 --> [机器 B]
  10.0.0.1                      10.0.0.2

[机器 A] <-- WireGuard 隧道 --> [机器 C]
  10.0.0.1                      10.0.0.3

 

WireGuard 的特点是:加密隧道、P2P 直连(不经过中转)、性能极高。缺点是:需要知道对方公网 IP、新设备加入需要重新配置所有节点。

服务端部署(作为网关)

 

# 1. 安装 WireGuard(Ubuntu/Debian)
apt update
apt install wireguard -y

# CentOS/RHEL 8+
dnf install epel-release -y
dnf install wireguard-tools -y

# 2. 生成密钥对(每台机器都要生成)
cd /etc/wireguard
umask 077

# 生成服务器密钥对
wg genkey | tee server_private.key | wg pubkey > server_public.key

# 生成客户端密钥对(多台客户端需要多个)
wg genkey | tee client1_private.key | wg pubkey > client1_public.key
wg genkey | tee client2_private.key | wg pubkey > client2_public.key

# 3. 创建服务器配置文件
cat > wg0.conf << 'EOF'
[Interface]
# 服务器私钥
PrivateKey = 

# WireGuard 网卡 IP(虚拟局域网地址)
Address = 10.0.0.1/24

# 服务器监听端口
ListenPort = 51820

# 防火墙规则(NAT 转发)
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT
PostUp = iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
PostUp = iptables -A FORWARD -i wg0 -o wg0 -j ACCEPT

# 删除防火墙规则(关闭时)
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT
PostDown = iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
PostDown = iptables -D FORWARD -i wg0 -o wg0 -j ACCEPT

# 客户端配置
[Peer]
# 客户端 1 公钥
PublicKey = 
# 客户端 1 允许的 IP(该客户端可以访问的虚拟局域网地址)
AllowedIPs = 10.0.0.2/32

[Peer]
# 客户端 2 公钥
PublicKey = 
AllowedIPs = 10.0.0.3/32
EOF

# 4. 设置权限
chmod 600 wg0.conf

# 5. 开启 IP 转发
echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf
sysctl -p

# 6. 启动 WireGuard
systemctl enable wg-quick@wg0
systemctl start wg-quick@wg0

# 7. 验证
wg show
ip addr show wg0

 

客户端部署(Linux)

 

# 1. 安装 WireGuard(同服务器)
apt install wireguard -y

# 2. 生成密钥对
cd /etc/wireguard
umask 077
wg genkey | tee client_private.key | wg pubkey > client_public.key

# 3. 创建客户端配置
cat > wg0.conf << 'EOF'
[Interface]
# 本机私钥
PrivateKey = 

# 本机在虚拟局域网的 IP
Address = 10.0.0.2/24

# DNS 服务器(可选)
DNS = 8.8.8.8, 8.8.4.4

[Peer]
# 服务器公钥
PublicKey = 

# 服务器公网地址和端口
Endpoint = your-server-ip:51820

# 保持连接(穿透 NAT)
PersistentKeepalive = 25

# 允许访问的 IP 范围
# 0.0.0.0/0 表示所有流量都走 WireGuard(完整 VPN)
# 只包含虚拟局域网:10.0.0.0/24
AllowedIPs = 10.0.0.0/24
EOF

chmod 600 wg0.conf

# 4. 启动
systemctl enable wg-quick@wg0
systemctl start wg-quick@wg0

# 5. 测试连接
# 在客户端 ping 服务器
ping 10.0.0.1

# 在服务器 ping 客户端
ping 10.0.0.2

 

客户端部署(Windows/macOS)

 

Windows:下载 WireGuard 客户端 from https://www.wireguard.com/install/
macOS:brew install wireguard-tools 或从 App Store 下载官方客户端

图形客户端配置:
1. 导入或新建隧道
2. 填入 PrivateKey(客户端私钥)
3. 填入 Address(客户端虚拟 IP)
4. 添加 Peer:填入服务器公钥、Endpoint(服务器IP:51820)
5. AllowedIPs:填入 10.0.0.0/24(只访问虚拟局域网)
6. 保存并连接

 

WireGuard 作为全站 VPN(所有流量走隧道)

 

# 客户端配置,AllowedIPs 设为 0.0.0.0/0
cat > wg0.conf << 'EOF'
[Interface]
PrivateKey = 
Address = 10.0.0.2/24
DNS = 8.8.8.8

[Peer]
PublicKey = 
Endpoint = your-server-ip:51820
PersistentKeepalive = 25
AllowedIPs = 0.0.0.0/0
EOF

# 注意:设为 0.0.0.0/0 后,所有流量都会走 WireGuard 隧道
# 服务器需要做好 NAT 和路由,否则无法上网

 

WireGuard 常见问题排查

 

# 1. 查看 WireGuard 状态
wg show
wg show wg0

# 2. 查看网卡
ip addr show wg0

# 3. 查看路由表
ip route show

# 4. 连接失败排查
# 1. 检查服务器防火墙是否开放 51820/UDP
ufw allow 51820/udp

# 2. 检查客户端和服务器的密钥是否匹配
# 服务器上执行:
wg show
# 查看输出的 peer 公钥是否和客户端配置一致

# 3. 检查 AllowedIPs 配置
# 客户端 AllowedIPs 必须包含要访问的 IP
# 服务器 AllowedIPs 必须包含客户端的虚拟 IP

# 5. NAT 穿透问题
# WireGuard 默认无法穿透对称 NAT
# 解决:设置 PersistentKeepalive = 25(每 25 秒发一个心跳包)
# 或者在路由器上做端口转发

# 6. 服务器带宽问题
# WireGuard 流量经过服务器,服务器带宽就是瓶颈
# 用 iperf3 测试带宽
# 服务器:iperf3 -s
# 客户端:iperf3 -c 10.0.0.1

 

Tailscale 虚拟局域网

工作原理

Tailscale 是基于 WireGuard 的商业服务,核心思想是把 WireGuard 的密钥管理、 NAT 穿透、设备管理做成了服务。Tailscale 不需要公网服务器做中转(基础版),支持 DERP 中继(免费),支持 NAT 穿透(p2p 直连)。

 

Tailscale 的优势:
1. 不需要手动管理密钥,Tailscale 服务自动处理
2. 支持 NAT 穿透,大部分情况不需要中继
3. 支持 DERP 中继服务(免费)
4. 支持.Exit Node(流量出口)
5. 支持 ACL 访问控制列表
6. 支持多平台(Windows、macOS、Linux、iOS、Android)

 

安装和部署

 

# 1. 安装 Tailscale(Linux)
curl -fsSL https://tailscale.com/install.sh | sh

# 或者手动安装(CentOS/RHEL)
# 查看最新版本:https://pkgs.tailscale.com/stable/
curl -fsSL https://pkgs.tailscale.com/stable/tailscale-latest.x86_64.rpm -o tailscale.rpm
rpm -i tailscale.rpm

# 2. 启动 Tailscale
tailscaled &
# 或
systemctl start tailscaled

# 3. 连接 Tailscale 网络
tailscale up --login-server=https://login.example.com

# 如果使用 Tailscale 官方服务(最简单)
tailscale up

# 4. 按提示打开浏览器完成认证

# 5. 查看状态
tailscale status

# 6. 查看分配的 IP
tailscale ip

# 7. 开机自启
systemctl enable tailscaled

 

Tailscale 作为出口节点(Exit Node)

 

# 服务器配置为 Exit Node
# 服务器上执行:
tailscale up --advertise-exit-node

# 在 Tailscale 管理后台批准这个节点作为 Exit Node

# 客户端使用 Exit Node
tailscale up --exit-node=
# 或
tailscale up --exit-node=allow-networking

# 所有流量通过 Exit Node

 

Tailscale ACL 访问控制

 

# Tailscale 使用 JSON 格式的 ACL 规则
# 在管理后台 https://login.tailscale.com/admin/acls 编辑

# 示例 ACL:
{
  "acls": [
    # 允许所有用户访问所有设备
    {"action": "accept", "src": ["*"], "dst": ["*:*"]},

    # 限制性 ACL
    {"action": "accept", "src": ["group:developers"], "dst": ["tag22"]},
    {"action": "accept", "src": ["tag:ci"], "dst": ["tag0-65535"]},
  ],
  "tagOwners": {
    "tag:production": ["group:admins"],
    "tag:ci": ["group:admins"]
  }
}

 

Headscale 私有部署(自建 Tailscale 控制平面)

如果不想用 Tailscale 官方服务,可以用 Headscale 搭建私有控制平面:

 

# Headscale 部署(Docker Compose 示例)
# docker-compose.yml
version: '3'
services:
  headscale:
    image: ghcr.io/juanfont/headscale:latest
    container_name: headscale
    volumes:
      - /etc/headscale:/etc/headscale
      - /var/lib/headscale:/var/lib/headscale
    ports:
      - "8080:8080"
      - "3478:3478/udp"
    command: serve
    restart: unless-stopped

# 创建 Headscale 配置
mkdir -p /etc/headscale /var/lib/headscale
cat > /etc/headscale/config.yaml << 'EOF'
server_url: http://your-headscale-ip:8080
listen_addr: 0.0.0.0:8080
private_key_path: /var/lib/headscale/private.key
noise:
  private_key_path: /var/lib/headscale/noise_private.key
prefix: 100.64.0.0/10
derp:
  server:
    enabled: false
  urls:
    - https://controlplane.tailscale.com/derpmap/default
EOF

# 初始化 Headscale
docker exec -it headscale headscale nodes register --key 

# 客户端使用自建 Headscale
tailscale up --login-server=http://your-headscale-ip:8080

 

Tailscale 常见问题排查

 

# 1. 查看 Tailscale 状态
tailscale status

# 2. 查看 Tailscale 日志
journalctl -u tailscaled -f

# 3. 测试连通性
tailscale ping 

# 4. 查看 Tailscale 分配的 IP
tailscale ip -4
tailscale ip -6

# 5. 断网排查
# 1. 检查 Tailscale 服务是否运行
systemctl status tailscaled

# 2. 检查认证状态
tailscale status

# 3. 如果显示 NeedsLogin,重新认证
tailscale up

# 4. 检查 NAT 穿透状态
tailscale netcheck

# 5. 强制使用 DERP 中继
tailscale up --derp=http://custom-derp-server

# 6. 多设备管理
tailscale logout  # 登出当前账号
tailscale up      # 重新登录

 

三种方案对比

功能对比

特性 frp WireGuard Tailscale
架构 C/S,需要中转服务器 P2P,不需中转服务器 混合架构,中继可选
带宽 受中转服务器限制 服务器带宽即瓶颈 p2p 时无瓶颈
延迟 经过中转,延迟高 p2p 直连,延迟低 p2p 直连,延迟低
NAT 穿透 支持 不支持对称 NAT 支持
配置难度 中等 较难 简单
成本 需要公网服务器 需要公网服务器 免费基础版够用
多平台 支持 官方支持主流平台 官方支持全平台
ACL 不支持 不支持 支持
密钥管理 手动 手动 自动
依赖第三方 Tailscale 服务(可自建)

适用场景推荐

 

frp 适用场景:
- 需要临时暴露本地服务到外网(Webhook 调试)
- 有可控的公网服务器
- 只需要 TCP/UDP 端口转发,不需要完整 VPN
- 流量不大,不需要低延迟

WireGuard 适用场景:
- 需要稳定的长连接
- 多台服务器组成私有网络
- 服务器有独立公网 IP
- 网络环境简单(不涉及对称 NAT)
- 对性能要求高

Tailscale 适用场景:
- 不想管理服务器
- 多平台设备需要互联
- 需要 ACL 访问控制
- 网络环境复杂(NAT、对称 NAT)
- 需要快速部署,不想折腾配置

 

带宽和延迟实测对比

实测环境:客户端位于 NAT 后,服务器在阿里云华南节点(广州)

 

frp:
- 延迟:80-120ms(经过中转)
- 带宽:受限于中转服务器,单连接约 30-50MB/s
- 适合:Web 服务、SSH、RDP

WireGuard(p2p 直连):
- 延迟:40-60ms(直连)
- 带宽:接近服务器带宽,单连接约 100MB/s+
- 适合:文件传输、数据库连接、SSH

Tailscale(p2p 直连):
- 延迟:40-60ms(同 WireGuard)
- 带宽:同上
- 中继模式:延迟 80-120ms
- 适合:所有场景

 

实际部署建议

小团队/个人使用

 

推荐方案:Tailscale 免费版

理由:
1. 安装配置 5 分钟搞定
2. 支持全平台
3. 免费版足够个人/小团队使用
4. 不需要自己维护服务器
5. 访问控制够用

部署步骤:
1. 注册 Tailscale 账号(GitHub/Google 登录)
2. 各设备安装 Tailscale 客户端
3. 按提示完成认证
4. 开始使用

 

中等规模团队

 

推荐方案:WireGuard + Tailscale 混合

理由:
1. 核心业务服务器用 WireGuard(性能高、可控)
2. 员工设备用 Tailscale(易管理)
3. 通过 Tailscale ACL 控制访问权限
4. 服务器之间用 WireGuard 互通

部署步骤:
1. 购买或租用有公网 IP 的服务器
2. 在服务器部署 WireGuard
3. 团队成员安装 Tailscale
4. 配置 ACL 规则

 

企业使用

 

推荐方案:Headscale 自建 + WireGuard

理由:
1. 数据完全自主可控
2. Headscale 开源免费
3. WireGuard 性能最优
4. 可与现有基础设施集成

部署步骤:
1. 搭建 Headscale 控制平面
2. 服务器安装 WireGuard,加入网络
3. 通过 Headscale 管理所有节点
4. 配置企业级 ACL 策略

 

常见问题解答

frp 相关

Q:frp 连接成功但服务访问不了?A:检查几个方面:1) 客户端 local_port 是否正确;2) 服务器 remote_port 是否和客户端一致;3) 服务是否真的在监听 local_port;4) 防火墙是否开放。

Q:frp 如何实现 HTTPS?A:两种方式:1) frps 配置 SSL 证书,frps 做 TLS termination;2) frpc 用 plugin https2http,把 HTTPS 请求转成 HTTP 传给本地服务。

Q:frp 如何限制带宽?A:在 frps.ini 中配置 bandwidth_limit_type 和 bandwidth_limit。

WireGuard 相关

Q:WireGuard 连接成功但 ping 不通?A:检查:1) 服务器 IP 转发是否开启(net.ipv4.ip_forward);2) 服务器防火墙是否允许 wg0 网卡;3) 客户端 AllowedIPs 是否包含目标 IP。

Q:WireGuard 如何添加新客户端?A:1) 在客户端生成密钥对;2) 把客户端公钥发给管理员;3) 管理员在服务器 wg0.conf 添加 [Peer] 段,填入公钥和 AllowedIPs;4) 重启 wg-quick@wg0。

Q:WireGuard 支持 Windows/macOS 吗?A:支持。Windows 从官网下载安装包,macOS 用 brew 或官方客户端。

Tailscale 相关

Q:Tailscale 免费版有流量限制吗?A:免费版没有流量限制,但使用 DERP 中继有带宽限制(每个连接 1Mbps)。p2p 直连无限制。

Q:Tailscale 如何禁用 DERP 中继,只用 p2p?A:用 tailscale netcheck 检查 NAT 类型。如果是对称 NAT,p2p 不通,只能用 DERP。

Q:Tailscale 可以自建中继服务器吗?A:可以。Headscale 内置 DERP 功能,也可以单独部署 derper。

Q:Tailscale 安全吗?A:Tailscale 基于 WireGuard,WireGuard 已被证明是安全的。Tailscale 官方不会解密你的流量。

总结

三种内网穿透方案各有优劣:

frp 是最传统的方案,需要自己维护中转服务器,配置稍复杂,但完全可控。适合需要把本地服务暴露到外网的场景。

WireGuard 是新一代 VPN 协议,性能高、安全、代码简洁。适合多台服务器组成私有网络的场景。缺点是需要固定公网 IP,NAT 穿透能力弱。

Tailscale 是最省心的方案,5 分钟就能用起来。免费版足够个人用户和小团队使用。适合不想折腾、追求易用性的场景。

选型建议:

个人使用、Webhook 调试、临时暴露服务:Tailscale

多台服务器组网、有公网 IP:WireGuard

已有中转服务器、只需要端口映射:frp

企业级需求:Headscale 自建 + WireGuard

打开APP阅读更多精彩内容
声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。 举报投诉

全部0条评论

快来发表一下你的评论吧 !

×
20
完善资料,
赚取积分