Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

偶发性打不开部分网站 #292

Closed
hplee0120 opened this issue Feb 13, 2022 · 7 comments
Closed

偶发性打不开部分网站 #292

hplee0120 opened this issue Feb 13, 2022 · 7 comments

Comments

@hplee0120
Copy link

在openwrt上使用mosdns配合梯子
发现在开启IPV6的环境中使用- _prefer_ipv4参数但是IOS15客户端仍然偶发性打不开某些网站,比如V2EX,如果不开启ipv6时一切正常。而在windows上测试似乎没有该问题,所以怀疑是否跟ios设备的dns请求逻辑有关?暂时怀疑的是这个,不确定是不是有没有关系,多刷新几次网页可以正常打开,pymumu/smartdns#616
[附上配置文件和网页打不开时的日志,
log:
level: error
file: ''

plugin:

  • tag: main_server
    type: server
    args:
    entry:
    - _no_ecs
    - lazy_cache
    - _prefer_ipv4
    - main_sequence
    server:
    - protocol: udp
    addr: '[::]:5335'
    - protocol: tcp
    addr: '[::]:5335'

  • tag: main_sequence
    type: sequence
    args:
    exec:
    - if:
    - query_is_local_domain
    - '!_query_is_common'
    exec:
    - forward_local
    - _return
    - if:
    - query_is_non_local_domain
    exec:
    - forward_remote
    - _return
    - forward_local
    - if:
    - response_has_local_ip
    exec:
    - _return
    - forward_remote

  • tag: forward_local
    type: forward
    args:
    upstream:
    - addr: 'https://dns.alidns.com/dns-query'
    - addr: 'https://doh.pub/dns-query'
    bootstrap:
    - 'https://223.5.5.5/dns-query'

  • tag: forward_remote
    type: forward
    args:
    upstream:
    - addr: 'https://doh.opendns.com/dns-query'
    - addr: 'https://dns10.quad9.net/dns-query'
    - addr: 'https://dns.cloudflare.com/dns-query'
    bootstrap:
    - 'https://223.6.6.6/dns-query'

  • tag: lazy_cache
    type: cache
    args:
    size: 512000
    lazy_cache_ttl: 259200

  • tag: query_is_local_domain
    type: query_matcher
    args:
    domain:
    - 'ext:./geosite.dat:cn'

  • tag: query_is_non_local_domain
    type: query_matcher
    args:
    domain:
    - 'ext:./geosite.dat:geolocation-!cn'

  • tag: response_has_local_ip
    type: response_matcher
    args:
    ip:
    - 'ext:./cn.dat:cn'

打开V2EX时的日志
hit {"query": "www.v2ex.com. IN HTTPS 64563 291 127.0.0.1"}
Mon Feb 14 04:53:21 2022 daemon.err mosdns[10396]: 2022-02-13T20:53:21.150Z debug main_server dns_handler/server_handler.go:121 entry returned {"query": "www.v2ex.com. IN HTTPS 64563 291 127.0.0.1", "status": "responded"}
Mon Feb 14 04:53:21 2022 daemon.err mosdns[10396]: 2022-02-13T20:53:21.149Z debug handler/plugin_wrapper.go:76 executing plugin {"query": "www.v2ex.com. IN AAAA 15551 293 127.0.0.1", "tag": "_no_ecs"}
Mon Feb 14 04:53:21 2022 daemon.err mosdns[10396]: 2022-02-13T20:53:21.150Z debug handler/plugin_wrapper.go:76 executing plugin {"query": "www.v2ex.com. IN AAAA 15551 293 127.0.0.1", "tag": "lazy_cache"}
Mon Feb 14 04:53:21 2022 daemon.err mosdns[10396]: 2022-02-13T20:53:21.150Z debug lazy_cache cache/cache.go:156 start lazy cache update {"query": "www.v2ex.com. IN HTTPS 64563 291 127.0.0.1"}
Mon Feb 14 04:53:21 2022 daemon.err mosdns[10396]: 2022-02-13T20:53:21.150Z debug handler/plugin_wrapper.go:76 executing plugin {"query": "www.v2ex.com. IN HTTPS 64563 291 127.0.0.1", "tag": "_prefer_ipv4"}
Mon Feb 14 04:53:21 2022 daemon.err mosdns[10396]: 2022-02-13T20:53:21.150Z debug lazy_cache cache/cache.go:136 cache hit {"query": "www.v2ex.com. IN AAAA 15551 293 127.0.0.1"}
Mon Feb 14 04:53:21 2022 daemon.err mosdns[10396]: 2022-02-13T20:53:21.150Z debug main_server dns_handler/server_handler.go:121 entry returned {"query": "www.v2ex.com. IN AAAA 15551 293 127.0.0.1", "status": "responded"}
Mon Feb 14 04:53:21 2022 daemon.err mosdns[10396]: 2022-02-13T20:53:21.150Z debug handler/plugin_wrapper.go:76 executing plugin {"query": "www.v2ex.com. IN HTTPS 64563 291 127.0.0.1", "tag": "main_sequence"}
Mon Feb 14 04:53:21 2022 daemon.err mosdns[10396]: 2022-02-13T20:53:21.150Z debug handler/plugin_wrapper.go:59 matching query context {"query": "www.v2ex.com. IN HTTPS 64563 291 127.0.0.1", "tag": "query_is_local_domain", "result": false}
Mon Feb 14 04:53:21 2022 daemon.err mosdns[10396]: 2022-02-13T20:53:21.150Z debug handler/plugin_wrapper.go:59 matching query context {"query": "www.v2ex.com. IN HTTPS 64563 291 127.0.0.1", "tag": "_query_is_common", "result": false}
Mon Feb 14 04:53:21 2022 daemon.err mosdns[10396]: 2022-02-13T20:53:21.151Z debug handler/plugin_wrapper.go:76 executing plugin {"query": "www.v2ex.com. IN HTTPS 64563 291 127.0.0.1", "tag": "forward_local"}
Mon Feb 14 04:53:21 2022 daemon.err mosdns[10396]: 2022-02-13T20:53:21.168Z debug forward_local bundled_upstream/bundled_upstream.go:96 response accepted {"query": "www.v2ex.com. IN HTTPS 64563 291 127.0.0.1", "from": "https://dns.alidns.com:443/dns-query"}
Mon Feb 14 04:53:21 2022 daemon.err mosdns[10396]: 2022-02-13T20:53:21.168Z debug handler/plugin_wrapper.go:76 executing plugin {"query": "www.v2ex.com. IN HTTPS 64563 291 127.0.0.1", "tag": "_return"}
Mon Feb 14 04:53:21 2022 daemon.err mosdns[10396]: 2022-02-13T20:53:21.169Z debug lazy_cache cache/cache.go:173 lazy cache updated {"query": "www.v2ex.com. IN HTTPS 64563 291 127.0.0.1"}

Mon Feb 14 04:54:44 2022 daemon.err mosdns[10396]: 2022-02-13T20:54:44.169Z debug handler/plugin_wrapper.go:76 executing plugin {"query": "www.v2ex.com. IN HTTPS 6693 310 127.0.0.1", "tag": "_no_ecs"}
Mon Feb 14 04:54:44 2022 daemon.err mosdns[10396]: 2022-02-13T20:54:44.169Z debug handler/plugin_wrapper.go:76 executing plugin {"query": "www.v2ex.com. IN HTTPS 6693 310 127.0.0.1", "tag": "lazy_cache"}
Mon Feb 14 04:54:44 2022 daemon.err mosdns[10396]: 2022-02-13T20:54:44.169Z debug lazy_cache cache/cache.go:144 expired cache hit {"query": "www.v2ex.com. IN HTTPS 6693 310 127.0.0.1"}
Mon Feb 14 04:54:44 2022 daemon.err mosdns[10396]: 2022-02-13T20:54:44.169Z debug main_server dns_handler/server_handler.go:121 entry returned {"query": "www.v2ex.com. IN HTTPS 6693 310 127.0.0.1", "status": "responded"}
Mon Feb 14 04:54:44 2022 daemon.err mosdns[10396]: 2022-02-13T20:54:44.169Z debug handler/plugin_wrapper.go:76 executing plugin {"query": "www.v2ex.com. IN A 11318 311 127.0.0.1", "tag": "_no_ecs"}
Mon Feb 14 04:54:44 2022 daemon.err mosdns[10396]: 2022-02-13T20:54:44.169Z debug handler/plugin_wrapper.go:76 executing plugin {"query": "www.v2ex.com. IN A 11318 311 127.0.0.1", "tag": "lazy_cache"}
Mon Feb 14 04:54:44 2022 daemon.err mosdns[10396]: 2022-02-13T20:54:44.169Z debug lazy_cache cache/cache.go:156 start lazy cache update {"query": "www.v2ex.com. IN HTTPS 6693 310 127.0.0.1"}
Mon Feb 14 04:54:44 2022 daemon.err mosdns[10396]: 2022-02-13T20:54:44.169Z debug handler/plugin_wrapper.go:76 executing plugin {"query": "www.v2ex.com. IN HTTPS 6693 310 127.0.0.1", "tag": "_prefer_ipv4"}
Mon Feb 14 04:54:44 2022 daemon.err mosdns[10396]: 2022-02-13T20:54:44.169Z debug handler/plugin_wrapper.go:76 executing plugin {"query": "www.v2ex.com. IN HTTPS 6693 310 127.0.0.1", "tag": "main_sequence"}
Mon Feb 14 04:54:44 2022 daemon.err mosdns[10396]: 2022-02-13T20:54:44.169Z debug handler/plugin_wrapper.go:59 matching query context {"query": "www.v2ex.com. IN HTTPS 6693 310 127.0.0.1", "tag": "query_is_local_domain", "result": false}
Mon Feb 14 04:54:44 2022 daemon.err mosdns[10396]: 2022-02-13T20:54:44.170Z debug handler/plugin_wrapper.go:59 matching query context {"query": "www.v2ex.com. IN HTTPS 6693 310 127.0.0.1", "tag": "_query_is_common", "result": false}
Mon Feb 14 04:54:44 2022 daemon.err mosdns[10396]: 2022-02-13T20:54:44.170Z debug handler/plugin_wrapper.go:76 executing plugin {"query": "www.v2ex.com. IN HTTPS 6693 310 127.0.0.1", "tag": "forward_local"}
Mon Feb 14 04:54:44 2022 daemon.err mosdns[10396]: 2022-02-13T20:54:44.169Z debug lazy_cache cache/cache.go:144 expired cache hit {"query": "www.v2ex.com. IN A 11318 311 127.0.0.1"}
Mon Feb 14 04:54:44 2022 daemon.err mosdns[10396]: 2022-02-13T20:54:44.170Z debug main_server dns_handler/server_handler.go:121 entry returned {"query": "www.v2ex.com. IN A 11318 311 127.0.0.1", "status": "responded"}
Mon Feb 14 04:54:44 2022 daemon.err mosdns[10396]: 2022-02-13T20:54:44.170Z debug lazy_cache cache/cache.go:156 start lazy cache update {"query": "www.v2ex.com. IN A 11318 311 127.0.0.1"}
Mon Feb 14 04:54:44 2022 daemon.err mosdns[10396]: 2022-02-13T20:54:44.170Z debug handler/plugin_wrapper.go:76 executing plugin {"query": "www.v2ex.com. IN A 11318 311 127.0.0.1", "tag": "_prefer_ipv4"}
Mon Feb 14 04:54:44 2022 daemon.err mosdns[10396]: 2022-02-13T20:54:44.170Z debug handler/plugin_wrapper.go:76 executing plugin {"query": "www.v2ex.com. IN A 11318 311 127.0.0.1", "tag": "main_sequence"}
Mon Feb 14 04:54:44 2022 daemon.err mosdns[10396]: 2022-02-13T20:54:44.170Z debug handler/plugin_wrapper.go:59 matching query context {"query": "www.v2ex.com. IN A 11318 311 127.0.0.1", "tag": "query_is_local_domain", "result": false}
Mon Feb 14 04:54:44 2022 daemon.err mosdns[10396]: 2022-02-13T20:54:44.170Z debug handler/plugin_wrapper.go:59 matching query context {"query": "www.v2ex.com. IN A 11318 311 127.0.0.1", "tag": "_query_is_common", "result": true}
Mon Feb 14 04:54:44 2022 daemon.err mosdns[10396]: 2022-02-13T20:54:44.170Z debug handler/plugin_wrapper.go:59 matching query context {"query": "www.v2ex.com. IN A 11318 311 127.0.0.1", "tag": "query_is_non_local_domain", "result": true}
Mon Feb 14 04:54:44 2022 daemon.err mosdns[10396]: 2022-02-13T20:54:44.170Z debug handler/plugin_wrapper.go:76 executing plugin {"query": "www.v2ex.com. IN A 11318 311 127.0.0.1", "tag": "forward_remote"}
Mon Feb 14 04:54:44 2022 daemon.err mosdns[10396]: 2022-02-13T20:54:44.188Z debug forward_local bundled_upstream/bundled_upstream.go:96 response accepted {"query": "www.v2ex.com. IN HTTPS 6693 310 127.0.0.1", "from": "https://dns.alidns.com:443/dns-query"}
Mon Feb 14 04:54:44 2022 daemon.err mosdns[10396]: 2022-02-13T20:54:44.188Z debug handler/plugin_wrapper.go:76 executing plugin {"query": "www.v2ex.com. IN HTTPS 6693 310 127.0.0.1", "tag": "_return"}
Mon Feb 14 04:54:44 2022 daemon.err mosdns[10396]: 2022-02-13T20:54:44.188Z debug lazy_cache cache/cache.go:173 lazy cache updated {"query": "www.v2ex.com. IN HTTPS 6693 310 127.0.0.1"}
Mon Feb 14 04:54:44 2022 daemon.err mosdns[10396]: 2022-02-13T20:54:44.197Z debug forward_remote bundled_upstream/bundled_upstream.go:96 response accepted {"query": "www.v2ex.com. IN A 11318 311 127.0.0.1", "from": "https://dns.cloudflare.com:443/dns-query"}
Mon Feb 14 04:54:44 2022 daemon.err mosdns[10396]: 2022-02-13T20:54:44.197Z debug handler/plugin_wrapper.go:76 executing plugin {"query": "www.v2ex.com. IN A 11318 311 127.0.0.1", "tag": "_return"}
Mon Feb 14 04:54:44 2022 daemon.err mosdns[10396]: 2022-02-13T20:54:44.197Z debug lazy_cache cache/cache.go:173 lazy cache updated {"query": "www.v2ex.com. IN A 11318 311 127.0.0.1"}

@hplee0120
Copy link
Author

hplee0120 commented Feb 13, 2022

搜关键词又找到一个类似情况的,这个例子跟我遇到的情况更加相似
https://www.bv2ex.com/t/797235
暂时放弃ipv6了

@IrineSistiana
Copy link
Owner

或者你可以把 type 65 给屏蔽掉。

@hplee0120
Copy link
Author

或者你可以把 type 65 给屏蔽掉。

请问下具体的配置和参数应该怎么写,wiki似乎没有找到相关的参数

@IrineSistiana
Copy link
Owner

看样子那个 type65 是 qtype 65

看 wiki: query_matcher, blackhole。

用 if 组合。

@w22gb8
Copy link

w22gb8 commented Feb 14, 2022

我把aaaa和type65都屏蔽了:

  - tag: 'query_is_type65_aaaa' #type65和aaaa查询
    type: 'query_matcher'
    args:
      qtype: [28, 65] 
      logical_and: false     

@hplee0120
Copy link
Author

用以下参数屏蔽了qtype65,使用了几个小时,现在似乎问题解决了。请大佬帮忙看下配置文件逻辑性可以吗,有啥需要改动的吗
另外看了有一阵子文档了,实在没看懂某些参数带 '',和不带''有啥区别。。比如'127.0.0.1'和127.0.0.1

plugin:

  • tag: main_server
    type: server
    args:
    entry:
    - _no_ecs
    - lazy_cache
    - _prefer_ipv4
    - main_sequence
    server:
    - protocol: udp
    addr: '[::]:5335'
    - protocol: tcp
    addr: '[::]:5335'

  • tag: main_sequence
    type: sequence
    args:
    exec:
    - if:
    - qtype65
    exec:
    - block
    - _return
    - if:
    - query_is_local_domain
    - '!_query_is_common'
    exec:
    - forward_local
    - _return
    - if:
    - query_is_non_local_domain
    exec:
    - forward_remote
    - _return
    - forward_local
    - if:
    - response_has_local_ip
    exec:
    - _return
    - forward_remote

  • tag: forward_local
    type: forward
    args:
    upstream:
    - addr: 'https://dns.alidns.com/dns-query'
    - addr: 'https://doh.pub/dns-query'
    bootstrap:
    - 'https://223.5.5.5/dns-query'

  • tag: forward_remote
    type: forward
    args:
    upstream:
    - addr: 'https://doh.opendns.com/dns-query'
    - addr: 'https://dns10.quad9.net/dns-query'
    - addr: 'https://dns.cloudflare.com/dns-query'
    bootstrap:
    - 'https://223.6.6.6/dns-query'

  • tag: lazy_cache
    type: cache
    args:
    size: 512000
    lazy_cache_ttl: 259200

  • tag: qtype65
    type: query_matcher
    args:
    qtype: [65]

  • tag: block
    type: blackhole
    args:
    rcode: '0'
    ipv4: '127.0.0.1'
    ipv6: '::1'

  • tag: query_is_local_domain
    type: query_matcher
    args:
    domain:
    - 'ext:./geosite.dat:cn'

  • tag: query_is_non_local_domain
    type: query_matcher
    args:
    domain:
    - 'ext:./geosite.dat:geolocation-!cn'

  • tag: response_has_local_ip
    type: response_matcher
    args:
    ip:
    - 'ext:./cn.dat:cn'

@PHCSJC
Copy link

PHCSJC commented Feb 15, 2022

同样遇到过这样的问题,所以我之前就有一个建议,加一个参数,直接屏蔽掉ipv6 dns请求

下面的截图,win10电脑没有ipv6地址,即便加了_prefer_ipv4参数,但是还是会解析出ipv6地址。
QQ截图20220215102756

Repository owner locked and limited conversation to collaborators Feb 15, 2022
@IrineSistiana IrineSistiana converted this issue into discussion #294 Feb 15, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants