SagerNet / sing-box

The universal proxy platform
https://sing-box.sagernet.org/
Other
19k stars 2.27k forks source link

Cannot access any HTTP server on the same machine on which the sing-box is running through the direct outbound #1931

Closed h0NponJR closed 3 weeks ago

h0NponJR commented 3 months ago

Operating system

Linux

System version

Ubuntu 24.04 LTS (GNU/Linux 6.8.0-36-generic x86_64)

Installation type

Original sing-box Command Line

If you are using a graphical client, please provide the version of the client.

No response

Version

1.10.0-alpha.20

Description

config file

{
  "dns": {
    "servers": [
      {
        "tag": "default-dns",
        "address": "192.168.1.1",
        "detour": "DIRECT"
      },
      {
        "tag": "system-dns",
        "address": "local",
        "detour": "DIRECT"
      }
    ],
    "rules": [
      {
        "outbound": "any",
        "server": "default-dns"
      }
    ],
    "strategy": "ipv4_only",
    "disable_cache": false,
    "disable_expire": false,
    "independent_cache": false,
    "final": "default-dns"
  },
  "inbounds": [
    {
      "type": "direct",
      "tag": "dns-in",
      "listen": "::",
      "listen_port": 553
    },
    {
      "type": "mixed",
      "tag": "mixed-in",
      "listen": "::",
      "listen_port": 17890,
      "sniff": true,
      "sniff_override_destination": true
    },
    {
      "type": "socks",
      "tag": "socks-in",
      "listen": "::",
      "listen_port": 17891,
      "sniff": true,
      "sniff_override_destination": true
    },
    {
      "type": "redirect",
      "tag": "redirect-in",
      "listen": "::",
      "listen_port": 17892,
      "sniff": true,
      "sniff_override_destination": true
    },
    {
      "type": "tproxy",
      "tag": "tproxy-in",
      "listen": "::",
      "listen_port": 17893,
      "sniff": true,
      "sniff_override_destination": true
    }
  ],
  "outbounds": [
    {
      "type": "direct",
      "tag": "DIRECT"
    },
    {
      "type": "dns",
      "tag": "dns-out"
    },
    {
      "type": "selector",
      "tag": "Manual",
      "outbounds": [
        "DIRECT"
      ]
    },
    {
      "type": "selector",
      "tag": "GLOBAL",
      "outbounds": [
        "DIRECT"
      ]
    }
  ],
  "route": {
    "rules": [
      {
        "inbound": "dns-in",
        "outbound": "dns-out"
      },
      {
        "protocol": "dns",
        "outbound": "dns-out"
      },
      {
        "clash_mode": "direct",
        "outbound": "DIRECT"
      },
      {
        "clash_mode": "global",
        "outbound": "GLOBAL"
      },
      {
        "ip_is_private": true,
        "outbound": "DIRECT"
      }
    ],
    "auto_detect_interface": true,
    "final": "Manual"
  },
  "experimental": {
    "clash_api": {
      "external_controller": "0.0.0.0:19090",
      "default_mode": "rule"
    }
  }
}

Reproduction

The machine IP is 192.168.1.30 , start the sing-box sudo ./sing-box run -c config.json

chrome proxy configuration

image

Visit http://192.168.1.30:5555 through sing-box, the http server is on the same machine as sing-box can not be opened

Visit http://192.168.1.10:5555 through sing-box, the http server is on a different machine open successfully

Logs

INFO[0000] router: updated default interface ens33, index 2
INFO[0000] clash-api: restful api listening at [::]:19090
INFO[0000] inbound/direct[dns-in]: tcp server started at [::]:553
INFO[0000] inbound/direct[dns-in]: udp server started at [::]:553
INFO[0000] inbound/mixed[mixed-in]: tcp server started at [::]:17890
INFO[0000] inbound/socks[socks-in]: tcp server started at [::]:17891
INFO[0000] inbound/redirect[redirect-in]: tcp server started at [::]:17892
INFO[0000] inbound/tproxy[tproxy-in]: tcp server started at [::]:17893
INFO[0000] inbound/tproxy[tproxy-in]: udp server started at [::]:17893
INFO[0000] sing-box started (0.00s)
INFO[0022] [3447507614 0ms] inbound/mixed[mixed-in]: inbound connection from 192.168.1.20:9884
INFO[0022] [3476212473 0ms] inbound/mixed[mixed-in]: inbound connection from 192.168.1.20:9883
INFO[0022] [3447507614 0ms] inbound/mixed[mixed-in]: inbound connection to 192.168.1.30:5555
DEBUG[0022] [3447507614 1ms] router: sniffed protocol: http, domain: 192.168.1.30
DEBUG[0022] [3447507614 1ms] router: match[4] ip_is_private=true => DIRECT
INFO[0022] [3476212473 1ms] inbound/mixed[mixed-in]: inbound connection to 192.168.1.30:5555
INFO[0022] [3447507614 1ms] outbound/direct[DIRECT]: outbound connection to 192.168.1.30:5555
TRACE[0022] [3476212473 302ms] router: sniffed no protocol: read payload: read tcp 192.168.1.30:17890->192.168.1.20:9883: i/o timeout
DEBUG[0022] [3476212473 302ms] router: match[4] ip_is_private=true => DIRECT
INFO[0022] [3476212473 302ms] outbound/direct[DIRECT]: outbound connection to 192.168.1.30:5555
DEBUG[0027] [3447507614 5.0s] inbound/mixed[mixed-in]: connection closed: process connection from 192.168.1.20:9884: dial tcp 192.168.1.30:5555: i/o timeout

Supporter

Integrity requirements

h0NponJR commented 3 months ago

Now I found that the configuration "auto_detect_interface": true caused this problem, I don't know if this is still a bug

github-actions[bot] commented 4 weeks ago

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