article/openwrt/openVPN.md
2025-05-16 18:15:38 +08:00

30 lines
2.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

## openWrt 路由器中的 openVPN 组件
| **连接类型** | 配置文件说明 | **模式** | **网络类型** | **适用场景** | **对应配置文件示例** |
| :-------------------- | ----------------------------------------------------------- | :------- | :---------------- | :----------------------------------------------------------- | :------------------- |
| **client_tap_bridge** | Client configuration for an ethernet bridge VPN | 客户端 | TAP以太网桥接 | 客户端需完全接入服务器局域网(如访问 SMB 共享、网络打印机等) | `client-bridge.conf` |
| **client_tun** | Client configuration for a routed multi-client VPN | 客户端 | TUNIP 路由) | 标准多客户端 VPN适用于远程办公、访问内网服务 | `client-routed.conf` |
| **client_tun_ptp** | Simple client configuration for a routed point-to-point VPN | 客户端 | TUN点对点路由 | 仅 1 对 1 连接,适合设备间专用加密隧道(如远程管理) | `client-p2p.conf` |
| **server_tap_bridge** | Server configuration for an ethernet bridge VPN | 服务器 | TAP以太网桥接 | 服务器提供桥接模式 VPN客户端像本地设备一样访问整个 LAN | `server-bridge.conf` |
| **server_tun** | Server configuration for a routed multi-client VPN | 服务器 | TUNIP 路由) | 标准多客户端 VPN 服务器,适用于企业远程访问 | `server-routed.conf` |
| **server_tun_ptp** | Simple server configuration for a routed point-to-point VPN | 服务器 | TUN点对点路由 | 仅支持 1 对 1 连接的 VPN 服务器(如站点间 VPN | `server-p2p.conf` |
### **关键说明**
1. **配置文件名**
- 通常 OpenVPN 会根据 `option value` 生成对应的配置文件(如 `client_tun``client-routed.conf`)。
- 实际文件名可能因系统不同有所变化,但逻辑一致。
2. **TAP vs. TUN**
- **TAP`tap_bridge`**:模拟以太网设备,适合需要广播/组播的应用(如网络游戏、局域网发现)。
- **TUN`tun`**:仅路由 IP 流量,更高效,适合大多数 VPN如网页访问、SSH
3. **多客户端 vs. 点对点P2P**
- **普通模式(`server_tun`/`client_tun`**:支持多个客户端同时连接。
- **点对点(`_ptp`**:仅限两个节点直接通信,延迟更低。
### **典型应用**
- **企业远程办公** → `server_tun` + `client_tun`
- **家庭局域网扩展** → `server_tap_bridge` + `client_tap_bridge`
- **服务器间加密通道** → `server_tun_ptp` + `client_tun_ptp`