V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
yuhu96
V2EX  ›  问与答

clash for windows 的 rule 模式没法连接公司内网怎么破

  •  
  •   yuhu96 · 2022-07-12 10:40:04 +08:00 · 9197 次点击
    这是一个创建于 646 天前的主题,其中的信息可能已经有所发展或是发生改变。
    刚接触这个,用的是 Rule 模式。在公司内网用,打开 system proxy 开关之后网络都能访问,就是公司内网反而上不了,是有什么设置不对吗?我试了一下 settings 里面的 Bypass domain ,把公司内网的域名加上了还是用不了。
    21 条回复    2023-03-06 17:08:48 +08:00
    storyxc
        1
    storyxc  
       2022-07-12 10:55:02 +08:00
    你可以试下改规则,参考 https://lancellc.gitbook.io/clash/
    OOKAMI
        2
    OOKAMI  
       2022-07-12 10:58:13 +08:00   ❤️ 5
    因为 DNS 被接管了

    解决办法:
    1 、mixin 里配置自定义的 hosts 解析
    2 、mixin 里配置关闭 clash 的 DNS
    3 、想保留 clash 的 DNS 接管,那 mixin 里配置 dns 的 nameserver 加上你们公司内网的 DNS 服务器

    上面任选一个处理

    mixin 配置的说明文档
    https://docs.cfw.lbyczf.com/contents/mixin.html#%E7%89%88%E6%9C%AC%E8%A6%81%E6%B1%82
    totoro625
        3
    totoro625  
       2022-07-12 11:01:43 +08:00
    内网域名多么?可以用 clash 内置的 host
    ```
    hosts:
    # '*.clash.dev': 127.0.0.1
    # '.dev': 127.0.0.1
    # 'alpha.clash.dev': '::1'
    ```
    br_wang
        4
    br_wang  
       2022-07-12 11:03:23 +08:00
    一般要配下 nameserver 吧,因为大部分公司内网都有一堆自定义内网域名,用公司的 name server 才能解析。
    onerd
        5
    onerd  
       2022-07-12 11:11:01 +08:00   ❤️ 1
    nameserver-policy:
    '+.company.com': 'x.x.x.x'
    yuhu96
        6
    yuhu96  
    OP
       2022-07-12 13:56:18 +08:00
    @OOKAMI 感谢感谢,是这样子。可以上内网了
    ETO
        7
    ETO  
       2022-07-12 14:20:13 +08:00
    @yuhu96 怎么配的,能把配置贴出来给我看看吗?谢谢
    yuhu96
        8
    yuhu96  
    OP
       2022-07-12 15:53:55 +08:00   ❤️ 1
    @ETO 我是公司的有线网络.先查 DNS ,win10 去设置->网络和 Internet 里查看网络属性找到以太网的 DNS 服务器,在 clash 客户端的 Mixin 设置里加上

    ```
    mixin:
    dns:
    enable: true
    listen: :53
    nameserver:
    - {You dns server}
    ```

    启动的时候把 mixin 模式的开关打开就行
    fx0719
        9
    fx0719  
       2022-07-13 00:04:37 +08:00 via iPhone
    有同样的需求
    ETO
        10
    ETO  
       2022-07-13 14:07:32 +08:00
    @yuhu96 好的,非常感谢,虽然还没成功,不折腾了,就手动切换也挺好的。
    mexingchi
        11
    mexingchi  
       2022-07-13 14:15:58 +08:00
    @yuhu96
    @OOKAMI

    谢谢,困扰好久的问题终于解决了
    zyu0090
        12
    zyu0090  
       2022-07-26 16:16:47 +08:00
    @OOKAMI #2 能解决公司内部网盘、OA ,但是那种特别授权的书库,如知网类的,显示 HTTP 错误 502
    heliushao88
        13
    heliushao88  
       2022-08-08 14:36:05 +08:00
    @totoro625 问下 T 老师

    我公司内网地址没有域名,都是这样的地址 http://23.2.168.21 or http://10.1.200.14:6888/portal ,请问,这样的在 clash 连接为断开的情况下,如何配置,也能同时访问呢?现在是连接 clash 后就提示 [The requested URL "[no URL]", is invalid.] 了
    totoro625
        14
    totoro625  
       2022-08-08 14:50:02 +08:00
    @heliushao88 #13 你是指你的内网在 clash 断开时能访问,连接后就无法访问吗?

    我看你的例子里面 23.2.168.35 是荷兰的 IP ,可能默认走代理了
    clash 配置最后几行找一下
    ```
    - GEOIP,CN,DIRECT
    - MATCH,***
    ```
    类似的字段,在这两个的前面加两行

    ```
    - IP-CIDR,23.2.168.21/32,DIRECT
    - IP-CIDR,10.1.200.14/32,DIRECT
    ```
    # /0 任意 /8./16./24./32 32 表示自己
    最后注意一下对齐就好了
    heliushao88
        15
    heliushao88  
       2022-08-08 15:01:38 +08:00
    @totoro625 谢谢
    poorcai
        16
    poorcai  
       2022-08-15 12:02:44 +08:00
    感谢,解决了我的问题
    @OOKAMI #2
    @yuhu96 #8
    poorcai
        17
    poorcai  
       2022-08-15 12:43:05 +08:00
    刚才还行,现在又不行了。。。
    @yuhu96 #8
    @OOKAMI #2
    OOKAMI
        18
    OOKAMI  
       2022-08-15 13:47:19 +08:00
    @zyu0090 #12
    @poorcai #17

    你们的问题具体什么情况我也不清楚,实在不行就试试将 clash 的 DNS 关掉吧,应该能解决大部分域名解析相关的问题,我自己日常的习惯就是在 mixin 里关掉的,部分特殊情况搭配 hosts 。

    本来配置 nameserver 是比较通用便捷的解决方式,但我自己的情况是公司 nameserver 带毒,配置上去之后也影响使用。

    ```
    mixin: # object
    hosts:
    'example.com': 192.168.1.1
    dns:
    enable: false
    ```
    Reiouf
        19
    Reiouf  
       2023-01-17 11:29:08 +08:00
    @onerd 我设置了好多但是没有效果

    clash. for . windows


    dns: # clash 的 DNS 策略一直都是等待最早返回的 DNS 解析结果,结果就会导致内网 DNS 解析慢的服务器返回响应,没有办法被 client 程序响应
    enable: true
    ipv6: true
    # listen: '0.0.0.0:53' # 开启本地 DNS 监听服务,需要修改系统 DNS 请求
    use-hosts: true
    # enhanced-mode: fake-ip
    # fake-ip-range: 198.18.0.1/16
    nameserver-policy: # 设置特别域名的 DNS 查询域名
    '+.fabu.ai': '192.168.10.254'
    '*.fabu.ai': '192.168.10.254'
    'fabu.ai': '192.168.10.254'
    'login.fabu.ai': '192.168.10.254'
    # default-nameserver: # used by the server to resolve the IP address of the DoH/DoT resolver that you specify in nameserver.

    nameserver: # 可以指定国内加密 DNS 服务器
    - 202.120.224.6
    - 114.114.114.114

    fallback:
    # - 'tls://223.5.5.5:853'
    - 'https://223.5.5.5/dns-query'
    - tls://13800000000.rubyfish.cn:853
    - tls://1.0.0.1:853
    - tls://dns.google:853
    fallback-filter: # 使用 fallback 进行 DNS 流量过滤的规则设置
    geoip: true
    geouip-code: CN
    ipcidr: # 在这个网段内的 IP 地址会被考虑为被污染的 IP
    - 240.0.0.0/4

    # '*.zju.edu.cn':
    Reiouf
        20
    Reiouf  
       2023-01-17 11:37:02 +08:00
    @onerd nameserver-polkicy 设置没有效果,我还是直接用 mixin 直接关掉 dns 算了
    kiritoyui
        21
    kiritoyui  
       2023-03-06 17:08:48 +08:00
    ```
    dns:
    enable: true
    ipv6: true
    listen: 0.0.0.0:53
    enhanced-mode: fake-ip
    fake-ip-range: 198.18.0.1/16
    nameserver:
    - https://1.12.12.12/dns-query
    - https://223.5.5.5/dns-query
    - https://223.6.6.6/dns-query
    - 223.5.5.5
    - 223.6.6.6
    fallback:
    - https://1.1.1.1/dns-query
    - https://dns.google/dns-query
    fallback-filter:
    geoip: true
    geoip-code: CN
    ipcidr:
    - 240.0.0.0/4
    nameserver-policy:
    '+.xxxxx.local': system
    '+.xxxxx.cn': system
    ```
    clashx pro 好像不支持 '+.xxxxx.local': system 这种写法,只能写指定的 ip 而不能用 system 获取系统 dns ( ps:stash 的文档可以这么写)
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1324 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 23:38 · PVG 07:38 · LAX 16:38 · JFK 19:38
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.