Mihomo 是一个基于 Clash 的开源网络代理工具,是 Clash Meta 的一个分支项目。
主要特点
核心功能:
- 支持多种代理协议(Shadowsocks、VMess、Trojan、Hysteria等)
- 基于规则的流量分流
- 支持订阅链接自动更新
- Web管理界面
- 支持多平台(Linux、Windows、macOS、Android)
增强特性:
- 更好的性能优化
- 更多的代理协议支持
- 增强的规则匹配能力
- 支持更复杂的策略组配置
安装方法
Linux系统:
1 2 3 4 5 6 7 8 9
| wget https://github.com/MetaCubeX/mihomo/releases/download/v1.18.1/mihomo-linux-amd64-v1.18.1.gz
gunzip mihomo-linux-amd64-v1.18.1.gz
sudo mv mihomo-linux-amd64-v1.18.1 /usr/local/bin/mihomo sudo chmod +x /usr/local/bin/mihomo
|
使用Docker:
1 2 3 4 5
| docker run -d --name mihomo \ -p 7890:7890 \ -p 9090:9090 \ -v /path/to/config:/root/.config/mihomo \ metacubex/mihomo:latest
|
基本配置
配置文件示例(config.yaml):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| port: 7890 socks-port: 7891 allow-lan: true mode: rule log-level: info external-controller: 0.0.0.0:9090
proxies: - name: "example-server" type: ss server: example.com port: 443 cipher: aes-256-gcm password: password
proxy-groups: - name: "Proxy" type: select proxies: - example-server - DIRECT
rules: - DOMAIN-SUFFIX,google.com,Proxy - DOMAIN-SUFFIX,github.com,Proxy - GEOIP,CN,DIRECT - MATCH,Proxy
|
常用命令
1 2 3 4 5 6 7 8 9 10 11
| mihomo -f config.yaml
nohup mihomo -f config.yaml &
mihomo -t -f config.yaml
mihomo -v
|
系统服务配置
创建systemd服务:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| sudo tee /etc/systemd/system/mihomo.service << EOF [Unit] Description=Mihomo Proxy After=network.target
[Service] Type=simple User=root ExecStart=/usr/local/bin/mihomo -f /etc/mihomo/config.yaml Restart=on-failure RestartSec=5
[Install] WantedBy=multi-user.target EOF
sudo systemctl enable mihomo sudo systemctl start mihomo
|
Web管理界面
Mihomo 支持多种Web管理界面:
推荐的管理面板:
- Clash Dashboard
- Yacd (Yet Another Clash Dashboard)
- Clash Meta Dashboard
访问方式:
与其他工具的区别
相比原版Clash:
相比Clash Premium:
使用建议
- 配置文件管理:建议将配置文件放在固定目录,便于管理
- 日志监控:定期检查日志文件,排查问题
- 规则更新:定期更新GeoIP和GeoSite数据库
- 安全考虑:限制Web管理界面的访问权限