Jump to content

Mihomo/zh: Difference between revisions

From Official NixOS Wiki
Oluceps (talk | contribs)
Created page with "=== 错误排查 ==="
mNo edit summary
 
(15 intermediate revisions by 5 users not shown)
Line 1: Line 1:
<languages/>
<languages/>
<div lang="en" dir="ltr" class="mw-content-ltr">
'''[https://github.com/MetaCubeX/mihomo/tree/Alpha mihomo]'''(原名clash-meta)是广泛使用的反审查代理工具。
'''[https://github.com/MetaCubeX/mihomo/tree/Alpha mihomo]''' <span lang="en" dir="ltr">(formerly known as clash-meta), is a widely-used anti-censorship proxy application.</span>
</div>


在NixOS上启用mihomo服务:
在 NixOS 上启用 mihomo 服务:


<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
Line 15: Line 13:


<span id="TUN_Mode"></span>
<span id="TUN_Mode"></span>
=== TUN模式 ===
=== TUN 模式 ===


<div lang="en" dir="ltr" class="mw-content-ltr">
注意:[https://search.nixos.org/options?channel=unstable&show=services.mihomo.tunMode&from=0&size=50&sort=relevance&type=packages&query=mihomo tunMode option]仅为服务提供必要的权限。 如果你需要真正的使用TUN,你需要修改'''configFile'''。详见[https://wiki.metacubex.one/config/inbound/listeners/tun/?h=tun official documentation]
<span lang="en" dir="ltr">NOTICE: The [https://search.nixos.org/options?channel=unstable&show=services.mihomo.tunMode&from=0&size=50&sort=relevance&type=packages&query=mihomo tunMode option] in NixOS module only grants necessary permissions for the service. To actually enable TUN, you need to edit the '''configFile'''. See [https://wiki.metacubex.one/config/inbound/listeners/tun/?h=tun official documentation].</span>
</div>


<span id="Troubleshooting"></span>
<span id="Troubleshooting"></span>
=== 错误===
=== 故障===


<div lang="en" dir="ltr" class="mw-content-ltr">
如果在使用透明代理时遇到问题:
<span lang="en" dir="ltr">If encountering issues with transparent proxy:</span>
* 使用 <code>dmesg</code> 检查内核日志
* <span lang="en" dir="ltr">Check kernel logs with <code>dmesg</code></span>
* 如果看到大量关于特定网络设备的 refuse 消息:
* <span lang="en" dir="ltr">If seeing massive "refuse" messages for specific network devices:</span>
** NixOS 默认启用了防火墙,关掉防火墙再尝试
** <span lang="en" dir="ltr">NixOS enables firewall by default, try disabling firewall</span>
** 如关掉防火墙后问题解决得到解决,可以依次尝试:
** <span lang="en" dir="ltr">If problem is solved, try sequentially:</span>
*** tun 设备添加到 <code>trustedInterfaces</code>
*** <span lang="en" dir="ltr">Add tun device to <code>trustedInterfaces</code></span>
*** 禁用 <code>checkReversePath</code>
*** <span lang="en" dir="ltr">Disable <code>checkReversePath</code></span>
* 如果看到大量关于特定端口的 refuse 消息:
* <span lang="en" dir="ltr">If seeing massive "refuse" messages for specific ports:</span>
** 如果你正在使用 tproxy 透明代理,尝试在防火墙中允许 tproxy 端口。
** <span lang="en" dir="ltr">Try allow the tproxy port in firewall if you're trying tproxy transparent proxy.</span>
 
</div>
<span id="See_also"></span>
== 更多参考 ==


<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">
== <span lang="en" dir="ltr">See also</span> ==
* [https://blog.nyaw.xyz/nixos-inwall-install NixOS installation and usage under a censored network (zh-cn)]
</div>
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
[[Category:Applications]]
* [https://blog.nyaw.xyz/nixos-inwall-install <span lang="en" dir="ltr">NixOS installation and usage under a censored network (zh-cn)</span>]
[[Category:Networking]]
</div>

Latest revision as of 02:59, 11 February 2026

mihomo(原名clash-meta)是广泛使用的反审查代理工具。

在 NixOS 上启用 mihomo 服务:

services.mihomo = {
  enable = true;
  configFile = "/path/to/config.yaml";
  #...
};

TUN 模式

注意:tunMode option仅为服务提供必要的权限。 如果你需要真正的使用TUN,你需要修改configFile。详见official documentation

故障排除

如果在使用透明代理时遇到问题:

  • 使用 dmesg 检查内核日志
  • 如果看到大量关于特定网络设备的 refuse 消息:
    • NixOS 默认启用了防火墙,关掉防火墙再尝试
    • 如关掉防火墙后问题解决得到解决,可以依次尝试:
      • 将 tun 设备添加到 trustedInterfaces
      • 禁用 checkReversePath
  • 如果看到大量关于特定端口的 refuse 消息:
    • 如果你正在使用 tproxy 透明代理,尝试在防火墙中允许 tproxy 端口。

更多参考