最近准备使用 clash permium 中的 tun 来实现透明代理,但在使用过程中碰到一些疑问,首先我很困惑的是 clash permium 自动插入的 ip rule 是什么意思?
> sudo ip rule ls
0: from all lookup local
1000: from all lookup [l3mdev-table]
9000: not from all ipproto tcp goto 9060
9000: from all dport 53 goto 9060
9000: from all iif lo sport 7777 goto 9060
9010: from all to 192.18.0.0/16 lookup 1919247465
9020: from all lookup main suppress_prefixlength 0
9030: not from all iif lo lookup 1919247465
9040: from 0.0.0.0 iif lo uidrange 0-4294967294 lookup 1919247465
9050: from 192.18.0.5 iif lo uidrange 0-4294967294 lookup 1919247465
9060: from all nop
9500: from all to 192.18.0.0/16 lookup 1970566510
9510: from all ipproto icmp goto 9560
9520: not from all dport 53 lookup main suppress_prefixlength 0
9530: not from all iif lo lookup 1970566510
9540: from 0.0.0.0 iif lo uidrange 0-4294967294 lookup 1970566510
9550: from 192.18.0.1 iif lo uidrange 0-4294967294 lookup 1970566510
9560: from all nop
32766: from all lookup main
32767: from all lookup default
除了 0 ,1000 ,32766 和 32767 是有明确的意思外,为何 clash 添加了这么多条记录,是啥意思? 接着,我有执行了 ip route show table all
> sudo ip route show table all | grep utun
default dev utun table 1970566510 proto unspec
192.18.0.0/16 dev utun proto kernel scope link src 192.18.0.1
broadcast 192.18.0.0 dev utun table local proto kernel scope link src 192.18.0.1
local 192.18.0.1 dev utun table local proto kernel scope host src 192.18.0.1
broadcast 192.18.255.255 dev utun table local proto kernel scope link src 192.18.0.1
fe80::/64 dev utun proto kernel metric 256 pref medium
local fe80::3b91:83c6:157c:91ad dev utun table local proto kernel metric 0 pref medium
multicast ff00::/8 dev utun table local proto kernel metric 256 pref medium
> sudo ip route show table all | grep redir
default via 192.18.0.6 dev redir table 1919247465 proto unspec
192.18.0.0/16 dev redir proto kernel scope link src 192.18.0.5
broadcast 192.18.0.0 dev redir table local proto kernel scope link src 192.18.0.5
local 192.18.0.5 dev redir table local proto kernel scope host src 192.18.0.5
broadcast 192.18.255.255 dev redir table local proto kernel scope link src 192.18.0.5
fe80::/64 dev redir proto kernel metric 256 pref medium
local fe80::872:3eff:fe29:d33f dev redir table local proto kernel metric 0 pref medium
multicast ff00::/8 dev redir table local proto kernel metric 256 pref medium
后面是我的 clash 配置:
log-level: info
allow-lan: true
mode: rule
ipv6: false
routing-mark: 6666
profile:
store-selected: true
store-fake-ip: true
tun: # 启用 tun 模式
enable: true
stack: system
auto-route: true
auto-detect-interface: true
dns:
enable: true
ipv6: false
listen: 0.0.0.0:53
default-nameserver:
- 233.5.5.5
- 119.29.29.29
enhanced-mode: fake-ip
nameserver:
- https://dns.alidns.com/dns-query
#后面未相关的配置省略
...
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.