mihomo icon indicating copy to clipboard operation
mihomo copied to clipboard

[Feature] route-address 支持本地文件

Open wmbin opened this issue 1 year ago • 6 comments

Verify steps

  • [X] 我已经在 Issue Tracker 中找过我要提出的请求 I have searched on the issue tracker for a related feature request.
  • [X] 我已经仔细看过 Documentation 并无法找到这个功能 I have read the documentation and was unable to solve the issue.

Description

在某些环境下,mihomo并不会自动添加路由,需要在route-address添加大量的地址 写入config.yaml文件就变异常巨大。 希望团队能像[rules]那样支持读取本地yaml,这样以后也便于维护路由表

Possible Solution

No response

wmbin avatar Jul 24 '24 07:07 wmbin

https://wiki.metacubex.one/config/inbound/tun/#route-address-set

route-address-set

将指定规则集中的目标 IP CIDR 规则添加到防火墙,不匹配的流量将绕过路由 仅支持 Linux,且需要 nftables 以及auto-route 和 auto-redirect 已启用。

him007 avatar Jul 25 '24 14:07 him007

https://wiki.metacubex.one/config/inbound/tun/#route-address-set

route-address-set

将指定规则集中的目标 IP CIDR 规则添加到防火墙,不匹配的流量将绕过路由 仅支持 Linux,且需要 nftables 以及auto-route 和 auto-redirect 已启用。

很不好的就是不支持=。= 所以只能从route-address 入手了

Start TUN listening error: auto redirect: exit status 4: /sbin/iptables -t nat -N mihomo-output: iptables v1.8.10 (nf_tables): Could not fetch rule set generation id: Invalid argument\n

wmbin avatar Jul 25 '24 14:07 wmbin

https://github.com/P0cL4bs/wifipumpkin3/issues/140 https://github.com/tailscale/tailscale/issues/10540 可能是iptables的问题,不确定 可以运行iptables --version以及提供更多信息如设备、日志、部分规则集等

him007 avatar Jul 25 '24 15:07 him007

iptables --version

iptables v1.8.10 (nf_tables)

设备就是mk的ccr2116,系统版本 7.15.2

看了下ros系统都是这样

wmbin avatar Jul 26 '24 01:07 wmbin

P0cL4bs/wifipumpkin3#140 tailscale/tailscale#10540 可能是iptables的问题,不确定 可以运行iptables --version以及提供更多信息如设备、日志、部分规则集等

借鉴另外一个人的问题,突然想到可以在路由添加全地址,再从排除里面把需要的ip排除

route-address:
        - 0.0.0.0/1
        - 128.0.0.0/1
 
route-exclude-address:
        - 0.0.0.0/8
        - 1.1.1.1/32
        - 8.8.4.4/32
        - 8.8.8.8/32
        - 10.0.0.0/8
        - 119.29.29.29/32
        - 172.16.0.0/12
        - 192.168.0.0/16
        - 223.5.5.5/32
        - 223.6.6.6/32

wmbin avatar Jul 26 '24 13:07 wmbin

使用 route-exclude-address-set 规则集,tun的私有地址就失效了

Kwisma avatar Oct 23 '24 20:10 Kwisma