XTLS / Xray-core

Xray, Penetrates Everything. Also the best v2ray-core, with XTLS support. Fully compatible configuration.
https://t.me/projectXray
Mozilla Public License 2.0
25.94k stars 3.98k forks source link

透明代理下DNS劫持似乎无效 #3461

Closed Arrow-Li closed 5 months ago

Arrow-Li commented 5 months ago

完整性要求

版本

1.8.4

描述

战网服务器在国内会被解析到网易关闭的地址,理论上dns劫持之后应该走vps的解析到国外,不知为何最后还是国内的ip

重现方式

curl -vvv -X POST https://prod.actual.battle.net
systemd-resolve --flush-caches
systemd-resolve -4 prod.actual.battle.net
屏幕截图 2024-06-20 233519

客户端配置

{
    "log": {
        "access": "xray/a.log",
        "dnsLog": true,
        "loglevel": "debug"
    },
    "routing": {
        "domainStrategy": "IPIfNonMatch",
        "rules": [
            {
                "type": "field",
                "port": 53,
                "network": "tcp,udp",
                "outboundTag": "dns1"
            }
        ]
    },
    "inbounds": [
        {
            "tag": "in",
            "port": 11330,
            "protocol": "dokodemo-door",
            "settings": {
                "network": "tcp,udp",
                "followRedirect": true
            },
            "sniffing": {
                "enabled": true,
                "destOverride": [
                    "http",
                    "tls",
                    "quic"
                ]
            },
            "streamSettings": {
                "sockopt": {
                    "tproxy": "tproxy"
                }
            }
        }
    ],
    "outbounds": [
        {
            "protocol": "vless",
            "settings": {
                "vnext": [
                    {
                        "address": "*",
                        "port": 443,
                        "users": [
                            {
                                "id": "*",
                                "encryption": "none",
                                "flow": "xtls-rprx-vision"
                            }
                        ]
                    }
                ]
            },
            "streamSettings": {
                "network": "tcp",
                "security": "tls",
                "tlsSettings": {
                    "serverName": "",
                    "allowInsecure": false,
                    "fingerprint": "chrome"
                },
                "sockopt": {
                    "tcpFastOpen": true
                }
            },
            "tag": "proxy"
        },
        {
            "protocol": "freedom",
            "tag": "direct"
        },
        {
            "protocol": "blackhole",
            "tag": "block"
        },
        {
            "tag": "dns1",
            "protocol": "dns"
        }
    ],
    "dns": {
        "servers": [
            "https://dns.google/dns-query"
        ]
    }
}

客户端日志

2024/06/20 23:30:29 192.168.50.10:52620 accepted tcp:43.247.78.73:443 [in >> proxy]
2024/06/20 23:31:14 192.168.50.10:51924 accepted tcp:43.247.78.73:443 [in >> proxy]
Fangliding commented 5 months ago

你家完整日志两行是吧

Arrow-Li commented 5 months ago

你家完整日志两行是吧

因为日志上下文和该问题无关,都是正常请求日志

屏幕截图 2024-06-21 001828

PS:不会说话可以不说

fs8vsx59h commented 5 months ago

注册表里有老国内战网的东西没删干净,和 xray 无关

xqzr commented 5 months ago

你家完整日志两行是吧

因为日志上下文和该问题无关,都是正常请求日志 屏幕截图 2024-06-21 001828

PS:不会说话可以不说

"loglevel": "debug" 似乎没有起作用

Fangliding commented 5 months ago

debug输出在error日志里 这里看起来是那个a.log里写的access日志 所以并不是完整日志 因为没写error log路径 所以debug日志输出去console了 自己不读模板我甚至都加粗了然后说我不会说话(

om2mo commented 5 months ago

你的入口规则根本没调用到dns1

om2mo commented 5 months ago

你家完整日志两行是吧

因为日志上下文和该问题无关,都是正常请求日志 屏幕截图 2024-06-21 001828

PS:不会说话可以不说

你这个是access日志,没有dns解析日志,因为dns根本没有其作用,就算dns改成1.2.3.4也照样运行

slinar commented 5 months ago

透明代理需要配置iptables和ip rule,可以把相关配置发出来看看

Arrow-Li commented 5 months ago

透明代理需要配置iptables和ip rule,可以把相关配置发出来看看

是这个原因,本机的53端口没有进入xray


原来的iptables是

/usr/sbin/iptables -t mangle -A XRAY -d 127.0.0.0/8 -j RETURN

修改之后就正常了

/usr/sbin/iptables -t mangle -A XRAY -d 127.0.0.0/8 -p tcp -j RETURN
/usr/sbin/iptables -t mangle -A XRAY -d 127.0.0.0/8 -p udp ! --dport 53 -j RETURN