请教一个 Mac 的 Clash 的配置: 希望公司的内部域名走指定网卡, 普通常用域名走自己的热点

283 天前
 tanpengsccd

请教一个 Clash 的配置:

  1. 希望公司的内部域名如 mycorp.com 和 192.168.10.1/24 走指定网卡.
  2. 其他普通常用域名走自己的 UFI 棒子连接公网.

我看 Surge 上可以直接配置 指定部份域名 使用 指定的 NameServer

[Host]
abc.com = 1.2.3.4
*.dev = 6.7.8.9
foo.com = bar.com
mycorp.com = server:192.168.10.1
bar.com = server:8.8.8.8
baz.com = server:https://cloudflare-dns.com/dns-query

https://surge.mitsea.com/dns/local-dns-mapping 想问问 Clash P 核心 或者 meta 核心 有这个功能:域名

  1. 指定部份域名 使用 指定的 NameServer ,其他使用系统 dns 吗?
  2. 指定部份域名 使用 指定的 网卡 比如 WIFI 的 en0 ,其他走 UFI 的公网出口 吗?
2136 次点击
所在节点    宽带症候群
11 条回复
tanpengsccd
283 天前
找到了
```yml
...
dns:
# 对部分域名使用单独的 DNS 服务器
nameserver-policy:
'www.baidu.com': 114.114.114.114
'+.internal.crop.com': system
...
```
tanpengsccd
283 天前
上面只解决问题 1, 但是 2 不行.
tanpengsccd
283 天前
2. 可能可以使用 系统工具
networksetup -setadditionalroutes <networkservice> [ <dest> <mask> <gateway> ]* 来配置.
mohumohu
283 天前
interface-name
tanpengsccd
282 天前
2. clash 有个 mask on socks 特性 https://github.com/Dreamacro/clash/pull/1705
zhinianyuxin0
282 天前
直接找到公司内网的 ip 段,然后添加一个路由不就搞定了吗? 使用 route add 命令很简单就实现了,都不用 clash
tanpengsccd
282 天前
2. 还有个解决方案: https://github.com/Dreamacro/clash/issues/2839 按这个方案我成功了, 但是
例子 nameserver-policy 是 数组时, 我的 verge 的 meta 内核 不能识别, 需要是 dict .
```
nameserver-policy:
"+.internal.com": [172.25.16.1#en0]
```
tanpengsccd
282 天前
@zhinianyuxin0 是的 networksetup -setadditionalroutes <networkservice> [ <dest> <mask> <gateway> ]* 这个直接配置路由确实简单粗暴,但是感觉侵入系统路由了,不是特别方便, 我想如果如果 我关掉 clash 就能恢复默认路由 会优雅一点.
leefor2020
282 天前
静态路由表的方式最好用吧
我 Windows 上就这么实现的
mohumohu
281 天前
https://dreamacro.github.io/clash/configuration/configuration-reference.html
# direct to another interfacename or fwmark, also supported on proxy
- name: en1
type: select
interface-name: en1
routing-mark: 6667
proxies:
- DIRECT
zer
280 天前
换 surge 吧,这个需求实现很简单,以前用了很久,可以配置成外网走 4G ,内网走有线网

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/961620

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX