vernesong / OpenClash

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

最新版本DNS劫持失败 #1570

Closed ghost closed 3 years ago

ghost commented 3 years ago

1.表现为路由器本身可以正常访问网络,但下挂的局域网设备域名解析全部失败, 2.在路由器上dig domain @127.0.0.1看,或者dig domain @127.0.0.1 -p 7874(Clash的DNS端口),DNS解析是正常的,fake ip也在工作,clash也在工作,甚至web ui上的节点测速都可以正常进行。 在路由器上访问各种IP测试节点看,分流规则也是正常工作的。 3.但在局域网设备上dig domain @网关IP,无法返回任何结果。

最近一次的release版本是正常的,不清楚具体是之后的哪个版本引入的问题。

调试日志如下:

OpenClash 调试日志

生成时间: 2021-08-25 21:25:32
插件版本: v0.43.01-beta
隐私提示: 上传此日志前请注意检查、屏蔽公网IP、节点、密码等相关敏感信息

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

主机型号: To be filled by O.E.M. To be filled by O.E.M.
固件版本: OpenWrt 21.02.0-rc4 r16256-2d5ee43dc6
LuCI版本: git-20.074.84698-ead5e81
内核版本: 5.4.137
处理器架构: x86_64

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

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

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

dnsmasq-full: 已安装
coreutils: 已安装
coreutils-nohup: 已安装
bash: 已安装
curl: 已安装
ca-certificates: 已安装
ipset: 已安装
ip-full: 已安装
iptables-mod-tproxy: 已安装
kmod-ipt-tproxy: 已安装
iptables-mod-extra: 已安装
kmod-ipt-extra: 已安装
libcap: 已安装
libcap-bin: 已安装
ruby: 已安装
ruby-yaml: 已安装
ruby-psych: 已安装
ruby-pstore: 已安装
ruby-dbm: 已安装
kmod-tun(TUN模式): 已安装
luci-compat(Luci-19.07): 已安装

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

运行状态: 运行中
进程pid: 20297
运行权限: 20297: cap_dac_override,cap_net_bind_service,cap_net_admin,cap_net_raw,cap_sys_resource=eip
运行用户: nobody
已选择的架构: linux-amd64

#下方无法显示内核版本号时请确认您的内核版本是否正确或者有无权限
Tun内核版本: 2021.07.03
Tun内核文件: 存在
Tun内核运行权限: 正常

Game内核版本: 20210310-83-g5eab7b1
Game内核文件: 存在
Game内核运行权限: 正常

Dev内核版本: v1.6.5-29-g410772e
Dev内核文件: 存在
Dev内核运行权限: 正常

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

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

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

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

#===================== 自定义规则 一 =====================#
#
#===================== 自定义规则 二 =====================#
#
#===================== 配置文件 =====================#

port: 7890
socks-port: 7891
redir-port: 7892
dns:
  enable: true
  ipv6: false
  listen: 127.0.0.1:7874
  enhanced-mode: fake-ip
  fake-ip-range: 198.18.0.1/16
  nameserver:
  - 119.29.29.29
  - 223.5.5.5
  - 1.2.4.8
  fake-ip-filter:
  - "*.lan"
  - time.windows.com
  - time.nist.gov
  - time.apple.com
  - time.asia.apple.com
  - "*.ntp.org.cn"
  - "*.openwrt.pool.ntp.org"
  - time1.cloud.tencent.com
  - time.ustc.edu.cn
  - pool.ntp.org
  - ntp.ubuntu.com
  - ntp.aliyun.com
  - ntp1.aliyun.com
  - ntp2.aliyun.com
  - ntp3.aliyun.com
  - ntp4.aliyun.com
  - ntp5.aliyun.com
  - ntp6.aliyun.com
  - ntp7.aliyun.com
  - time1.aliyun.com
  - time2.aliyun.com
  - time3.aliyun.com
  - time4.aliyun.com
  - time5.aliyun.com
  - time6.aliyun.com
  - time7.aliyun.com
  - "*.time.edu.cn"
  - time1.apple.com
  - time2.apple.com
  - time3.apple.com
  - time4.apple.com
  - time5.apple.com
  - time6.apple.com
  - time7.apple.com
  - time1.google.com
  - time2.google.com
  - time3.google.com
  - time4.google.com
  - music.163.com
  - "*.music.163.com"
  - "*.126.net"
  - musicapi.taihe.com
  - music.taihe.com
  - songsearch.kugou.com
  - trackercdn.kugou.com
  - "*.kuwo.cn"
  - api-jooxtt.sanook.com
  - api.joox.com
  - joox.com
  - y.qq.com
  - "*.y.qq.com"
  - streamoc.music.tc.qq.com
  - mobileoc.music.tc.qq.com
  - isure.stream.qqmusic.qq.com
  - dl.stream.qqmusic.qq.com
  - aqqmusic.tc.qq.com
  - amobile.music.tc.qq.com
  - "*.xiami.com"
  - "*.music.migu.cn"
  - music.migu.cn
  - "*.msftconnecttest.com"
  - "*.msftncsi.com"
  - localhost.ptlogin2.qq.com
  - "*.*.*.srv.nintendo.net"
  - "*.*.stun.playstation.net"
  - xbox.*.*.microsoft.com
  - "*.*.xboxlive.com"
proxy-groups:
- name: ROUTE
  type: fallback
  disable-udp: false
  proxies:
  - FAST
  - DIRECT
  url: http://cp.cloudflare.com/generate_204
  interval: '1800'
- name: FAST
  type: url-test
  disable-udp: false
  proxies:
  - CN-HK1
  - CN-HK2
  - CN-US1
  - CN-TW1
  - CN-UK1
  url: http://cp.cloudflare.com/generate_204
  interval: '1800'
  tolerance: '0'
- name: HK
  type: url-test
  disable-udp: false
  proxies:
  - CN-HK1
  - CN-HK2
  url: http://cp.cloudflare.com/generate_204
  interval: '1800'
- name: US
  type: fallback
  disable-udp: false
  proxies:
  - CN-US1
  url: http://cp.cloudflare.com/generate_204
  interval: '1800'
- name: TW
  type: fallback
  disable-udp: false
  proxies:
  - CN-TW1
  url: http://cp.cloudflare.com/generate_204
  interval: '1800'
- name: UK
  type: fallback
  disable-udp: false
  proxies:
  - CN-UK1
  url: http://cp.cloudflare.com/generate_204
  interval: '1800'
- name: NETFLIX
  type: select
  disable-udp: false
  proxies:
  - TW
  - HK
  - US
  - UK
rules:
- RULE-SET,ITV,UK
- RULE-SET,All-4,UK
- RULE-SET,BBC-iPlayer,UK
- RULE-SET,HBO(By lhie1),US
- RULE-SET,Hulu(By lhie1),US
- RULE-SET,Disney Plus,US
- RULE-SET,PBS(By lhie1),US
- RULE-SET,Now-E,HK
- RULE-SET,ViuTV(By lhie1),HK
- RULE-SET,myTV SUPER,HK
- RULE-SET,KKTV(By lhie1),TW
- RULE-SET,LINE-TV,TW
- RULE-SET,Bahamut(By lhie1),TW
- RULE-SET,广告规则(By lhie1),REJECT
- RULE-SET,隐私规则合集,REJECT
- RULE-SET,反劫持规则,REJECT
- DOMAIN-SUFFIX,local,DIRECT
- IP-CIDR,127.0.0.0/8,DIRECT
- IP-CIDR,172.16.0.0/12,DIRECT
- IP-CIDR,192.168.0.0/16,DIRECT
- IP-CIDR,10.0.0.0/8,DIRECT
- IP-CIDR,100.64.0.0/10,DIRECT
- IP-CIDR,198.18.0.1/16,REJECT,no-resolve
- GEOIP,CN,DIRECT
- MATCH,ROUTE
tproxy-port: 7895
mixed-port: 7893
mode: rule
log-level: silent
allow-lan: true
external-controller: 0.0.0.0:9090
bind-address: "*"
external-ui: "/usr/share/openclash/dashboard"
ipv6: false
tun:
  enable: true
  stack: system
  dns-hijack:
  - tcp://8.8.8.8:53
  - tcp://8.8.4.4:53
profile:
  store-selected: true
rule-providers:
  反劫持规则:
    type: http
    behavior: classical
    path: "/etc/openclash/rule_provider/Hijacking.yaml"
    url: https://cdn.jsdelivr.net/gh/DivineEngine/Profiles@master/Clash/RuleSet/Guard/Hijacking.yaml
    interval: 86400
  隐私规则合集:
    type: http
    behavior: classical
    path: "/etc/openclash/rule_provider/Privacy.yaml"
    url: https://cdn.jsdelivr.net/gh/DivineEngine/Profiles@master/Clash/RuleSet/Guard/Privacy.yaml
    interval: 86400
  广告规则(By lhie1):
    type: http
    behavior: classical
    path: "/etc/openclash/rule_provider/Reject.yaml"
    url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Reject.yaml
    interval: 86400
  Bahamut(By lhie1):
    type: http
    behavior: classical
    path: "/etc/openclash/rule_provider/Bahamut-lhie1.yaml"
    url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Media/Bahamut.yaml
    interval: 86400
  LINE-TV:
    type: http
    behavior: classical
    path: "/etc/openclash/rule_provider/LINE-TV.yaml"
    url: https://cdn.jsdelivr.net/gh/DivineEngine/Profiles@master/Clash/RuleSet/StreamingMedia/Video/LINE-TV.yaml
    interval: 86400
  KKTV(By lhie1):
    type: http
    behavior: classical
    path: "/etc/openclash/rule_provider/KKTV-lhie1.yaml"
    url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Media/KKTV.yaml
    interval: 86400
  myTV SUPER:
    type: http
    behavior: classical
    path: "/etc/openclash/rule_provider/myTV SUPER.yaml"
    url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Media/myTV%20SUPER.yaml
    interval: 86400
  ViuTV(By lhie1):
    type: http
    behavior: classical
    path: "/etc/openclash/rule_provider/ViuTV-lhie1.yaml"
    url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Media/ViuTV.yaml
    interval: 86400
  Now-E:
    type: http
    behavior: classical
    path: "/etc/openclash/rule_provider/Now-E.yaml"
    url: https://cdn.jsdelivr.net/gh/DivineEngine/Profiles@master/Clash/RuleSet/StreamingMedia/Video/Now-E.yaml
    interval: 86400
  PBS(By lhie1):
    type: http
    behavior: classical
    path: "/etc/openclash/rule_provider/PBS-lhie1.yaml"
    url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Media/PBS.yaml
    interval: 86400
  Disney Plus:
    type: http
    behavior: classical
    path: "/etc/openclash/rule_provider/Disney Plus.yaml"
    url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Media/Disney%20Plus.yaml
    interval: 86400
  Hulu(By lhie1):
    type: http
    behavior: classical
    path: "/etc/openclash/rule_provider/Hulu-lhie1.yaml"
    url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Media/Hulu.yaml
    interval: 86400
  HBO(By lhie1):
    type: http
    behavior: classical
    path: "/etc/openclash/rule_provider/HBO-lhie1.yaml"
    url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Media/HBO.yaml
    interval: 86400
  BBC-iPlayer:
    type: http
    behavior: classical
    path: "/etc/openclash/rule_provider/BBC-iPlayer.yaml"
    url: https://cdn.jsdelivr.net/gh/DivineEngine/Profiles@master/Clash/RuleSet/StreamingMedia/Video/BBC-iPlayer.yaml
    interval: 86400
  All-4:
    type: http
    behavior: classical
    path: "/etc/openclash/rule_provider/All-4.yaml"
    url: https://cdn.jsdelivr.net/gh/DivineEngine/Profiles@master/Clash/RuleSet/StreamingMedia/Video/All-4.yaml
    interval: 86400
  ITV:
    type: http
    behavior: classical
    path: "/etc/openclash/rule_provider/ITV.yaml"
    url: https://cdn.jsdelivr.net/gh/DivineEngine/Profiles@master/Clash/RuleSet/StreamingMedia/Video/ITV.yaml
    interval: 86400
interface-name: eth0

#===================== 防火墙设置 =====================#

#IPv4 NAT chain

# Generated by iptables-save v1.8.7 on Wed Aug 25 21:25:34 2021
*nat
:PREROUTING ACCEPT [451:53799]
:INPUT ACCEPT [267:20984]
:OUTPUT ACCEPT [866:64682]
:POSTROUTING ACCEPT [570:45488]
:MINIUPNPD - [0:0]
:MINIUPNPD-POSTROUTING - [0:0]
:openclash - [0:0]
:openclash_output - [0:0]
:postrouting_lan_rule - [0:0]
:postrouting_rule - [0:0]
:postrouting_wan_rule - [0:0]
:prerouting_lan_rule - [0:0]
:prerouting_rule - [0:0]
:prerouting_wan_rule - [0:0]
:zone_lan_postrouting - [0:0]
:zone_lan_prerouting - [0:0]
:zone_wan_postrouting - [0:0]
:zone_wan_prerouting - [0:0]
-A PREROUTING -d 8.8.4.4/32 -p tcp -m tcp --dport 53 -j ACCEPT
-A PREROUTING -d 8.8.8.8/32 -p tcp -m tcp --dport 53 -j ACCEPT
-A PREROUTING -d 8.8.4.4/32 -p tcp -m tcp --dport 53 -j ACCEPT
-A PREROUTING -d 8.8.8.8/32 -p tcp -m tcp --dport 53 -j ACCEPT
-A PREROUTING -p tcp -m tcp --dport 53 -m comment --comment dns_hijack -j REDIRECT --to-ports 7874
-A PREROUTING -p udp -m udp --dport 53 -m comment --comment dns_hijack -j REDIRECT --to-ports 7874
-A PREROUTING -m comment --comment "!fw3: Custom prerouting rule chain" -j prerouting_rule
-A PREROUTING -i br-lan -m comment --comment "!fw3" -j zone_lan_prerouting
-A PREROUTING -i eth0 -m comment --comment "!fw3" -j zone_wan_prerouting
-A PREROUTING -p tcp -j openclash
-A OUTPUT -j openclash_output
-A OUTPUT -j openclash_output
-A POSTROUTING -s 10.242.0.0/16 -j MASQUERADE
-A POSTROUTING -o ztzlgmpcam -j MASQUERADE
-A POSTROUTING -m comment --comment "!fw3: Custom postrouting rule chain" -j postrouting_rule
-A POSTROUTING -o br-lan -m comment --comment "!fw3" -j zone_lan_postrouting
-A POSTROUTING -o eth0 -m comment --comment "!fw3" -j zone_wan_postrouting
-A openclash -m set --match-set localnetwork dst -j RETURN
-A openclash -p tcp -j REDIRECT --to-ports 7892
-A openclash_output -m set --match-set localnetwork dst -j RETURN
-A openclash_output -d 198.18.0.0/16 -p tcp -m owner ! --uid-owner 65534 -j REDIRECT --to-ports 7892
-A openclash_output -p tcp -m owner ! --uid-owner 65534 -j REDIRECT --to-ports 7892
-A zone_lan_postrouting -m comment --comment "!fw3: Custom lan postrouting rule chain" -j postrouting_lan_rule
-A zone_lan_prerouting -m comment --comment "!fw3: Custom lan prerouting rule chain" -j prerouting_lan_rule
-A zone_wan_postrouting -m comment --comment "!fw3: Custom wan postrouting rule chain" -j postrouting_wan_rule
-A zone_wan_postrouting -j MINIUPNPD-POSTROUTING
-A zone_wan_postrouting -m comment --comment "!fw3" -j MASQUERADE
-A zone_wan_prerouting -m comment --comment "!fw3: Custom wan prerouting rule chain" -j prerouting_wan_rule
-A zone_wan_prerouting -j MINIUPNPD
COMMIT
# Completed on Wed Aug 25 21:25:34 2021

#IPv4 Mangle chain

# Generated by iptables-save v1.8.7 on Wed Aug 25 21:25:34 2021
*mangle
:PREROUTING ACCEPT [25731:5054919]
:INPUT ACCEPT [22339:4128835]
:FORWARD ACCEPT [3225:915619]
:OUTPUT ACCEPT [31508:6966344]
:POSTROUTING ACCEPT [34733:7881963]
:openclash - [0:0]
:openclash_dns_hijack - [0:0]
:openclash_output - [0:0]
-A PREROUTING -p udp -j openclash
-A PREROUTING -p tcp -m tcp --dport 53 -j openclash_dns_hijack
-A PREROUTING -p udp -j openclash
-A PREROUTING -p tcp -m tcp --dport 53 -j openclash_dns_hijack
-A FORWARD -o eth0 -p tcp -m tcp --tcp-flags SYN,RST SYN -m comment --comment "!fw3: Zone wan MTU fixing" -j TCPMSS --clamp-mss-to-pmtu
-A FORWARD -i eth0 -p tcp -m tcp --tcp-flags SYN,RST SYN -m comment --comment "!fw3: Zone wan MTU fixing" -j TCPMSS --clamp-mss-to-pmtu
-A OUTPUT -j openclash_output
-A OUTPUT -j openclash_output
-A openclash -p udp -m udp --dport 500 -j RETURN
-A openclash -p udp -m udp --dport 68 -j RETURN
-A openclash -m set --match-set localnetwork dst -j RETURN
-A openclash -j MARK --set-xmark 0x162/0xffffffff
-A openclash_dns_hijack -d 8.8.8.8/32 -j MARK --set-xmark 0x162/0xffffffff
-A openclash_dns_hijack -d 8.8.4.4/32 -j MARK --set-xmark 0x162/0xffffffff
-A openclash_output -p udp -m udp --sport 500 -j RETURN
-A openclash_output -p udp -m udp --sport 68 -j RETURN
-A openclash_output -m set --match-set localnetwork dst -j RETURN
-A openclash_output -d 198.18.0.0/16 -p udp -m owner ! --uid-owner 65534 -j MARK --set-xmark 0x162/0xffffffff
COMMIT
# Completed on Wed Aug 25 21:25:34 2021

#IPv6 NAT chain

#IPv6 Mangle chain

# Generated by ip6tables-save v1.8.7 on Wed Aug 25 21:25:34 2021
*mangle
:PREROUTING ACCEPT [635:74276]
:INPUT ACCEPT [399:34408]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [180:22864]
:POSTROUTING ACCEPT [180:22864]
-A FORWARD -o eth0 -p tcp -m tcp --tcp-flags SYN,RST SYN -m comment --comment "!fw3: Zone wan MTU fixing" -j TCPMSS --clamp-mss-to-pmtu
-A FORWARD -i eth0 -p tcp -m tcp --tcp-flags SYN,RST SYN -m comment --comment "!fw3: Zone wan MTU fixing" -j TCPMSS --clamp-mss-to-pmtu
COMMIT
# Completed on Wed Aug 25 21:25:34 2021

#===================== IPSET状态 =====================#

Name: localnetwork

#===================== 路由表状态 =====================#

#route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 eth0
10.242.0.0      0.0.0.0         255.255.0.0     U     0      0        0 ztzlgmpcam
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
192.168.22.0    10.242.100.130  255.255.255.0   UG    0      0        0 ztzlgmpcam
192.168.33.0    10.242.100.69   255.255.255.0   UG    0      0        0 ztzlgmpcam
192.168.44.0    10.242.100.99   255.255.255.0   UG    0      0        0 ztzlgmpcam
192.168.66.0    10.242.100.37   255.255.255.0   UG    0      0        0 ztzlgmpcam
192.168.77.0    10.242.100.179  255.255.255.0   UG    0      0        0 ztzlgmpcam
192.168.88.0    10.242.100.216  255.255.255.0   UG    0      0        0 ztzlgmpcam
192.168.99.0    0.0.0.0         255.255.255.0   U     0      0        0 br-lan
198.18.0.0      0.0.0.0         255.255.0.0     U     0      0        0 utun
#ip route list
default via 192.168.1.1 dev eth0 proto static src 192.168.1.3 
10.242.0.0/16 dev ztzlgmpcam proto kernel scope link src 10.242.100.121 
192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.3 
192.168.22.0/24 via 10.242.100.130 dev ztzlgmpcam proto static 
192.168.33.0/24 via 10.242.100.69 dev ztzlgmpcam proto static 
192.168.44.0/24 via 10.242.100.99 dev ztzlgmpcam proto static 
192.168.66.0/24 via 10.242.100.37 dev ztzlgmpcam proto static 
192.168.77.0/24 via 10.242.100.179 dev ztzlgmpcam proto static 
192.168.88.0/24 via 10.242.100.216 dev ztzlgmpcam proto static 
192.168.99.0/24 dev br-lan proto kernel scope link src 192.168.99.1 
198.18.0.0/16 dev utun proto kernel scope link src 198.18.0.1 
#ip rule show
0:  from all lookup local
32764:  from all fwmark 0x162 lookup 354
32765:  from all fwmark 0x162 lookup 354
32766:  from all lookup main
32767:  from all lookup default

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

ztzlgmpcam: tap
utun: tun

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

tcp        0      0 198.18.0.1:7777         0.0.0.0:*               LISTEN      20297/clash
tcp        0      0 :::9090                 :::*                    LISTEN      20297/clash
tcp        0      0 :::7890                 :::*                    LISTEN      20297/clash
tcp        0      0 :::7891                 :::*                    LISTEN      20297/clash
tcp        0      0 :::7892                 :::*                    LISTEN      20297/clash
tcp        0      0 :::7893                 :::*                    LISTEN      20297/clash
tcp        0      0 :::7895                 :::*                    LISTEN      20297/clash
udp        0      0 198.18.0.1:7777         0.0.0.0:*                           20297/clash
udp        0      0 127.0.0.1:7874          0.0.0.0:*                           20297/clash
udp        0      0 :::7891                 :::*                                20297/clash
udp        0      0 :::7892                 :::*                                20297/clash
udp        0      0 :::7893                 :::*                                20297/clash
udp        0      0 :::7895                 :::*                                20297/clash

#===================== 测试本机DNS查询 =====================#

Server:     127.0.0.1
Address:    127.0.0.1#53

Name:      www.baidu.com
Address 1: 198.18.0.5
*** Can't find www.baidu.com: No answer

#===================== resolv.conf.d =====================#

# Interface wan
nameserver 119.29.29.29
nameserver 223.5.5.5
nameserver 114.114.114.114

#===================== 测试本机网络连接 =====================#

HTTP/1.1 200 OK
Accept-Ranges: bytes
Cache-Control: private, no-cache, no-store, proxy-revalidate, no-transform
Connection: keep-alive
Content-Length: 277
Content-Type: text/html
Date: Wed, 25 Aug 2021 13:25:34 GMT
Etag: "575e1f7b-115"
Last-Modified: Mon, 13 Jun 2016 02:50:35 GMT
Pragma: no-cache
Server: bfe/1.0.8.18

#===================== 测试本机网络下载 =====================#

HTTP/1.1 200 OK
Connection: keep-alive
Content-Length: 80
Cache-Control: max-age=300
Content-Security-Policy: default-src 'none'; style-src 'unsafe-inline'; sandbox
Content-Type: text/plain; charset=utf-8
ETag: "b334e6e49e12c3ae888bc6bb2bf85a16f85b362bdba1d0ddd01a63e4fb92bc2f"
Strict-Transport-Security: max-age=31536000
X-Content-Type-Options: nosniff
X-Frame-Options: deny
X-XSS-Protection: 1; mode=block
X-GitHub-Request-Id: 2A44:0B46:67128F:79D36A:61240A2D
Accept-Ranges: bytes
Date: Wed, 25 Aug 2021 13:25:35 GMT
Via: 1.1 varnish
X-Served-By: cache-hkg17930-HKG
X-Cache: HIT
X-Cache-Hits: 1
X-Timer: S1629897935.158391,VS0,VE1
Vary: Authorization,Accept-Encoding
Access-Control-Allow-Origin: *
X-Fastly-Request-ID: 3f780aea61cfd82dd0caca2d7a9d6fd423487de8
Expires: Wed, 25 Aug 2021 13:30:35 GMT
Source-Age: 192

#===================== 最近运行日志 =====================#

time="2021-08-25T12:46:14Z" level=info msg="[TCP] 192.168.1.3:57692 --> 185.199.108.133 match Match() using ROUTE[CN-HK2]"
2021-08-25 20:46:21 OpenClash Stoping...
2021-08-25 20:46:21 Step 1: Backup The Current Groups State...
2021-08-25 20:46:21 Step 2: Delete OpenClash Firewall Rules...
2021-08-25 20:46:21 Step 3: Close The OpenClash Daemons...
2021-08-25 20:46:21 Step 4: Close The Clash Core Process...
2021-08-25 20:46:21 Step 5: Restart Dnsmasq...
2021-08-25 20:46:25 Step 6: Delete OpenClash Residue File...
2021-08-25 20:46:25 OpenClash Start Running...
2021-08-25 20:46:25 Step 1: Get The Configuration...
2021-08-25 20:46:25 Step 2: Check The Components...
2021-08-25 20:46:25 Step 3: Modify The Config File...
2021-08-25 20:46:26 Setting Fake IP Filter...
2021-08-25 20:46:30 Reload OpenClash Firewall Rules...
2021-08-25 20:46:32 Step 4: Start Running The Clash Core...
2021-08-25 20:46:32 Detected The Exclusive Function of The TUN Core, Use TUN Core to Start...
2021-08-25 20:46:36 Step 5: Check The Core Status...
time="2021-08-25T12:46:36Z" level=info msg="Start initial compatible provider TW"
time="2021-08-25T12:46:36Z" level=info msg="Start initial compatible provider ROUTE"
time="2021-08-25T12:46:36Z" level=info msg="Start initial compatible provider NETFLIX"
time="2021-08-25T12:46:36Z" level=info msg="Start initial compatible provider FAST"
time="2021-08-25T12:46:36Z" level=info msg="Start initial compatible provider UK"
time="2021-08-25T12:46:36Z" level=info msg="Start initial compatible provider US"
time="2021-08-25T12:46:36Z" level=info msg="Start initial compatible provider HK"
time="2021-08-25T12:46:36Z" level=info msg="Start initial rule provider PBS(By lhie1)"
time="2021-08-25T12:46:36Z" level=info msg="Start initial rule provider KKTV(By lhie1)"
time="2021-08-25T12:46:36Z" level=info msg="Start initial rule provider All-4"
time="2021-08-25T12:46:36Z" level=info msg="Start initial rule provider 隐私规则合集"
time="2021-08-25T12:46:36Z" level=info msg="Start initial rule provider Bahamut(By lhie1)"
time="2021-08-25T12:46:36Z" level=info msg="Start initial rule provider 反劫持规则"
time="2021-08-25T12:46:36Z" level=info msg="Start initial rule provider Now-E"
time="2021-08-25T12:46:36Z" level=info msg="Start initial rule provider ViuTV(By lhie1)"
time="2021-08-25T12:46:36Z" level=info msg="Start initial rule provider Disney Plus"
time="2021-08-25T12:46:36Z" level=info msg="Start initial rule provider 广告规则(By lhie1)"
time="2021-08-25T12:46:36Z" level=info msg="Start initial rule provider HBO(By lhie1)"
time="2021-08-25T12:46:36Z" level=info msg="Start initial rule provider BBC-iPlayer"
time="2021-08-25T12:46:36Z" level=info msg="Start initial rule provider myTV SUPER"
time="2021-08-25T12:46:36Z" level=info msg="Start initial rule provider ITV"
time="2021-08-25T12:46:36Z" level=info msg="Start initial rule provider LINE-TV"
time="2021-08-25T12:46:36Z" level=info msg="Start initial rule provider Hulu(By lhie1)"
time="2021-08-25T12:46:36Z" level=info msg="DNS server listening at: 127.0.0.1:7874"
2021-08-25 20:46:39 Step 6: Wait For The File Downloading...
2021-08-25 20:46:39 Reload OpenClash Firewall Rules...
2021-08-25 20:46:39 Step 7: Set Control Panel...
2021-08-25 20:46:39 Step 8: Set Firewall Rules...
2021-08-25 20:46:39 Step 9: Restart Dnsmasq...
2021-08-25 20:46:40 Setting Secondary DNS Server List...
2021-08-25 20:46:43 Step 10: Add Cron Rules, Start Daemons...
2021-08-25 20:46:43 OpenClash Start Successful!
2021-08-25 20:47:43 Watchdog: Reset Firewall For Enabling Redirect...

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

1. SourceIP:【198.18.0.1】 - Host:【Not exist】 - DestinationIP:【50.7.73.34】 - Network:【udp】 - RulePayload:【】 - Lastchain:【CN-HK2】
2. SourceIP:【198.18.0.1】 - Host:【Not exist】 - DestinationIP:【50.7.73.34】 - Network:【udp】 - RulePayload:【】 - Lastchain:【CN-HK2】
3. SourceIP:【198.18.0.1】 - Host:【Not exist】 - DestinationIP:【50.7.73.34】 - Network:【udp】 - RulePayload:【】 - Lastchain:【CN-HK2】
4. SourceIP:【192.168.99.153】 - Host:【Not exist】 - DestinationIP:【91.108.56.138】 - Network:【tcp】 - RulePayload:【】 - Lastchain:【CN-HK2】
5. SourceIP:【192.168.99.153】 - Host:【Not exist】 - DestinationIP:【149.154.175.53】 - Network:【tcp】 - RulePayload:【】 - Lastchain:【CN-HK2】
ghost commented 3 years ago

我看之前版本的防火墙规则里,dns劫持是劫持到本机的53端口的,也就是交给dnsmasq处理。

-A PREROUTING -p tcp -m tcp --dport 53 -m comment --comment dns_hijack -j REDIRECT --to-ports 53
-A PREROUTING -p udp -m udp --dport 53 -m comment --comment dns_hijack -j REDIRECT --to-ports 53

但是新版本里,dns是劫持到7874端口的,但是clash监听的是127.0.0.1:7874,而不是0.0.0.0:7874,不是很懂iptables,不知道这样劫持会不会导致局域网设备无法访问到dns解析服务器?

-A PREROUTING -p tcp -m tcp --dport 53 -m comment --comment dns_hijack -j REDIRECT --to-ports 7874
-A PREROUTING -p udp -m udp --dport 53 -m comment --comment dns_hijack -j REDIRECT --to-ports 7874

另外,这样也绕过了dnsmasq,相当于把所有dns解析直接交给clash处理,这样在性能上会不会有问题?

ghost commented 3 years ago

我看/init.d/openclash文件里原来的写法是:

uci get dhcp.@dnsmasq[0].port 2>/dev/null || echo 53

现在改成了

uci -q get dhcp.@dnsmasq[0].port || echo $dns_port

这样劫持端口从53变成了设置的clash的7874端口,不知道这个改动是什么原因。

应该是从这个commit开始的: https://github.com/vernesong/OpenClash/blob/4a9f876575b61a53ab590253d04881b7f1c0c8ca/luci-app-openclash/root/etc/init.d/openclash