v2ray / discussion

For general discussion over Project V development and usage.
299 stars 34 forks source link

按照俄罗斯ip地址做指定分流 #562

Closed xinyitextile closed 4 years ago

xinyitextile commented 4 years ago

Please describe the new feature you want in detail. 有服务器A,服务器B,客户端连接服务器A,能不能在服务器A上设置v2ray分流,指定的俄罗斯ip,分流到服务器B上,用的都是v2ray(ws+tls)

kslr commented 4 years ago

可以的

xinyitextile commented 4 years ago

能给个完整的配置文件的例子吗??要v2ray(ws+tls)的,

DolorHunter commented 4 years ago

参照官方文档和新白话中路由配置的部分 https://guide.v2fly.org/basics/routing/basics_routing.html https://www.v2ray.com/chapter_02/03_routing.html

kingwilliam commented 4 years ago

在geoip除了"CN",还有其他国家 如俄罗斯'RU"

ru

// config.json server-A

"routing": [
   "rules": [
      {
         "type": "field"
         "ip:" [
            "geoip:ru"
         ],
         "outboundTag": "out-serverB"
      }
    ]
],

"outbound": [
   {
      "tag": "direct",
      ...
   },
   {
      "tag": "out-serverB",
      ...
   }
]
xinyitextile commented 4 years ago

这个是我服务器a的配置文件,服务器b格式也是相同,请问,怎么在这里具体改,能达到俄罗斯的ip,分流到服务器b上面 { "log": { "access": "/var/log/v2ray/access.log", "error": "/var/log/v2ray/error.log", "loglevel": "warning" }, "inbounds": [ { "port":37531, "listen": "127.0.0.1", "tag": "vmess-in", "protocol": "vmess", "settings": { "clients": [ { "id":"f0beb4e4-4c65-4f0e-aed9-a9f5a08fd87a", "alterId":32 } ] }, "streamSettings": { "network": "ws", "wsSettings": { "path":"/48879369/" } } } ], "outbounds": [ { "protocol": "freedom", "settings": { }, "tag": "direct" }, { "protocol": "blackhole", "settings": { }, "tag": "blocked" } ], "dns": { "servers": [ "https+local://1.1.1.1/dns-query", "1.1.1.1", "1.0.0.1", "8.8.8.8", "8.8.4.4", "localhost" ] }, "routing": { "domainStrategy": "AsIs", "rules": [ { "type": "field", "inboundTag": [ "vmess-in" ], "outboundTag": "direct" } ] } }

kingwilliam commented 4 years ago
{
    "log": {
        "access": "/var/log/v2ray/access.log",
        "error": "/var/log/v2ray/error.log",
        "loglevel": "warning"
    },
    "inbounds": [
        {
            "port": 37531,
            "listen": "127.0.0.1",
            "tag": "vmess-in",
            "protocol": "vmess",
            "settings": {
                "clients": [
                    {
                        "id": "f0beb4e4-4c65-4f0e-aed9-a9f5a08fd87a",
                        "alterId": 32
                    }
                ]
            },
            "streamSettings": {
                "network": "ws",
                "wsSettings": {
                    "path": "/48879369/"
                }
            }
        }
    ],
    "outbounds": [
        {
            "protocol": "freedom",
            "settings": {},
            "tag": "direct"
        }, {
            "protocol": "blackhole",
            "settings": {},
            "tag": "blocked"
        }, {
            "tag": "out-serverB",  // 自行修改 server-A to server-B 设定
            ...
        }
    ],
    "dns": {
        "servers": [
            "https+local://1.1.1.1/dns-query",
            "1.1.1.1",
            "1.0.0.1",
            "8.8.8.8",
            "8.8.4.4",
            "localhost"
        ]
    },
    "routing": {
        // "domainStrategy": "AsIs",
        "rules": [{
                "type": "field"
                "ip:"[
                    "geoip:ru"
                ],
                "outboundTag": "out-serverB"
            }
        ]
    }
}
kingwilliam commented 4 years ago

geoip.dat 可到以下网址download.

每天更新 https://github.com/Loyalsoldier/v2ray-rules-dat

下载後, 可覆盖旧的 /usr/bin/v2ray/geodat.dat

xinyitextile commented 4 years ago

请大佬更改下配置,我试了很久,都不行 服务器a,

{ "log": { "access": "/var/log/v2ray/access.log", "error": "/var/log/v2ray/error.log", "loglevel": "warning" }, "inbounds": [ { "port":37531, "listen": "127.0.0.1", "tag": "vmess-in", "protocol": "vmess", "settings": { "clients": [ { "id":"f0beb4e4-4c65-4f0e-aed9-a9f5a08fd87a", "alterId":32 } ] }, "streamSettings": { "network": "ws", "wsSettings": { "path":"/48879369/" } } } ], "outbounds": [ { "protocol": "freedom", "settings": { }, "tag": "direct" }, { "protocol": "blackhole", "settings": { }, "tag": "blocked" } ], "dns": { "servers": [ "https+local://1.1.1.1/dns-query", "1.1.1.1", "1.0.0.1", "8.8.8.8", "8.8.4.4", "localhost" ] }, "routing": { "domainStrategy": "AsIs", "rules": [ { "type": "field", "inboundTag": [ "vmess-in" ], "outboundTag": "direct" } ] } }

服务器b(俄罗斯的vps)

{ "log": { "access": "/var/log/v2ray/access.log", "error": "/var/log/v2ray/error.log", "loglevel": "warning" }, "inbounds": [ { "port":18552, "listen": "127.0.0.1", "tag": "vmess-in", "protocol": "vmess", "settings": { "clients": [ { "id":"462a102c-ef4a-470e-aeaa-1577297b8e73", "alterId":32 } ] }, "streamSettings": { "network": "ws", "wsSettings": { "path":"/2e3695c3/" } } } ], "outbounds": [ { "protocol": "freedom", "settings": { }, "tag": "direct" }, { "protocol": "blackhole", "settings": { }, "tag": "blocked" } ], "dns": { "servers": [ "https+local://1.1.1.1/dns-query", "1.1.1.1", "1.0.0.1", "8.8.8.8", "8.8.4.4", "localhost" ] }, "routing": { "domainStrategy": "AsIs", "rules": [ { "type": "field", "inboundTag": [ "vmess-in" ], "outboundTag": "direct" } ] } }

kingwilliam commented 4 years ago
// server-A

{
    "log": {
        "access": "/var/log/v2ray/access.log",
        "error": "/var/log/v2ray/error.log",
        "loglevel": "warning"
    },
    "inbounds": [{
            "port": 37531,
            "listen": "127.0.0.1",
            "tag": "vmess-in",
            "protocol": "vmess",
            "settings": {
                "clients": [{
                        "id": "f0beb4e4-4c65-4f0e-aed9-a9f5a08fd87a",
                        "alterId": 32
                    }
                ]
            },
            "streamSettings": {
                "network": "ws",
                "wsSettings": {
                    "path": "/48879369/"
                }
            }
        }
    ],
    "outbounds": [{
            "protocol": "freedom",
            "settings": {},
            "tag": "direct"
        }, {
            "protocol": "blackhole",
            "settings": {},
            "tag": "blocked"
        }, {
            "tag": "out-serverB",
            "protocol": "vmess",
            "settings": {
                "vnext": [{
                        "address": "server-B address",  // 自行修改 server-B address
                        "port": server-B port,   // 自行修改 server-B port
                        "users": [{
                                "id": "462a102c-ef4a-470e-aeaa-1577297b8e73",
                                "alterId": 64,
                                "security": "aes-128-gcm"
                            }
                        ]
                    }
                ]
            },
            "streamSettings": {
                "network": "ws",
                "wsSettings": {
                    "path": "/2e3695c3/"
                }
            }
        }
    ],
    "dns": {
        "servers": [
            "https+local://1.1.1.1/dns-query",
            "1.1.1.1",
            "1.0.0.1",
            "8.8.8.8",
            "8.8.4.4",
            "localhost"
        ]
    },
    "routing": {
        // "domainStrategy": "AsIs",
        "rules": [{
                "type": "field",
                "ip": [
                    "geoip:ru"
                ],
                "outboundTag": "out-serverB"
            }
        ]
    }
}

====================

// server-B

{
    "log": {
        "access": "/var/log/v2ray/access.log",
        "error": "/var/log/v2ray/error.log",
        "loglevel": "warning"
    },
    "inbounds": [{
            "port": 18552,
            "listen": "127.0.0.1",
            "tag": "vmess-in",
            "protocol": "vmess",
            "settings": {
                "clients": [{
                        "id": "462a102c-ef4a-470e-aeaa-1577297b8e73",
                        "alterId": 32
                    }
                ]
            },
            "streamSettings": {
                "network": "ws",
                "wsSettings": {
                    "path": "/2e3695c3/"
                }
            }
        }
    ],
    "outbounds": [{
            "protocol": "freedom",
            "settings": {},
            "tag": "direct"
        }, {
            "protocol": "blackhole",
            "settings": {},
            "tag": "blocked"
        }
    ]
}

====================

解说: server-A, server-B都删除了以下routing rules

"routing": {
    "domainStrategy": "AsIs",
    "rules": [
        {
            "type": "field",
            "inboundTag": [
                "vmess-in"
            ],
            "outboundTag": "direct"
        }
    ]
}

为甚麽要删除? server-A 换了以下 routing rules,

    "routing": {
        // "domainStrategy": "AsIs",
        "rules": [{
                "type": "field",
                "ip": [
                    "geoip:ru"
                ],
                "outboundTag": "out-serverB"
            }
        ]
    }

如你的客户连接server-A, 如要去 www.goolge.com, 这时 routing没合用的rules, 所以v2会用default outbound, 即outbound第一个设定, 这例子是freedom.

但如你的客户要去 ru, 这是routing rules 会要求用 tag: out-serverB, 所以 v2 会用 outboundtag "out-serverB"

所以你‌之前的 vmess-in direct可以删除.

server-B 也一样, 因可以说 来到server-B都一定用default outbound direct, 所以也可删除. server-B dns 因已没用, 所以也可删除.

最後: 建议server-A&B加入TLS做保护就更安全.

xinyitextile commented 4 years ago

能不能把服务器b的配置文件详细列出,谢谢,,

kingwilliam commented 4 years ago

server-B 已列出, 就在server-A下

xinyitextile commented 4 years ago

已经都按照要求更改了,但是还是没有体现出分流到俄罗斯了,俄罗斯的视频网址www.ivi.ru,用俄罗斯的vps是,显示的是俄罗斯本地的视频,网址显示www.ivi.ru 。不在俄罗斯是,这个视频网址就显示www.ivi.tv。2种显示,里面的视频内容有区别,不知道这种情况应该怎样解决?

kingwilliam commented 4 years ago

Server A&B debug log

xinyitextile commented 4 years ago

服务器a, access.log 2020/02/26 20:43:06 tcp:122.230.226.198:42282 accepted tcp:spectrum.s3.amazonaws.com:80 [direct] 2020/02/26 20:43:10 tcp:122.230.226.198:42170 accepted tcp:91.108.56.136:443 [out-serverB] 2020/02/26 20:43:10 tcp:122.230.226.198:42170 accepted tcp:91.108.56.136:80 [out-serverB] 2020/02/26 20:43:10 tcp:122.230.226.198:42282 accepted tcp:91.108.56.120:80 [out-serverB] 2020/02/26 20:43:10 tcp:122.230.226.198:42282 accepted tcp:91.108.56.120:443 [out-serverB] 2020/02/26 20:43:12 tcp:122.230.226.198:42150 accepted tcp:91.108.56.120:80 [out-serverB] 2020/02/26 20:43:12 tcp:122.230.226.198:42170 accepted tcp:91.108.56.136:80 [out-serverB] 2020/02/26 20:43:13 tcp:122.230.226.198:42150 accepted tcp:safebrowsing.google.com:443 [direct] 2020/02/26 20:43:14 tcp:122.230.226.198:42150 accepted tcp:www.ivi.tv:443 [direct] 2020/02/26 20:43:14 tcp:122.230.226.198:42170 accepted tcp:www.ivi.tv:443 [direct] 2020/02/26 20:43:17 tcp:122.230.226.198:42170 accepted tcp:www.ivi.ru:443 [direct] 2020/02/26 20:43:17 tcp:122.230.226.198:42282 accepted tcp:91.233.218.123:80 [out-serverB] 2020/02/26 20:43:18 tcp:122.230.226.198:42282 accepted tcp:80.67.43.1:80 [out-serverB] 2020/02/26 20:43:18 tcp:122.230.226.198:42194 accepted tcp:80.67.43.1:80 [out-serverB] 2020/02/26 20:43:19 tcp:122.230.226.198:42194 accepted tcp:www.googletagmanager.com:443 [direct] 2020/02/26 20:43:19 tcp:122.230.226.198:42256 accepted tcp:www.ivi.tv:443 [direct] 2020/02/26 20:43:19 tcp:122.230.226.198:42194 accepted tcp:www.ivi.tv:443 [direct] 2020/02/26 20:43:19 tcp:122.230.226.198:42256 accepted tcp:www.ivi.tv:443 [direct] 2020/02/26 20:43:19 tcp:122.230.226.198:42194 accepted tcp:www.ivi.tv:443 [direct] 2020/02/26 20:43:19 tcp:122.230.226.198:42256 accepted tcp:sslwidget.criteo.com:443 [direct] 2020/02/26 20:43:19 tcp:122.230.226.198:42256 accepted tcp:widget.eu.criteo.com:443 [direct] 2020/02/26 20:43:19 tcp:122.230.226.198:42282 accepted tcp:rd.frontend.weborama.fr:443 [direct] 2020/02/26 20:43:20 tcp:122.230.226.198:42194 accepted tcp:iviruanalytics.solution.weborama.fr:443 [direct] 2020/02/26 20:43:20 tcp:122.230.226.198:42256 accepted tcp:api.ivi.ru:443 [direct] 2020/02/26 20:43:20 tcp:122.230.226.198:42282 accepted tcp:api.ivi.ru:443 [direct] 2020/02/26 20:43:20 tcp:122.230.226.198:42194 accepted tcp:api.ivi.ru:443 [direct] 2020/02/26 20:43:20 tcp:122.230.226.198:42256 accepted tcp:api.ivi.ru:443 [direct] 2020/02/26 20:43:21 tcp:122.230.226.198:42958 accepted tcp:api.ivi.ru:443 [direct] 2020/02/26 20:43:21 tcp:122.230.226.198:42958 accepted tcp:api.ivi.ru:443 [direct] 2020/02/26 20:43:21 tcp:122.230.226.198:42958 accepted tcp:www.tns-counter.ru:443 [direct] 2020/02/26 20:43:21 tcp:122.230.226.198:42958 accepted tcp:8.8.4.4:53 [direct] 2020/02/26 20:43:21 tcp:122.230.226.198:42958 accepted tcp:8.8.4.4:53 [direct] 2020/02/26 20:43:21 tcp:122.230.226.198:42958 accepted tcp:dx.bigsea.weborama.com:443 [direct] 2020/02/26 20:43:21 tcp:122.230.226.198:42958 accepted tcp:connect.facebook.net:443 [direct] 2020/02/26 20:43:21 tcp:122.230.226.198:42958 accepted tcp:static.dmpkit.1dmp.io:443 [direct] 2020/02/26 20:43:21 tcp:122.230.226.198:42970 accepted tcp:www.google-analytics.com:443 [direct] 2020/02/26 20:43:21 tcp:122.230.226.198:42970 accepted tcp:static.bytedance.com:443 [direct] 2020/02/26 20:43:21 tcp:122.230.226.198:42970 accepted tcp:counter.yadro.ru:443 [direct] 2020/02/26 20:43:21 tcp:122.230.226.198:42970 accepted tcp:matcher.upravel.com:443 [direct] 2020/02/26 20:43:21 tcp:122.230.226.198:42970 accepted tcp:8.8.4.4:53 [direct] 2020/02/26 20:43:21 tcp:122.230.226.198:42958 accepted tcp:top-fwz1.mail.ru:443 [direct] 2020/02/26 20:43:21 tcp:122.230.226.198:42970 accepted tcp:translate.googleapis.com:443 [direct] 2020/02/26 20:43:22 tcp:122.230.226.198:42970 accepted tcp:8.8.4.4:53 [direct] 2020/02/26 20:43:22 tcp:122.230.226.198:42194 accepted tcp:vk.com:443 [direct] 2020/02/26 20:43:22 tcp:122.230.226.198:42970 accepted tcp:stats.g.doubleclick.net:443 [direct] 2020/02/26 20:43:22 tcp:122.230.226.198:42958 accepted tcp:g.ivi.ru:443 [direct] 2020/02/26 20:43:22 tcp:122.230.226.198:42970 accepted tcp:www.googleadservices.com:443 [direct] 2020/02/26 20:43:23 tcp:122.230.226.198:42998 accepted tcp:s0.ipstatp.com:443 [direct] 2020/02/26 20:43:23 tcp:122.230.226.198:42998 accepted tcp:jira4web.ivi.ru:443 [direct] 2020/02/26 20:43:23 tcp:122.230.226.198:42998 accepted tcp:91.108.56.120:443 [out-serverB] 2020/02/26 20:43:23 tcp:122.230.226.198:42998 accepted tcp:91.108.56.136:443 [out-serverB] 2020/02/26 20:43:23 tcp:122.230.226.198:42998 accepted tcp:91.108.56.136:80 [out-serverB] 2020/02/26 20:43:23 tcp:122.230.226.198:42998 accepted tcp:91.108.56.120:80 [out-serverB] 2020/02/26 20:43:23 tcp:122.230.226.198:42998 accepted tcp:8655251.fls.doubleclick.net:443 [direct] 2020/02/26 20:43:23 tcp:122.230.226.198:42998 accepted tcp:8309494.fls.doubleclick.net:443 [direct] 2020/02/26 20:43:23 tcp:122.230.226.198:42970 accepted tcp:rocket.ivi.ru:443 [direct] 2020/02/26 20:43:23 tcp:122.230.226.198:43032 accepted tcp:rocket.ivi.ru:443 [direct] 2020/02/26 20:43:24 tcp:122.230.226.198:43032 accepted tcp:www.facebook.com:443 [direct] 2020/02/26 20:43:24 tcp:122.230.226.198:43032 accepted tcp:rocket.ivi.ru:443 [direct] 2020/02/26 20:43:24 tcp:122.230.226.198:43032 accepted tcp:rocket.ivi.ru:443 [direct] 2020/02/26 20:43:24 tcp:122.230.226.198:43032 accepted tcp:rocket.ivi.ru:443 [direct] 2020/02/26 20:43:24 tcp:122.230.226.198:43032 accepted tcp:rocket.ivi.ru:443 [direct] 2020/02/26 20:43:25 tcp:122.230.226.198:43032 accepted tcp:91.108.56.120:80 [out-serverB] 2020/02/26 20:43:25 tcp:122.230.226.198:42194 accepted tcp:top-fwz1.mail.ru:443 [direct] 2020/02/26 20:43:25 tcp:122.230.226.198:43032 accepted tcp:top-fwz1.mail.ru:443 [direct] 2020/02/26 20:43:25 tcp:122.230.226.198:42194 accepted tcp:91.108.56.136:80 [out-serverB] 2020/02/26 20:43:25 tcp:122.230.226.198:42998 accepted tcp:www.facebook.com:443 [direct] 2020/02/26 20:43:26 tcp:122.230.226.198:42998 accepted tcp:top-fwz1.mail.ru:443 [direct] 2020/02/26 20:43:26 tcp:122.230.226.198:42998 accepted tcp:dmp.dmpkit.1dmp.io:443 [direct] 2020/02/26 20:43:26 tcp:122.230.226.198:43032 accepted tcp:dmp.dmpkit.1dmp.io:443 [direct] 2020/02/26 20:43:26 tcp:122.230.226.198:42194 accepted tcp:d4fdd843-46a6-4d83-9ea0-aeb8860e106a.sync.upravel.com:443 [direct] 2020/02/26 20:43:27 tcp:122.230.226.198:42998 accepted tcp:st.tivision.ru:443 [direct] 2020/02/26 20:43:27 tcp:122.230.226.198:42194 accepted tcp:st.tivision.ru:443 [direct] 2020/02/26 20:43:27 tcp:122.230.226.198:43032 accepted tcp:st.tivision.ru:443 [direct] 2020/02/26 20:43:27 tcp:122.230.226.198:43102 accepted tcp:st.tivision.ru:443 [direct] 2020/02/26 20:43:27 tcp:122.230.226.198:43102 accepted tcp:91.233.218.123:80 [out-serverB] 2020/02/26 20:43:28 tcp:122.230.226.198:43102 accepted tcp:ds.tivision.ru:443 [direct] 2020/02/26 20:43:28 tcp:122.230.226.198:43102 accepted tcp:ds.tivision.ru:443 [direct] 2020/02/26 20:43:28 tcp:122.230.226.198:43102 accepted tcp:ds.tivision.ru:443 [direct] 2020/02/26 20:43:28 tcp:122.230.226.198:43102 accepted tcp:ds.tivision.ru:443 [direct] 2020/02/26 20:43:28 tcp:122.230.226.198:43102 accepted tcp:ds.tivision.ru:443 [direct] 2020/02/26 20:43:28 tcp:122.230.226.198:43102 accepted tcp:ad.mail.ru:443 [direct] 2020/02/26 20:43:30 tcp:122.230.226.198:43102 accepted tcp:st.tivision.ru:443 [direct] 2020/02/26 20:43:33 tcp:122.230.226.198:42282 accepted tcp:8.8.4.4:53 [direct] 2020/02/26 20:43:33 tcp:122.230.226.198:43032 accepted tcp:8.8.4.4:53 [direct] 2020/02/26 20:43:33 tcp:122.230.226.198:42958 accepted tcp:rocket.ivi.ru:443 [direct] 2020/02/26 20:43:33 tcp:122.230.226.198:43032 accepted tcp:rocket.ivi.ru:443 [direct]

error.log 2020/02/26 20:44:29 [Info] [2393330717] v2ray.com/core/app/proxyman/outbound: failed to process outbound traffic > v2ray.com/core/proxy/freedom: connection ends > context canceled 2020/02/26 20:44:29 [Info] [2393330717] v2ray.com/core/common/mux: session 10 ends. > io: read/write on closed pipe 2020/02/26 20:44:29 [Info] [3766269753] v2ray.com/core/app/proxyman/outbound: failed to process outbound traffic > v2ray.com/core/proxy/freedom: connection ends > context canceled 2020/02/26 20:44:29 [Info] [3766269753] v2ray.com/core/common/mux: session 32 ends. > io: read/write on closed pipe 2020/02/26 20:44:35 [Info] [1869665578] v2ray.com/core/app/proxyman/outbound: failed to process outbound traffic > v2ray.com/core/proxy/freedom: connection ends > context canceled 2020/02/26 20:44:35 [Info] [1869665578] v2ray.com/core/common/mux: session 1 ends. > io: read/write on closed pipe 2020/02/26 20:44:44 [Info] [2129162898] v2ray.com/core/app/proxyman/outbound: failed to process outbound traffic > v2ray.com/core/proxy/freedom: connection ends > v2ray.com/core/proxy/freedom: failed to process request > io: read/write on closed pipe 2020/02/26 20:44:44 [Info] [2129162898] v2ray.com/core/common/mux: session 3 ends. > io: read/write on closed pipe 2020/02/26 20:44:45 [Info] [929653350] v2ray.com/core/common/mux: received request for tcp:52.94.235.50:443 2020/02/26 20:44:45 [Info] [929653350] v2ray.com/core/app/dispatcher: default route for tcp:52.94.235.50:443 2020/02/26 20:44:45 [Info] [929653350] v2ray.com/core/proxy/freedom: opening connection to tcp:52.94.235.50:443 2020/02/26 20:44:45 [Info] [929653350] v2ray.com/core/transport/internet/tcp: dialing TCP to tcp:52.94.235.50:443 2020/02/26 20:44:46 [Info] [2611951389] v2ray.com/core/common/mux: received request for tcp:52.94.235.50:443 2020/02/26 20:44:46 [Info] [2611951389] v2ray.com/core/app/dispatcher: default route for tcp:52.94.235.50:443 2020/02/26 20:44:46 [Info] [2611951389] v2ray.com/core/proxy/freedom: opening connection to tcp:52.94.235.50:443 2020/02/26 20:44:46 [Info] [2611951389] v2ray.com/core/transport/internet/tcp: dialing TCP to tcp:52.94.235.50:443 2020/02/26 20:44:47 [Info] [929653350] v2ray.com/core/common/mux: received request for tcp:api.amazonalexa.com:443 2020/02/26 20:44:47 [Info] [929653350] v2ray.com/core/app/dispatcher: default route for tcp:api.amazonalexa.com:443 2020/02/26 20:44:47 [Info] [929653350] v2ray.com/core/proxy/freedom: opening connection to tcp:api.amazonalexa.com:443 2020/02/26 20:44:47 [Info] [929653350] v2ray.com/core/transport/internet/tcp: dialing TCP to tcp:api.amazonalexa.com:443 2020/02/26 20:44:48 [Info] [929653350] v2ray.com/core/app/proxyman/outbound: failed to process outbound traffic > v2ray.com/core/proxy/freedom: connection ends > context canceled 2020/02/26 20:44:48 [Info] [929653350] v2ray.com/core/common/mux: session 10 ends. > io: read/write on closed pipe 2020/02/26 20:44:51 [Info] [2393330717] v2ray.com/core/common/mux: received request for tcp:gateway.icloud.com.cn:443 2020/02/26 20:44:51 [Info] [2393330717] v2ray.com/core/app/dispatcher: default route for tcp:gateway.icloud.com.cn:443 2020/02/26 20:44:51 [Info] [2393330717] v2ray.com/core/proxy/freedom: opening connection to tcp:gateway.icloud.com.cn:443 2020/02/26 20:44:51 [Info] [2393330717] v2ray.com/core/transport/internet/tcp: dialing TCP to tcp:gateway.icloud.com.cn:443 2020/02/26 20:44:54 [Info] [929653350] v2ray.com/core/common/mux: received request for tcp:gateway.icloud.com.cn:443 2020/02/26 20:44:54 [Info] [929653350] v2ray.com/core/app/dispatcher: default route for tcp:gateway.icloud.com.cn:443 2020/02/26 20:44:54 [Info] [929653350] v2ray.com/core/proxy/freedom: opening connection to tcp:gateway.icloud.com.cn:443 2020/02/26 20:44:54 [Info] [929653350] v2ray.com/core/transport/internet/tcp: dialing TCP to tcp:gateway.icloud.com.cn:443 2020/02/26 20:44:55 [Info] [2611951389] v2ray.com/core/common/mux: received request for tcp:gateway.icloud.com.cn:443 2020/02/26 20:44:55 [Info] [2611951389] v2ray.com/core/app/dispatcher: default route for tcp:gateway.icloud.com.cn:443 2020/02/26 20:44:55 [Info] [2611951389] v2ray.com/core/proxy/freedom: opening connection to tcp:gateway.icloud.com.cn:443 2020/02/26 20:44:55 [Info] [2611951389] v2ray.com/core/transport/internet/tcp: dialing TCP to tcp:gateway.icloud.com.cn:443

xinyitextile commented 4 years ago

服务器b,俄罗斯vps access.log pa.googleapis.com:443 [direct] 2020/02/26 19:25:47 tcp:122.230.226.198:43410 accepted tcp:gate.hockeyapp.net:443 [direct] 2020/02/26 19:25:48 tcp:122.230.226.198:43460 accepted tcp:gsp64-ssl.ls.apple.com:443 [direct] 2020/02/26 19:26:02 tcp:122.230.226.198:43392 accepted tcp:www.google.com:443 [direct] 2020/02/26 19:26:02 tcp:122.230.226.198:42868 accepted tcp:gateway.icloud.com.cn:443 [direct] 2020/02/26 19:26:03 tcp:122.230.226.198:43392 accepted tcp:metrics.icloud.com:443 [direct] 2020/02/26 19:26:04 tcp:122.230.226.198:42962 accepted tcp:ip.skk.moe:443 [direct] 2020/02/26 19:26:04 tcp:122.230.226.198:42962 accepted tcp:8.8.4.4:53 [direct] 2020/02/26 19:26:04 tcp:122.230.226.198:43392 accepted tcp:8.8.4.4:53 [direct] 2020/02/26 19:26:04 tcp:122.230.226.198:43392 accepted tcp:safebrowsing.google.com:443 [direct] 2020/02/26 19:26:05 tcp:122.230.226.198:42962 accepted tcp:ip.sb:443 [direct] 2020/02/26 19:26:05 tcp:122.230.226.198:43392 accepted tcp:d.skk.moe:443 [direct] 2020/02/26 19:26:05 tcp:122.230.226.198:42840 accepted tcp:api.skk.moe:443 [direct] 2020/02/26 19:26:05 tcp:122.230.226.198:43392 accepted tcp:github.com:443 [direct] 2020/02/26 19:26:05 tcp:122.230.226.198:42990 accepted tcp:www.youtube.com:443 [direct] 2020/02/26 19:26:05 tcp:122.230.226.198:43392 accepted tcp:api.ip.sb:443 [direct] 2020/02/26 19:26:05 tcp:122.230.226.198:43410 accepted tcp:api.skk.moe:443 [direct] 2020/02/26 19:26:10 tcp:122.230.226.198:43392 accepted tcp:akamai.perfstack.net:443 [direct]

error.log 2020/02/20 11:11:28 [Warning] v2ray.com/core: V2Ray 4.22.1 started 2020/02/26 18:21:31 [Warning] v2ray.com/core: V2Ray 4.22.1 started

xinyitextile commented 4 years ago

服务器a的日志中,,俄罗斯的ip是走的分流到俄罗斯vps,但俄罗斯的域名,并没有分流到俄罗斯的vps

kingwilliam commented 4 years ago
2020/02/26 20:43:24 tcp:122.230.226.198:43032 accepted tcp:rocket.ivi.ru:443 [direct]
2020/02/26 20:43:25 tcp:122.230.226.198:43032 accepted tcp:91.108.56.120:80 [out-serverB]

方法有二:
在server-A config.json

1. 修改 "domainStrategy": "IPIfNonMatch",

    "routing": {
        "domainStrategy": "IPIfNonMatch",
        "rules": [{
                "type": "field",
                "ip": [
                    "geoip:ru"
                ],
                "outboundTag": "out-serverB"
            }
        ]
    }

2. 在 routing rules内加入domain

    "routing": {
        // "domainStrategy": "AsIs",
        "rules": [{
                "type": "field",
                "ip": [
                    "geoip:ru"
                ],
                "outboundTag": "out-serverB"
            },
            {
                "type": "field",
                "domain": [   //domain 多了s,
                    "ivi.ru"
                ],
                "outboundTag": "out-serverB"
            }
        ]
    }

方案二可能比较容易处理, 因日後可能会有一些 .ru domain 但ip不在ru.

xinyitextile commented 4 years ago

按第二个方案,v2ray有错误 Started V2Ray Service. Feb 26 21:38:02 iZj6ccs71lqlb242086fheZ v2ray[997]: V2Ray 4.22.1 (V2Fly, a community-driven edition of V2Ray.) Custom (go1.13.5 linux/amd64) Feb 26 21:38:02 iZj6ccs71lqlb242086fheZ v2ray[997]: A unified platform for anti-censorship. Feb 26 21:38:03 iZj6ccs71lqlb242086fheZ v2ray[997]: main: failed to create server > v2ray.com/core/app/router: this rule has no effective fields Feb 26 21:38:03 iZj6ccs71lqlb242086fheZ systemd[1]: v2ray.service: Main process exited, code=exited, status=23/n/a Feb 26 21:38:03 iZj6ccs71lqlb242086fheZ systemd[1]: v2ray.service: Unit entered failed state. Feb 26 21:38:03 iZj6ccs71lqlb242086fheZ systemd[1]: v2ray.service: Failed with result 'exit-code'.

kingwilliam commented 4 years ago

domain 多了s, 删除那个s试试

xinyitextile commented 4 years ago

服务端b,配置文件出现错误,, { "log": { "access": "/var/log/v2ray/access.log", "error": "/var/log/v2ray/error.log", "loglevel": "debug" }, "inbounds": { "port":18552, "listen": "127.0.0.1", "tag": "vmess-in", "protocol": "vmess", "settings": { "clients": [ { "id":"462a102c-ef4a-470e-aeaa-1577297b8e73", "alterId":32 } ] }, "streamSettings": { "network": "ws", "wsSettings": { "path":"/2e3695c3/" } } } ], "outbounds": [ { "protocol": "freedom", "settings": { }, "tag": "direct" }, { "protocol": "blackhole", "settings": { }, "tag": "blocked" } ] }

kingwilliam commented 4 years ago

Log?

kingwilliam commented 4 years ago

"inbounds": [{ //小了 [

xinyitextile commented 4 years ago
"routing": {
    // "domainStrategy": "AsIs",
    "rules": [{
            "type": "field",
            "ip": [
                "geoip:ru"
            ],
            "outboundTag": "out-serverB"
        },
        {
            "type": "field",
            "domain": [ 
                "ivi.tv"
            ],
            "outboundTag": "out-serverB"
        }
    ]
}

用的第二个方式,但从日志中看出,指定的ivi.tv并没有走分流到服务器b,

2020/02/27 12:15:53 tcp:183.142.146.131:54426 accepted tcp:91.108.56.120:443 [out-serverB] 2020/02/27 12:15:53 tcp:183.142.146.131:54426 accepted tcp:91.108.56.136:80 [out-serverB] 2020/02/27 12:15:53 tcp:183.142.146.131:53162 accepted tcp:91.108.56.120:80 [out-serverB] 2020/02/27 12:15:55 tcp:183.142.146.131:53162 accepted tcp:91.108.56.120:443 [out-serverB] 2020/02/27 12:15:55 tcp:183.142.146.131:53162 accepted tcp:91.108.56.120:80 [out-serverB] 2020/02/27 12:15:55 tcp:183.142.146.131:54426 accepted tcp:91.108.56.136:443 [out-serverB] 2020/02/27 12:15:55 tcp:183.142.146.131:54426 accepted tcp:91.108.56.136:80 [out-serverB] 2020/02/27 12:15:56 tcp:183.142.146.131:53268 accepted tcp:dmp.dmpkit.1dmp.io:443 [direct] 2020/02/27 12:15:56 tcp:183.142.146.131:53162 accepted tcp:dmp.dmpkit.1dmp.io:443 [direct] 2020/02/27 12:15:56 tcp:183.142.146.131:53268 accepted tcp:top-fwz1.mail.ru:443 [direct] 2020/02/27 12:15:58 tcp:183.142.146.131:53434 accepted tcp:91.108.56.136:80 [out-serverB] 2020/02/27 12:15:58 tcp:183.142.146.131:52160 accepted tcp:st.tivision.ru:443 [direct] 2020/02/27 12:15:58 tcp:183.142.146.131:54426 accepted tcp:www.ivi.tv:443 [direct] 2020/02/27 12:16:00 tcp:183.142.146.131:54426 accepted tcp:91.108.56.136:80 [out-serverB] 2020/02/27 12:16:01 tcp:183.142.146.131:53434 accepted tcp:clientservices.googleapis.com:443 [direct] 2020/02/27 12:16:01 tcp:183.142.146.131:53434 accepted tcp:91.108.56.120:443 [out-serverB] 2020/02/27 12:16:01 tcp:183.142.146.131:54426 accepted tcp:91.108.56.136:443 [out-serverB] 2020/02/27 12:16:01 tcp:183.142.146.131:54426 accepted tcp:91.108.56.136:80 [out-serverB] 2020/02/27 12:16:01 tcp:183.142.146.131:53434 accepted tcp:91.108.56.120:80 [out-serverB] 2020/02/27 12:16:03 tcp:183.142.146.131:54236 accepted tcp:91.108.56.136:443 [out-serverB] 2020/02/27 12:16:03 tcp:183.142.146.131:54426 accepted tcp:91.108.56.120:443 [out-serverB] 2020/02/27 12:16:03 tcp:183.142.146.131:53434 accepted tcp:91.108.56.120:80 [out-serverB] 2020/02/27 12:16:03 tcp:183.142.146.131:53162 accepted tcp:91.108.56.136:80 [out-serverB] 2020/02/27 12:16:06 tcp:183.142.146.131:53268 accepted tcp:91.108.56.136:80 [out-serverB] 2020/02/27 12:16:06 tcp:183.142.146.131:52160 accepted tcp:91.108.56.120:80 [out-serverB] 2020/02/27 12:16:08 tcp:183.142.146.131:53268 accepted tcp:91.108.56.120:80 [out-serverB] 2020/02/27 12:16:09 tcp:183.142.146.131:52160 accepted tcp:91.108.56.120:443 [out-serverB] 2020/02/27 12:16:09 tcp:183.142.146.131:54426 accepted tcp:91.108.56.136:443 [out-serverB] 2020/02/27 12:16:09 tcp:183.142.146.131:54426 accepted tcp:91.108.56.136:80 [out-serverB] 2020/02/27 12:16:09 tcp:183.142.146.131:54236 accepted tcp:91.108.56.120:80 [out-serverB] 2020/02/27 12:16:11 tcp:183.142.146.131:53406 accepted tcp:91.108.56.120:443 [out-serverB]

kingwilliam commented 4 years ago

iviru

ivitv

你是要 ivi.ru 或 ivi.tv? 如两个都要走server-B, 就两个都要入.

    "routing": {
        // "domainStrategy": "AsIs",
        "rules": [{
                "type": "field",
                "ip": [
                    "geoip:ru"
                ],
                "outboundTag": "out-serverB"
            },
            {
                "type": "field",
                "domain": [
                    "ivi.ru",
                    "ivi.tv"
                ],
                "outboundTag": "out-serverB"
            }
        ]
    }
xinyitextile commented 4 years ago

服务器a日志可以看到分流到服务器b,,但服务器b上日志,没有看到接收信息。服务器a和b直接不能正常沟通。 配置文件如下:

服务器a { "log": { "access": "/var/log/v2ray/access.log", "error": "/var/log/v2ray/error.log", "loglevel": "debug" }, "inbounds": [ { "port":39277, "listen": "127.0.0.1", "tag": "vmess-in", "protocol": "vmess", "settings": { "clients": [ { "id":"1d00d808-f5b1-49ed-8b38-dd92d9cabe27", "alterId":32 } ] }, "streamSettings": { "network": "ws", "wsSettings": { "path":"/a008df5f/" } } } ], "outbounds": [ { "protocol": "freedom", "settings": { }, "tag": "direct" }, { "protocol": "blackhole", "settings": { }, "tag": "blocked" }, { "tag": "out-serverB", "protocol": "vmess", "settings": { "vnext": [{ "address": "v2ray.xinyitex.site", "port": 443, "users": [{ "id": "7c13270c-9438-42bc-94d1-ed275b54d122", "alterId": 32, "security": "auto" } ] } ] },
"streamSettings": { "network": "ws", "wsSettings": { "path": "/5cc0f4d6/" } } } ],
"dns": { "servers": [ "https+local://1.1.1.1/dns-query", "1.1.1.1", "1.0.0.1", "8.8.8.8", "8.8.4.4", "localhost" ] }, "routing": { "domainStrategy": "AsIs", "rules": [ { "type": "field", "ip": [ "geoip:ru" ], "outboundTag": "out-serverB" }, { "type": "field", "domain": [ "ivi.ru", "ivi.tv" ], "outboundTag": "out-serverB" } ] } }

服务器b { "log": { "access": "/var/log/v2ray/access.log", "error": "/var/log/v2ray/error.log", "loglevel": "debug" }, "inbounds": [ { "port":25472, "listen": "127.0.0.1", "tag": "vmess-in", "protocol": "vmess", "settings": { "clients": [ { "id":"7c13270c-9438-42bc-94d1-ed275b54d122", "alterId":32 } ] }, "streamSettings": { "network": "ws", "wsSettings": { "path":"/5cc0f4d6/" } } } ], "outbounds": [ { "protocol": "freedom", "settings": { }, "tag": "direct" }, { "protocol": "blackhole", "settings": { }, "tag": "blocked" } ] }

kingwilliam commented 4 years ago

server-B 前是否还有web/proxy? 外网如何到127.0.0.1:25472

因 server-B config json

port":25472, "listen": "127.0.0.1",

xinyitextile commented 4 years ago

那什么处理这情况?

xinyitextile commented 4 years ago

我用v2ray连接服务器b是可以正常代理的,服务器b上有个伪装网站,搭建的时候是用这个一键搭建:https://github.com/wulabing/V2Ray_ws-tls_bash_onekey

kingwilliam commented 4 years ago

Nginx config?

xinyitextile commented 4 years ago

服务器b的nginx config

user root; worker_processes 3;

error_log logs/error.log;

error_log logs/error.log notice;

error_log logs/error.log info;

pid logs/nginx.pid;

events { worker_connections 4096; }

http { include mime.types; default_type application/octet-stream;

#log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
#                  '$status $body_bytes_sent "$http_referer" '
#                  '"$http_user_agent" "$http_x_forwarded_for"';

#access_log  logs/access.log  main;

sendfile        on;
#tcp_nopush     on;

#keepalive_timeout  0;
keepalive_timeout  65;

#gzip  on;

server {
    listen       80;
    server_name  localhost;

    #charset koi8-r;

    #access_log  logs/host.access.log  main;

    location / {
        root   html;
        index  index.html index.htm;
    }

    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    #    proxy_pass   http://127.0.0.1;
    #}

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    #location ~ \.php$ {
    #    root           html;
    #    fastcgi_pass   127.0.0.1:9000;
    #    fastcgi_index  index.php;
    #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
    #    include        fastcgi_params;
    #}

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny  all;
    #}
}

# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
#    listen       8000;
#    listen       somename:8080;
#    server_name  somename  alias  another.alias;

#    location / {
#        root   html;
#        index  index.html index.htm;
#    }
#}

# HTTPS server
#
#server {
#    listen       443 ssl;
#    server_name  localhost;

#    ssl_certificate      cert.pem;
#    ssl_certificate_key  cert.key;

#    ssl_session_cache    shared:SSL:1m;
#    ssl_session_timeout  5m;

#    ssl_ciphers  HIGH:!aNULL:!MD5;
#    ssl_prefer_server_ciphers  on;

#    location / {
#        root   html;
#        index  index.html index.htm;
#    }
#}

include conf.d/*.conf; }

kingwilliam commented 4 years ago

这个是你 server-B 的 Nginx config吗? 但应有的参数都看不见。

你可参考 "新V2Ray白话文指南 - 高级篇 - WebSocket + TLS + Web - 配置 - 服务器配置" https://guide.v2fly.org/advanced/wss_and_web.html#%E9%85%8D%E7%BD%AE