v2fly / v2ray-core

A platform for building proxies to bypass network restrictions.
https://v2fly.org
MIT License
29.49k stars 4.66k forks source link

V2ray 作为中转服务器, 配置的域名没有走对应的出口 #2966

Closed whale-fall-wh closed 1 month ago

whale-fall-wh commented 7 months ago

你正在使用哪个版本的 V2Ray?

docker部署的,最新版本

你的使用场景是什么?

在docker里部署了一个V2ray, 入站配置了两个,一个是socks,一个是vmess,出站配置了两个,一个是默认的,另一个tag为LY 指定的域名和IP走一个LY出站,其他都走默认的出站口

你看到的异常现象是什么?

用socks 代理时,指定的域名能正常命中LY出站口,但是用vmess入站时,就无法走代理了,也走了默认的出站口,是Vmess不支持吗?还是需要特殊配置

请附上你的配置

服务端配置:

''' { "log": { "access": "", "error": "", "loglevel": "info" }, "inbounds": [{ "port": 1081, "listen": "0.0.0.0", "protocol": "socks", "settings": { "auth": "noauth", "udp": true, "ip": "127.0.0.1", "clients": null }, "streamSettings": null }, { "listen": "0.0.0.0", "port": 1080, "protocol": "vmess", "settings": { "clients": [{ "id": "dcd8eb99-a80a-4bcf-b61f-2c38b8d5c1f3", "security": "auto", "alterId": 0 }] } } ], "outbounds": [{ "protocol": "vmess", "settings": { "vnext": [{ "address": "xxx", "port": 443, "users": [{ "id": "xxx", "alterId": 0, "email": "t@t.tt", "security": "auto" }] }] }, "streamSettings": { "network": "ws", "security": "tls", "tlsSettings": { "allowInsecure": false, "serverName": "xxx" }, "wsSettings": { "path": "/neqqvws", "headers": { "Host": "xxx" } } }, "mux": { "enabled": false, "concurrency": -1 } }, { "protocol": "HTTP", "settings": { "servers": [{ "address": "192.168.50.211", "port": 8888, "users": [] }] }, "tag": "LY" } ], "dns": { "servers": [ "8.8.8.8", "8.8.4.4", "localhost" ] }, "routing": { "domainStrategy": "IPIfNonMatch", "rules": [{ "type": "field", "ip": [ "10.0.0.0/8" ], "outboundTag": "LY" }, { "type": "field", "domain": [ "domain:test.com" ], "outboundTag": "LY" } ] } } '''

// 在这里附上服务器端配置文件
whale-fall-wh commented 7 months ago

这是配置

{
    "log": {
        "access": "",
        "error": "",
        "loglevel": "info"
    },
    "inbounds": [{
            "port": 1081,
            "listen": "0.0.0.0",
            "protocol": "socks",
            "settings": {
                "auth": "noauth",
                "udp": true,
                "ip": "127.0.0.1",
                "clients": null
            },
            "streamSettings": null
        },
        {
            "listen": "0.0.0.0",
            "port": 1080,
            "protocol": "vmess",
            "settings": {
                "clients": [{
                    "id": "dcd8eb99-a80a-4bcf-b61f-2c38b8d5c1f3",
                    "security": "auto",
                    "alterId": 0
                }]
            }
        }
    ],
    "outbounds": [{
            "protocol": "vmess",
            "settings": {
                "vnext": [{
                    "address": "xxx",
                    "port": 443,
                    "users": [{
                        "id": "xxx",
                        "alterId": 0,
                        "email": "t@t.tt",
                        "security": "auto"
                    }]
                }]
            },
            "streamSettings": {
                "network": "ws",
                "security": "tls",
                "tlsSettings": {
                    "allowInsecure": false,
                    "serverName": "xxx"
                },
                "wsSettings": {
                    "path": "/neqqvws",
                    "headers": {
                        "Host": "xxx"
                    }
                }
            },
            "mux": {
                "enabled": false,
                "concurrency": -1
            }
        },
        {
            "protocol": "HTTP",
            "settings": {
                "servers": [{
                    "address": "192.168.50.211",
                    "port": 8888,
                    "users": []
                }]
            },
            "tag": "LY"
        }
    ],
    "dns": {
        "servers": [
            "8.8.8.8",
            "8.8.4.4",
            "localhost"
        ]
    },
    "routing": {
        "domainStrategy": "IPIfNonMatch",
        "rules": [{
                "type": "field",
                "ip": [
                    "10.0.0.0/8"
                ],
                "outboundTag": "LY"
            },
            {
                "type": "field",
                "domain": [
                    "domain:test.com"
                ],
                "outboundTag": "LY"
            }
        ]
    }
}
zazitufu commented 5 months ago

有可能是你客户端没有发域名,而是解析过的ip到服务器。

给你参考一下。这是我在使用v2rayN客户端时候遇到的没有传域名过去hy服务器,结果不能正确转发分流。 https://github.com/apernet/hysteria/discussions/947#discussioncomment-8553351

github-actions[bot] commented 1 month ago

This issue is stale because it has been open 120 days with no activity. Remove stale label or comment or this will be closed in 5 days