vernesong / OpenClash

A Clash Client For OpenWrt
MIT License
16.72k stars 3.09k forks source link

[Bug]fak-ip模式下nameserver不设置公共服务器,内核日志报错。 #4028

Closed liuyie closed 3 days ago

liuyie commented 3 days ago

Verify Steps

OpenClash Version

0.46.029-beta

Bug on Environment

Official OpenWrt, Immortalwrt, Istoreos

OpenWrt Version

23.05.3

Bug on Platform

Linux-amd64(x86-64)

Describe the Bug

fak-ip模式nameserver如果仅设127.0.0.1:5332,内核报错。加选任一个公共服务器后,如119.29.29.29可恢复正常。 在redir-host模式下,不存在上述问题。

To Reproduce

fake-ip模式下: 1、dns设置,使用dnsmasq转发,勾选了禁止dnsmasq缓存dns。 2、覆写设置内:勾选了自定义上游dns服务器,fake-ip持久化和fake-ip-filter,其余均保持默认。 3、nameserver中如果只新建且只有一个自定义,如127.0.0.1:5353#UDP(adguardhome) fallback和default-nameserver均全留空不选。 出现的问题:openclash运行状态显示运行中,内核日志中报错。

OpenClash Log

OpenClash 调试日志

生成时间: 2024-09-18 15:14:04
插件版本: v0.46.029-beta
隐私提示: 上传此日志前请注意检查、屏蔽公网IP、节点、密码等相关敏感信息

#===================== 系统信息 =====================#

主机型号: QEMU Standard PC (i440FX + PIIX, 1996)
固件版本: ImmortalWrt 23.05.3 r27917-81a1f98d5b
LuCI版本: git-24.223.21680-9cf76eb
内核版本: 5.15.162
处理器架构: x86_64

#此项有值时,如不使用IPv6,建议到网络-接口-lan的设置中禁用IPV6的DHCP
IPV6-DHCP: 

DNS劫持: Dnsmasq 转发
#DNS劫持为Dnsmasq时,此项结果应仅有配置文件的DNS监听地址
Dnsmasq转发设置: 127.0.0.1#7874

#===================== 依赖检查 =====================#

dnsmasq-full: 已安装
coreutils: 已安装
coreutils-nohup: 已安装
bash: 已安装
curl: 已安装
ca-certificates: 已安装
ipset: 已安装
ip-full: 已安装
libcap: 已安装
libcap-bin: 已安装
ruby: 已安装
ruby-yaml: 已安装
ruby-psych: 已安装
ruby-pstore: 已安装
kmod-tun(TUN模式): 已安装
luci-compat(Luci >= 19.07): 已安装
kmod-inet-diag(PROCESS-NAME): 已安装
unzip: 已安装
kmod-nft-tproxy: 已安装

#===================== 内核检查 =====================#

运行状态: 运行中
运行内核:Meta
进程pid: 17374
运行权限: 17374: cap_dac_override,cap_net_bind_service,cap_net_admin,cap_net_raw,cap_sys_ptrace,cap_sys_admin,cap_sys_resource=eip
运行用户: nobody
已选择的架构: linux-amd64-v3

#下方无法显示内核版本号时请确认您的内核版本是否正确或者有无权限

Meta内核版本: alpha-ge33d4a4
Meta内核文件: 存在
Meta内核运行权限: 正常

#===================== 插件设置 =====================#

当前配置文件: /etc/openclash/config/KTM.yaml
启动配置文件: /etc/openclash/KTM.yaml
运行模式: fake-ip-mix
默认代理模式: rule
UDP流量转发(tproxy): 停用
自定义DNS: 启用
IPV6代理: 停用
IPV6-DNS解析: 停用
禁用Dnsmasq缓存: 启用
自定义规则: 停用
仅允许内网: 停用
仅代理命中规则流量: 停用
仅允许常用端口流量: 停用
绕过中国大陆IP: 启用
路由本机代理: 启用

#启动异常时建议关闭此项后重试
混合节点: 停用
保留配置: 停用

#启动异常时建议关闭此项后重试
第三方规则: 停用

#===================== 配置文件 =====================#

port: 7890
socks-port: 7891
allow-lan: true

redir-port: 7892
tproxy-port: 7895
mixed-port: 7893
bind-address: "*"
external-ui: "/usr/share/openclash/ui"
ipv6: false
dns:
  enable: true
  ipv6: false
  enhanced-mode: fake-ip
  fake-ip-range: 198.18.0.1/16
  listen: 0.0.0.0:7874
  nameserver:
  - 127.0.0.1:5553
  fake-ip-filter-mode: blacklist
  fake-ip-filter:
  - "*.lan"
  - "*.localdomain"
  - "*.example"

sniffer:
  enable: true
  parse-pure-ip: true
tun:
  enable: true
  stack: mixed
  device: utun
  auto-route: false
  auto-detect-interface: false
  dns-hijack:
  - tcp://any:53
profile:
  store-selected: true
  store-fake-ip: true

#===================== 自定义覆写设置 =====================#

#!/bin/sh
. /usr/share/openclash/ruby.sh
. /usr/share/openclash/log.sh
. /lib/functions.sh

# This script is called by /etc/init.d/openclash
# Add your custom overwrite scripts here, they will be take effict after the OpenClash own srcipts

LOG_OUT "Tip: Start Running Custom Overwrite Scripts..."
LOGTIME=$(echo $(date "+%Y-%m-%d %H:%M:%S"))
LOG_FILE="/tmp/openclash.log"
CONFIG_FILE="$1" #config path

#Simple Demo:
    #General Demo
    #1--config path
    #2--key name
    #3--value
    #ruby_edit "$CONFIG_FILE" "['redir-port']" "7892"
    #ruby_edit "$CONFIG_FILE" "['secret']" "123456"
    #ruby_edit "$CONFIG_FILE" "['dns']['enable']" "true"

    #Hash Demo
    #1--config path
    #2--key name
    #3--hash type value
    #ruby_edit "$CONFIG_FILE" "['experimental']" "{'sniff-tls-sni'=>true}"
    #ruby_edit "$CONFIG_FILE" "['sniffer']" "{'sniffing'=>['tls','http']}"

    #Array Demo:
    #1--config path
    #2--key name
    #3--position(start from 0, end with -1)
    #4--value
    #ruby_arr_insert "$CONFIG_FILE" "['dns']['nameserver']" "0" "114.114.114.114"

    #Array Add From Yaml File Demo:
    #1--config path
    #2--key name
    #3--position(start from 0, end with -1)
    #4--value file path
    #5--value key name in #4 file
    #ruby_arr_add_file "$CONFIG_FILE" "['dns']['fallback-filter']['ipcidr']" "0" "/etc/openclash/custom/openclash_custom_fallback_filter.yaml" "['fallback-filter']['ipcidr']"

#Ruby Script Demo:
    #ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "
    #   begin
    #      Value = YAML.load_file('$CONFIG_FILE');
    #   rescue Exception => e
    #      puts '${LOGTIME} Error: Load File Failed,【' + e.message + '】';
    #   end;

        #General
    #   begin
    #   Thread.new{
    #      Value['redir-port']=7892;
    #      Value['tproxy-port']=7895;
    #      Value['port']=7890;
    #      Value['socks-port']=7891;
    #      Value['mixed-port']=7893;
    #   }.join;

    #   rescue Exception => e
    #      puts '${LOGTIME} Error: Set General Failed,【' + e.message + '】';
    #   ensure
    #      File.open('$CONFIG_FILE','w') {|f| YAML.dump(Value, f)};
    #   end" 2>/dev/null >> $LOG_FILE

exit 0
#===================== 自定义防火墙设置 =====================#

#!/bin/sh
. /usr/share/openclash/log.sh
. /lib/functions.sh

# This script is called by /etc/init.d/openclash
# Add your custom firewall rules here, they will be added after the end of the OpenClash iptables rules

LOG_OUT "Tip: Start Add Custom Firewall Rules..."

exit 0

#===================== Tun设备状态 =====================#

utun: tun

#===================== 端口占用状态 =====================#

tcp        0      0 198.18.0.1:45595        0.0.0.0:*               LISTEN      17374/clash
tcp        0      0 :::7891                 :::*                    LISTEN      17374/clash
tcp        0      0 :::7890                 :::*                    LISTEN      17374/clash
tcp        0      0 :::7893                 :::*                    LISTEN      17374/clash
tcp        0      0 :::7892                 :::*                    LISTEN      17374/clash
tcp        0      0 :::7895                 :::*                    LISTEN      17374/clash
tcp        0      0 :::9090                 :::*                    LISTEN      17374/clash
udp        0      0 :::7874                 :::*                                17374/clash
udp        0      0 :::7891                 :::*                                17374/clash
udp        0      0 :::7892                 :::*                                17374/clash
udp        0      0 :::7893                 :::*                                17374/clash
udp        0      0 :::7895                 :::*                                17374/clash

#===================== 测试本机DNS查询(www.baidu.com) =====================#

Server:     127.0.0.1
Address:    127.0.0.1:53

*** Can't find www.baidu.com: No answer

#===================== 测试内核DNS查询(www.instagram.com) =====================#

Dnsmasq 当前默认 resolv 文件:/tmp/resolv.conf.d/resolv.conf.auto

#===================== /tmp/resolv.conf.auto =====================#

# Interface lan
nameserver 192.168.110.1
# Interface lan6
nameserver *WAN IP*:1

#===================== /tmp/resolv.conf.d/resolv.conf.auto =====================#

# Interface lan
nameserver 192.168.110.1
# Interface lan6
nameserver *WAN IP*:1

#===================== 测试本机网络连接(www.baidu.com) =====================#

#===================== 测试本机网络下载(raw.githubusercontent.com) =====================#

#===================== 最近运行日志(自动切换为Debug模式) =====================#

time="2024-09-18T07:14:36.695725209Z" level=warning msg="[TCP] dial 🚀 节点选择 (match RuleSet/ProxyLite) :54778 --> raw.githubusercontent.com:443 error: :27254 connect error: dns resolve failed: all DNS requests failed, first error: read udp 127.0.0.1:51750->127.0.0.1:5553: i/o timeout"
time="2024-09-18T07:14:36.695595285Z" level=warning msg="[TCP] dial 🐟 漏网之鱼 (match Match/) :47868 --> 94.140.14.15:443 error:  connect error: dns resolve failed: all DNS requests failed, first error: read udp 127.0.0.1:51750->127.0.0.1:5553: i/o timeout"
time="2024-09-18T07:14:36.695596299Z" level=warning msg="[TCP] dial 🐟 漏网之鱼 (match Match/) :47878 --> 94.140.14.15:443 error:  connect error: dns resolve failed: all DNS requests failed, first error: read udp 127.0.0.1:51750->127.0.0.1:5553: i/o timeout"
time="2024-09-18T07:14:36.695610836Z" level=warning msg="[TCP] dial 🐟 漏网之鱼 (match Match/) :47888 --> 94.140.14.15:443 error: :27254 connect error: dns resolve failed: all DNS requests failed, first error: read udp 127.0.0.1:51750->127.0.0.1:5553: i/o timeout"

time="2024-09-18T07:14:36.695581025Z" level=warning msg="[TCP] dial 🐟 漏网之鱼 (match Match/) :47828 --> 94.140.14.15:443 error: :27254 connect error: dns resolve failed: all DNS requests failed, first error: read udp 127.0.0.1:51750->127.0.0.1:5553: i/o timeout"
time="2024-09-18T07:14:36.696734818Z" level=debug msg="[Rule] use default rules"
time="2024-09-18T07:14:36.731596392Z" level=debug msg="[Rule] use default rules"
time="2024-09-18T07:14:36.736685127Z" level=warning msg="[TCP] dial 🐟 漏网之鱼 (match Match/) :47836 --> 94.140.14.15:443 error: :27254 connect error: dns resolve failed: context deadline exceeded"
time="2024-09-18T07:14:36.736724521Z" level=debug msg="[Rule] use default rules"
time="2024-09-18T07:14:37.16155222Z" level=debug msg="[Rule] use default rules"
time="2024-09-18T07:14:37.309665201Z" level=debug msg="[Rule] use default rules"
time="2024-09-18T07:14:37.695275944Z" level=debug msg="[Rule] use default rules"
time="2024-09-18T07:14:37.696325332Z" level=warning msg="[TCP] dial 🐟 漏网之鱼 (match Match/) :47852 --> 94.140.14.15:443 error: :27254 connect error: dns resolve failed: context deadline exceeded"
time="2024-09-18T07:14:37.890836052Z" level=debug msg="Auth success from 192.168.:60108 -> "
time="2024-09-18T07:14:37.890896485Z" level=debug msg="[Rule] use default rules"
time="2024-09-18T07:14:38.038650776Z" level=warning msg="[TCP] dial 🐟 漏网之鱼 (match Match/) :47862 --> 94.140.14.15:443 error: :27254 connect error: dns resolve failed: context deadline exceeded"

time="2024-09-18T07:14:40.026297287Z" level=debug msg="[DNS] resolve webservice.fanart.tv A from udp://127.0.0.1:5553"
time="2024-09-18T07:14:40.026749055Z" level=debug msg="[Rule] use default rules"
time="2024-09-18T07:14:40.038322868Z" level=warning msg="[TCP] dial 🐟 漏网之鱼 (match Match/) 192.168.:60038 --> image.tmdb.org:443 error: :27254 connect error: dns resolve failed: context deadline exceeded"
time="2024-09-18T07:14:40.03947524Z" level=warning msg="[TCP] dial 🐟 漏网之鱼 (match Match/) :47888 --> 94.140.14.15:443 error: :27254 connect error: dns resolve failed: context deadline exceeded"
time="2024-09-18T07:14:40.11917978Z" level=debug msg="Auth success from 192.168.:60130 -> "
time="2024-09-18T07:14:40.119239703Z" level=debug msg="[Rule] use default rules"
time="2024-09-18T07:14:40.119430243Z" level=debug msg="[DNS] resolve image.tmdb.org A from udp://127.0.0.1:5553"
time="2024-09-18T07:14:41.039179907Z" level=warning msg="[TCP] dial 🐟 漏网之鱼 (match Match/) :47892 --> 94.140.14.15:443 error: :27254 connect error: dns resolve failed: context deadline exceeded"
time="2024-09-18T07:14:41.039486511Z" level=debug msg="[Rule] use default rules"
time="2024-09-18T07:14:41.443674493Z" level=warning msg="[TCP] dial 🚀 节点选择 (match RuleSet/ProxyLite) :54778 --> raw.githubusercontent.com:443 error: :27254 connect error: dns resolve failed: context deadline exceeded"
2024-09-18 15:14:36【/tmp/clash_last_version】Download Failed:【curl: (35) OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to raw.githubusercontent.com:443 】
time="2024-09-18T07:14:41.517463487Z" level=debug msg="[Rule] use default rules"
t
time="2024-09-18T07:14:41.695144833Z" level=warning msg="[TCP] dial 🚀 节点选择 (match RuleSet/ProxyLite) :54786 --> raw.githubusercontent.com:443 error: :27254 connect error: dns resolve failed: all DNS requests failed, first error: context deadline exceeded"

time="2024-09-18T07:14:41.695299947Z" level=warning msg="[TCP] dial 📲 电报信息 (match RuleSet/Telegram) :56637 --> 91.108.56.198:443 error: :27254 connect error: dns resolve failed: all DNS requests failed, first error: context deadline exceeded"
time="2024-09-18T07:14:41.695317268Z" level=warning msg="[TCP] dial 🐟 漏网之鱼 (match Match/) :59792 --> 94.140.14.15:443 error: :27254 connect error: dns resolve failed: all DNS requests failed, first error: context deadline exceeded"

time="2024-09-18T07:14:41.695325099Z" level=warning msg="[TCP] dial 📲 电报信息 (match RuleSet/Telegram) :56638 --> 91.108.56.198:443 error: :27254 connect error: dns resolve failed: all DNS requests failed, first error: context deadline exceeded"

time="2024-09-18T07:14:41.69533375Z" level=warning msg="[TCP] dial 🐟 漏网之鱼 (match Match/) :59816 --> 94.140.14.15:443 error: :27254 connect error: dns resolve failed: all DNS requests failed, first error: context deadline exceeded"
time="2024-09-18T07:14:41.695323724Z" level=warning msg="[TCP] dial 📲 电报信息 (match RuleSet/Telegram) 192..:60108 --> api.telegram.org:443 error: :27254 connect error: dns resolve failed: all DNS requests failed, first error: context deadline exceeded"

time="2024-09-18T07:14:41.695331599Z" level=warning msg="[TCP] dial 📲 电报信息 (match RuleSet/Telegram) :56639 --> 91.108.56.198:443 error: :27254 connect error: dns resolve failed: all DNS requests failed, first error: context deadline exceeded"
time="2024-09-18T07:14:41.695332207Z" level=warning msg="[TCP] dial 🐟 漏网之鱼 (match Match/) :56640 --> 176.100.51.107:443 error: :27254 connect error: dns resolve failed: all DNS requests failed, first error: context deadline exceeded"

time="2024-09-18T07:14:41.695324324Z" level=warning msg="[TCP] dial 🐟 漏网之鱼 (match Match/) :59808 --> 94.140.14.15:443 error: :27254 connect error: dns resolve failed: all DNS requests failed, first error: context deadline exceeded"
time="2024-09-18T07:14:41.695642052Z" level=debug msg="[Rule] use default rules"
time="2024-09-18T07:14:41.732469635Z" level=warning msg="[TCP] dial 📲 电报信息 (match RuleSet/Telegram) :56635 --> 91.108.56.198:443 error: :27254 connect error: dns resolve failed: context deadline exceeded"
time="2024-09-18T07:14:41.73769166Z" level=warning msg="[TCP] dial 🐟 漏网之鱼 (match Match/) :59784 --> 94.140.14.15:443 error: :27254 connect error: dns resolve failed: context deadline exceeded"
time="2024-09-18T07:14:41.956498984Z" level=debug msg="[Rule] use default rules"
time="2024-09-18T07:14:42.162412764Z" level=warning msg="[TCP] dial 📲 电报信息 (match RuleSet/Telegram) :56636 --> 91.108.56.198:443 error: :27254 connect error: dns resolve failed: context deadline exceeded"
time="2024-09-18T07:14:42.309959686Z" level=warning msg="[TCP] dial 📲 电报信息 (match RuleSet/Telegram) :56637 --> 91.108.56.198:443 error: :27254 connect error: dns resolve failed: context deadline exceeded"
time="2024-09-18T07:14:42.696052445Z" level=warning msg="[TCP] dial 🐟 漏网之鱼 (match Match/) :59792 --> 94.140.14.15:443 error: :27254 connect error: dns resolve failed: context deadline exceeded"
time="2024-09-18T07:14:42.696937825Z" level=debug msg="[Rule] use default rules"
time="2024-09-18T07:14:42.738254242Z" level=debug msg="[Rule] use default rules"
time="2024-09-18T07:14:42.891675834Z" level=warning msg="[TCP] dial 📲 电报信息 (match RuleSet/Telegram) 192..:60108 --> api.telegram.org:443 error: :27254 connect error: dns resolve failed: context deadline exceeded"
time="2024-09-18T07:14:43.028021346Z" level=debug msg="[Rule] use default rules"
time="2024-09-18T07:14:43.039409961Z" level=warning msg="[TCP] dial 🐟 漏网之鱼 (match Match/) :59808 --> 94.140.14.15:443 error: :27254 connect error: dns resolve failed: context deadline exceeded"
time="2024-09-18T07:14:43.120807589Z" level=debug msg="[Rule] use default rules"

#===================== 最近运行日志获取完成(自动切换为silent模式) =====================#

#===================== 活动连接信息 =====================#


### OpenClash Config

_No response_

### Expected Behavior

请进行处理这个bug,谢谢。能够可以不用临时加选一个公共服务器的方式来暂时代替这个问题。

### Additional Context

_No response_
vernesong commented 3 days ago

ad里面的dns填ip

jjaychen1e commented 2 days ago

ad里面的dns填ip

@vernesong 我这边经常会出 connect error: all DNS requests failed, first error: dns: bad rdata,是一个问题吗?

tadi-huang commented 1 day ago

ad里面的dns填ip

ad是指在哪里