企业 SSL-VPN 方案
WireGuard 适合技术团队自建,但 100 人以上的企业需要:Web 管理界面、与 Active Directory/LDAP 集成、MFA 多因素认证、权限分组(不同部门访问不同内网资源)。本节介绍主流企业 VPN 方案。
企业 VPN 方案对比
方案 类型 授权 LDAP/AD MFA 管理界面 适用规模
──────────────────────────────────────────────────────────────────────────
OpenVPN Access Server SSL-VPN 免费2用户/商业 ✅ ✅ Web UI 中小企业
Pritunl WG/OVPN 开源/商业 ✅ ✅ Web UI 中小企业
WG-Easy WireGuard 开源 ✅ ✗ Web UI 小型团队
Headscale (Tailscale) WG Mesh 开源 ✅ ✅ 命令行 技术团队
Cisco AnyConnect SSL-VPN 商业 ✅ ✅ 企业级 大型企业
Palo Alto GlobalProtect SSL-VPN 商业 ✅ ✅ 企业级 大型企业
OpenVPN Access Server 部署
# Ubuntu 22.04 安装
curl -fsSL https://as-repository.openvpn.net/as/debian/dists/jammy/Release.key \
| gpg --dearmor -o /etc/apt/trusted.gpg.d/openvpn-as.gpg
echo "deb [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/openvpn-as.gpg] \
https://as-repository.openvpn.net/as/debian jammy main" \
> /etc/apt/sources.list.d/openvpn-as-repo.list
apt update && apt install openvpn-as
# 安装后输出:初始 admin 密码
# Access Server 管理界面:https://your-server:943/admin
# 用户登录下载配置:https://your-server:943/
# 设置管理员密码
/usr/local/openvpn_as/scripts/sacli --user admin --new_pass 'StrongPass123!' SetLocalPassword
Access Server Web 管理界面配置要点:
Configuration → VPN Settings:
VPN Protocol:UDP(性能好)或 TCP 443(穿防火墙)
Split Tunneling:推荐开启,只路由内网流量
DNS:推送公司 DNS 服务器
Configuration → Network Settings:
VPN IP 地址段:172.27.232.0/20(默认)
或改为公司规划的地址段
Authentication → LDAP:
Host:your-ldap-server.company.com
Port:389(或 636 for LDAPS)
Base DN:DC=company,DC=com
Bind DN:CN=vpn-service,OU=Service Accounts,DC=company,DC=com
User Management → Groups:
创建分组(IT、Sales、Engineering)
为每组配置不同的访问权限(路由到不同内网段)
Tailscale / Headscale:零配置 Mesh VPN
Tailscale = WireGuard + NAT 穿越 + 中心化协调服务(基于 WireGuard)
Headscale = 开源自托管版 Tailscale 协调服务
优势:
- 零配置 NAT 穿越(STUN/TURN,设备在任何网络都能互联)
- Peer-to-Peer(设备间直连,不经过服务器)
- 100台设备以下免费(Tailscale 官方)
- 支持 ACL 策略(谁能访问谁)
安装(员工机器):
curl -fsSL https://tailscale.com/install.sh | sh
tailscale up --login-server=https://your-headscale-server
Tailscale ACL 策略(tailscale.com 管理界面):
{
"groups": {
"group:engineering": ["user1@company.com", "user2@company.com"],
"group:sales": ["user3@company.com"]
},
"acls": [
// 工程师可以访问所有服务器
{"action": "accept", "src": ["group:engineering"], "dst": ["tag:server:*"]},
// 销售只能访问 CRM 服务器
{"action": "accept", "src": ["group:sales"], "dst": ["tag:crm:443"]}
]
}
VPN 访问权限分组设计
场景:300 人公司,4 个部门,每个部门访问权限不同
员工 VPN 分组:
┌────────────┬───────────────────────────────────────────────────────┐
│ 分组 │ 可访问的内网资源 │
├────────────┼───────────────────────────────────────────────────────┤
│ IT │ 所有服务器(10.0.0.0/8)+ 网络设备管理 │
│ Engineering│ 开发服务器(10.0.30.0/24)+ 测试环境(10.0.40.0/24) │
│ Sales │ CRM 服务器(10.0.50.10:443)+ 文件服务器 │
│ General │ 内网 DNS + 文件服务器 + OA 系统 │
└────────────┴───────────────────────────────────────────────────────┘
Split Tunneling 路由配置(各组推送不同路由):
IT:AllowedIPs = 10.0.0.0/8
Engineering:AllowedIPs = 10.0.30.0/24, 10.0.40.0/24
Sales:AllowedIPs = 10.0.50.10/32
General:AllowedIPs = 10.0.100.0/24 (只有核心内网服务)
MFA 多因素认证集成
# OpenVPN + Google Authenticator TOTP
# 在 VPN 服务器安装 PAM 模块
apt install libpam-google-authenticator
# 为每个用户生成 TOTP 密钥
google-authenticator
# 扫描二维码到 Google Authenticator 或 Authy
# OpenVPN 服务端配置
# /etc/openvpn/server.conf 添加:
plugin /usr/lib/openvpn/openvpn-plugin-auth-pam.so login
# 客户端连接时输入:
# 用户名:username
# 密码:密码+TOTP码(如:MyPass123456)
# 或者密码和 TOTP 分开输入(取决于配置)
# Access Server 内置 MFA 支持:
# 管理界面 → Authentication → TOTP
# 开启后用户下次登录时强制配置 TOTP
VPN 排障速查
# OpenVPN 客户端日志
tail -f /var/log/openvpn.log
# 或者客户端运行时加 --verb 4 看详细日志
# 常见错误:
# TLS handshake failed → 证书过期或服务端/客户端证书不匹配
# AUTH_FAILED → 用户名密码错误或 MFA 码错误
# Connection timed out → UDP 被防火墙拦截,尝试 TCP 443
# WireGuard 排障
wg show # 看 latest handshake(超过3分钟没握手=隧道断了)
ping 10.10.10.1 # ping 对端 VPN IP
wg-quick down wg0 && wg-quick up wg0 # 重启隧道
# 检查路由是否正确添加
ip route show table all | grep wg0
# 抓包确认 WireGuard 流量
tcpdump -i eth0 -n 'udp port 51820'
CCNA 对应考点
考纲位置:Domain 4.4 — Explain the function of DHCP and DNS within the network
VPN 相关考点(CCNA 层面): - Remote Access VPN(客户端到网关)vs Site-to-Site VPN(网络到网络) - SSL VPN(基于 TLS,走 TCP 443)vs IPSec VPN 的区别 - Split Tunneling 的概念(部分流量走 VPN)
下一章:网络监控、抓包与故障排查——VPN 配好了,但排查网络问题的核心武器是抓包分析——tcpdump 和 Wireshark 是每个网络工程师的必备技能。