VPN Hub菜单

VPN 路由管理

通过自建 VPN 中枢管理设备路由。

为每台设备指定互联网出口,为私有子网指定隧道。VPN Hub 在 Ubuntu 24.04 上应用路由;指定出口故障时阻断流量。

故障阻断 指定出口失效时部署确认 支持回滚状态检查 与配置对照
VPN HUB / 示例 静态演示

设备路由示例

示例版本 · 4d7c2a
客户端laptop-0110.80.0.2
加密隧道
中枢路由策略已配置
指定出口
出口wireguard-eu隧道示例
命名空间每隧道独立
直连回退已阻止
回滚确认超时后

01 / 路由配置

路由构建方式

用 YAML 定义设备、隧道和 DNS 规则。agent 应用配置版本,并检测运行状态与配置之间的差异。

  1. 策略文件定义设备、隧道、egress 角色与 DNS 范围
  2. agent 从策略渲染 namespace、nftables 规则与服务单元
  3. 每条供应商隧道使用独立的网络命名空间和断线阻断规则

02 / 入口与出口

支持的入口与出口

Direct egress

应急路径

仅显式配置,避免自动静默回退。

WireGuard

主隧道

一个隧道、一个命名空间、可复现策略。

AmneziaWG

客户端接入

混淆参数随配置与配置文件轮转一起更新。

Xray / VLESS

替代传输

每隧道独立 namespace 和显式 profile。

OpenVPN

兼容旧提供商

兼容混合环境的过渡流量。

03 / 故障处理

安全模型

指定出口故障时阻断流量。需要确认的部署若在期限内未获确认,将恢复上一配置版本。

04 / 路由场景

支持的使用场景

按目的地址分流

网络

将企业流量、私有网段与公共访问按目的分配到不同 egress。

hubctl tunnel routes corp-private --add 203.0.113.0/24

家庭办公走指定隧道

连通性

所有终端固定走指定 egress,按需快速切换。

hubctl device set-egress laptop corp-egress

访问私有服务

安全

仅允许私有 DNS 与私有子网流量通过专用隧道。

hubctl tunnel routes corp-private --add 192.0.2.0/24

SOCKS5 应用定向

操作

只将目标应用流量转入指定通道,不影响全局路由。

hubctl routes

供应商迁移与回滚

可用性

候选源先走 canary 验证;失败时恢复 last-known-good。

hubctl subscription refresh corp-egress

设备隔离

安全

默认禁止客户端互访,仅显式 ACL 例外。

hubctl client-acl add phone laptop tcp/22

故障处理与回退

可靠性

可疑变更可通过带确认窗口的部署回退。

hubctl deploy --confirm-within 5m

私有 DNS 划分

网络

私有域名在隧道内解析,公共流量保持正常解析策略。

hubctl tunnel zones corp-net --add corp.example

计划停用隧道

运维

在影响评估后停用单一隧道并保护依赖设备。

hubctl tunnel disable corp-egress

设备接入与配置发布

生命周期

设备发布使用可追踪版本并防止地址冲突。

hubctl device add laptop --egress corp-egress --address 198.51.100.10/32

漂移检测

合规

校验声明状态,并在运行状态偏离时受控重建。

hubctl validate && hubctl deploy

状态可观测性

监控

部署前先确认 health、units 和待处理队列。

hubctl status --format yaml

05 / Telegram 运维

Telegram 运维示例

机器人支持预览变更、带回滚保护的确认和关键指标巡检。

Telegram 机器人示例

🚀 Deploy

🚀 Deploy Active revision: docs-current-0001 New revision: docs-next-0002 (2 tunnels, 2 devices) Excluded revoked devices: docs-retired Changes: • ➕ tunnel docs-private • 🔀 docs-laptop: direct → docs-egress • ➕ device docs-phone → direct With rollback protection, the agent restores the previous revision if you do not confirm in time, even if the new revision cuts off access.

✅ With rollback protection…⚡ Apply without protection↩️ Restore previous revision🏠 Menu

📱 Devices

📱 Devices 🟢 docs-laptop → docs-egress — online 🚫 docs-phone → direct — never connected, revoked

docs-laptopdocs-phone➕ Add device🏠 Menu

🚇 Tunnels

🚇 Tunnels 🟢 docs-private — private-network, wireguard, on ⏸ docs-egress — egress, xray, off

docs-privatedocs-egress🩺 Test all🏠 Menu

📡 Subscriptions

📡 Subscriptions 🟢 docs-egress — 203.0.113.44:443 Automatic refresh: every 6h; a candidate must first prove it works in an isolated namespace.

docs-egress🏠 Menu

📊 Status

📊 Status Revision: docs-current-0001 (created 2h ago) 2 tunnels, 2 devices ⏳ Awaiting confirmation: revision docs-next-0002, 3m 20s left Agent: 🟢 active (running), restarts: 0 Drift: ✅ host matches the revision

✅ Confirm↩️ Roll back🔄 Refresh🏠 Menu

🔔 Notification settings

🔔 Notification settings Intervals: health — 5m, drift — 30m, subscriptions — 6h (configured in telegram.yaml). Categories: Tap a category to toggle it; the selection is stored on the hub and survives bot restarts.

🔔 Automatic rollbacks and deploys🔔 Agent errors🔕 Convergence (info)🔔 Tunnel health🔔 Host drift🔔 Subscription refresh results🔔 Changes outside the bot🏠 Menu
查看机器人文档
机器人操作示例: 检查变更, 确认部署, 查看设备, 查看隧道, 查看状态, 打开设置

06 / 操作指南

操作手册快览

分步说明部署、恢复、子网隔离和供应商连接检查。

配置第一个 VPN 中枢。

先在临时 Ubuntu 主机上验证示例配置,再连接一台设备并检查路由。