# OpenWrt 安装 OpenClash 完整教程 > OpenClash 是基于 Clash 的科学上网插件 > 支持规则分流、自动选择节点、Dashboard 面板 --- ## 什么是 OpenClash **OpenClash** 是 OpenWrt 上基于 **Clash** 的科学上网插件。 ### 核心功能 - ✅ **规则分流** - 国内/国外流量自动分流 - ✅ **自动选择** - 自动选择最优节点 - ✅ **Dashboard** - Web 面板可视化 - ✅ **多协议支持** - SS/V2Ray/Trojan/Socks5 ### OpenClash vs Passwall | 特性 | OpenClash | Passwall | |------|-----------|----------| | 核心 | Clash | Xray/V2Ray | | 规则系统 | 完善 | 基础 | | Dashboard | ✅ 美观 | 一般 | | 内存占用 | 较高 | 较低 | --- ## 安装步骤 ### 方法一:官方源安装(推荐) #### 1. 添加软件源 ```bash echo "src/gz openclash https://github.com/vernesong/OpenClash/releases/download/Clash_Premium" >> /etc/opkg/customfeeds.conf opkg update ``` #### 2. 安装依赖 ```bash opkg install coreutils-nohup bash iptables dnsmasq-full curl jsonfilter ca-certificates ipset ip-full iptables-mod-tproxy iptables-mod-extra libcap libcap-bin ruby ruby-yaml ``` #### 3. 安装 OpenClash ```bash opkg install luci-app-openclash ``` --- ### 方法二:手动下载安装 **下载地址:** - https://github.com/vernesong/OpenClash/releases **安装:** ```bash cd /tmp opkg install luci-app-openclash_xxx.ipk ``` --- ## 配置订阅 ### 1. 访问 OpenClash ``` http://192.168.0.2/cgi-bin/luci/admin/services/openclash ``` ### 2. 添加订阅 ``` 配置订阅 → 添加 ├─ 订阅名称:我的订阅 ├─ 订阅地址:https://xxx.com/subscribe?token=xxx └─ 自动更新:启用 ``` ### 3. 选择运行模式 | 模式 | 说明 | |------|------| | **Fake-IP(增强)** | 速度快,兼容性好 ⭐推荐 | | Fake-IP(TUN 混合) | 支持 UDP,游戏推荐 | | Redir-Host | 传统模式,稳定 | ### 4. 启动 ``` 点击"启动 OpenClash" 等待状态变为"运行中" ``` --- ## 常用设置 ### 全局设置 ``` 全局设置 → 基本设置 ├─ 启动时自动更新订阅:✅ ├─ 自动更新 GeoIP 数据库:✅ └─ 自动更新规则:✅ ``` ### 访问 Dashboard ``` 点击 "Dashboard 面板" 或访问:http://192.168.0.2:9090/ui ``` **功能:** - 查看当前连接 - 切换节点 - 查看流量统计 - 测试节点延迟 --- ## 客户端配置 **电脑 A 网络设置:** ``` IP: 192.168.0.102 网关: 192.168.0.2 ← 指向 OpenWrt DNS: 192.168.0.2 ← 指向 OpenWrt ``` **测试:** ```cmd ping baidu.com # 国内网站,直连 ping google.com # 国外网站,走代理 ``` --- ## 常见问题 ### Q1: 安装时提示依赖错误 ```bash opkg update opkg install coreutils-nohup bash iptables dnsmasq-full curl jsonfilter ca-certificates ipset ip-full iptables-mod-tproxy iptables-mod-extra libcap libcap-bin ruby ruby-yaml kmod-tun ``` ### Q2: 启动失败 ```bash # 查看日志 logread | grep openclash # 检查核心 ls -la /etc/openclash/core/ ``` ### Q3: 无法访问国外网站 1. 订阅是否成功更新? 2. 节点是否可用?(Dashboard 测试延迟) 3. 运行模式是否正确? --- ## 参考资源 - OpenClash GitHub:https://github.com/vernesong/OpenClash - Clash 文档:https://dreamacro.github.io/clash/ --- **日期:** 2026-04-05