[Feature] Mac M1 热点共享 Clash 代理 —— 探索记录-成功-不稳定 #6654
askofcc
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
功能描述 / Feature description
环境
en5连接互联网bridge100,网段192.168.2.0/24utun1024,地址198.18.0.1目标
手机连接 Mac 热点后,流量自动走 Mac 上的 Clash 代理。
探索过程
第一阶段:摸清 ICS 规则结构
Mac 开启热点后,系统 ICS 会自动注入 pf 规则,结构如下:
关键发现:ICS 自己就在 bridge100 上用 rdr,说明 pf 对热点转发流量有效。
第二阶段:pf rdr 方案
在
/etc/pf.conf中注入自定义锚点:规则文件
/etc/pf.anchors/clash_hotspot:结果:
原因: Clash 的 7892 端口只监听 IPv6(
*:7892),pf 把流量转发到127.0.0.1(IPv4),连接失败。第三阶段:TUN 直通方案
放弃 rdr TCP,改为直接把流量路由进 TUN 网卡:
结果:
未解决的问题
可能的后续方向
redir-port绑定0.0.0.0)最后的实现效果是 通过频繁的测试 clash verge 本机的状态 节点的状态 最后手机是可以正常用mac的代理规则的 但是复现麻烦 逻辑麻烦 主要是设置很容易造成本地的代理/节点的状态异常
使用场景 / Use case
手机连接 Mac 热点后,流量自动走 Mac 上的 Clash 代理。
异常点太多 没能力处理
附上一份 不成熟的开机自动脚本 这个脚本会让本机节点出现问题 需要更换节点。或者删除路由
适用系统 / Target OS
Beta Was this translation helpful? Give feedback.
All reactions