Xray-core icon indicating copy to clipboard operation
Xray-core copied to clipboard

Xray-core全局代理时,192.168*等内网ip无法通过代理访问

Open Zzz3m opened this issue 5 years ago • 6 comments

现象: 家里部署了服务端SS。 客户端从外面布置了Xray-core(V2rayN客户端),全局模式,设置界面将过滤去掉。访问家中的局域网地址192.168无法访问,提示目前无法处理此请求。HTTP ERROR 503。 IPIfNonMatch,ASIS,IPOnDemand 各选项均试过,无用。 如果将192.168内网地址套个虚假的本地域名,则可以正常解析并可打开页面。 配置文件:


{
  "log": {
    "access": "",
    "error": "",
    "loglevel": "debug"
  },
  "inbounds": [
    {
      "tag": "socks",
      "port": 10808,
      "listen": "127.0.0.1",
      "protocol": "socks",
      "sniffing": {
        "enabled": true,
        "destOverride": [
          "http",
          "tls"
        ]
      },
      "settings": {
        "auth": "noauth",
        "udp": true,
        "allowTransparent": false
      }
    },
    {
      "tag": "http",
      "port": 10809,
      "listen": "127.0.0.1",
      "protocol": "http",
      "sniffing": {
        "enabled": true,
        "destOverride": [
          "http",
          "tls"
        ]
      },
      "settings": {
        "udp": false,
        "allowTransparent": false
      }
    }
  ],
  "outbounds": [
    {
      "tag": "proxy",
      "protocol": "shadowsocks",
      "settings": {
        "servers": [
          {
            "address": "xxx.xxxxxxx",
            "method": "aes-256-gcm",
            "ota": false,
            "password": "password",
            "port": port,
            "level": 1
          }
        ]
      },
      "streamSettings": {
        "network": "tcp"
      },
      "mux": {
        "enabled": false,
        "concurrency": -1
      }
    },
    {
      "tag": "direct",
      "protocol": "freedom",
      "settings": {}
    },
    {
      "tag": "block",
      "protocol": "blackhole",
      "settings": {
        "response": {
          "type": "http"
        }
      }
    }
  ],
  "dns": {
    "servers": [
      "223.5.5.5"
    ]
  },
  "routing": {
    "domainStrategy": "IPIfNonMatch",
    "rules": [
      {
        "type": "field",
        "inboundTag": [
          "api"
        ],
        "outboundTag": "api"
      },
      {
        "type": "field",
        "outboundTag": "proxy",
        "ip": [
          "192.168.50.66/32"
        ],
        "protocol": [
          "http",
          "tls",
          "bittorrent"
        ]
      },
      {
        "type": "field",
        "port": "0-65535",
        "outboundTag": "proxy"
      }
    ]
  }
}

日志:

2021/02/22 17:03:43 [Info] [2865374305] proxy/http: request to Method [GET] Host [192.168.50.66:6000] with URL [http://192.168.50.66:8000/cgi-bin/luci/admin/services]
2021/02/22 17:03:43 [Info] [2865374305] app/dispatcher: taking detour [proxy] for [tcp:192.168.50.66:6000]
2021/02/22 17:03:43 [Info] [2865374305] transport/internet/tcp: dialing TCP to tcp:家里的域名:port
2021/02/22 17:03:43 127.0.0.1:7077 accepted http://192.168.50.66:8000/cgi-bin/luci/admin/services [http -> proxy]
2021/02/22 17:03:43 [Info] [2865374305] proxy/shadowsocks: tunneling request to tcp:192.168.50.66:6000 via tcp:家里的域名:port
2021/02/22 17:03:43 [Info] [2865374305] app/proxyman/outbound: failed to process outbound traffic > proxy/shadowsocks: connection ends **> proxy/shadowsocks: failed to read IV > EOF**
2021/02/22 17:03:43 [Warning] [2865374305] proxy/http: failed to read response from 192.168.50.66:6000 > io: read/write on closed pipe
2021/02/22 17:03:43 [Info] [2865374305] app/proxyman/inbound: connection ends > proxy/http: failed to read http request > EOF
2021/02/22 17:04:02 [Info] [2659161919] app/proxyman/inbound: connection ends > proxy/http: connection ends > context canceled
2021/02/22 17:04:02 [Info] [2659161919] app/proxyman/outbound: failed to process outbound traffic > proxy/shadowsocks: connection ends > context canceled

PS:请叫我奇奇怪怪的BUG发现者...

Zzz3m avatar Feb 22 '21 09:02 Zzz3m

v2rayN的全局代理不是真正的全局代理,只是代理它能接管的所有流量,这个不算是bug,你打开v2rayn的允许局域网连接这个选项试试

mcbbsandnz avatar Feb 22 '21 15:02 mcbbsandnz

v2rayN的全局代理不是真正的全局代理,只是代理它能接管的所有流量,这个不算是bug,你打开v2rayn的允许局域网连接这个选项试试

应该算bug吧 如果客户端xray换成ss端是可以打开且能访问192.168*地址的。而且这个流量应该是可以被代理的。那如果不能代理,为什么加了本地域名映射就能打开了这个也很奇怪吧。

Zzz3m avatar Feb 22 '21 16:02 Zzz3m

请补充服务端的配置文件与日志。

ghost avatar Feb 23 '21 01:02 ghost

请补充服务端的配置文件与日志。

谢谢提醒。服务端对private的地址做了限制。删除相关配置信息后即可访问。是我自己的问题。

Zzz3m avatar Feb 23 '21 02:02 Zzz3m

请补充服务端的配置文件与日志。

谢谢提醒。服务端对private的地址做了限制。删除相关配置信息后即可访问。是我自己的问题。

请问大佬,你是怎么去掉服务端对private地址限制的?

smallprogram avatar Nov 06 '21 04:11 smallprogram

请补充服务端的配置文件与日志。

谢谢提醒。服务端对private的地址做了限制。删除相关配置信息后即可访问。是我自己的问题。

请问大佬,你是怎么去掉服务端对private地址限制的?

在routing中,将走黑洞的private地址删除或者添加一个高优先级别的代理即可 类似这样 { "type": "field", "outboundTag": "proxy", "ip": [ "IP地址/24" ], "protocol": [ "http", "tls", "bittorrent" ] },

Zzz3m avatar Nov 06 '21 05:11 Zzz3m