SagerNet / sing-box

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

Tun mode, internet is down. #1921

Closed AFrantsevich closed 4 months ago

AFrantsevich commented 4 months ago

Operating system

Linux

System version

Arch Linux

Installation type

Original sing-box Command Line

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

No response

Version

sing-box version 1.8.12

Description

Hi there! When I set tun mode as inbounds, the internet is down. But when I use local server, everything works fine. I've tried a lot of configuration variants, but nothing to help. Thanks a lot!

NOT WORKS

  "inbounds": [
    {
      "type": "tun",
      "tag": "tun-in",
      "interface_name": "singbox_tun",
      "inet4_address": "172.19.0.1/30",
      "mtu": 9000,
      "auto_route": true,
      "strict_route": true,
      "stack": "system",
      "sniff": false
    }
  ],

WORKS, BUT AS PROXY:

"inbounds": [
    {
      "domain_strategy": "",
      "listen": "127.0.0.1",
      "listen_port": 2080,
      "tag": "mixed-in",
      "type": "mixed"
    }
  ]

Reproduction

Full not working config:

{
  "inbounds": [
    {
      "type": "tun",
      "tag": "tun-in",
      "interface_name": "singbox_tun",
      "inet4_address": "172.19.0.1/30",
      "mtu": 9000,
      "auto_route": true,
      "strict_route": true,
      "stack": "system",
      "sniff": false
    }
  ],
  "log": {
    "level": "debug"
  },
  "outbounds": [
    {
      "domain_strategy": "",
      "flow": "",
      "packet_encoding": "",
      "server": "secret",
      "server_port": 443,
      "tag": "proxy",
      "tls": {
        "alpn": [
          "http/1.1"
        ],
        "enabled": true,
        "server_name": "secret too",
        "utls": {
          "enabled": true,
          "fingerprint": "chrome"
        }
      },
      "transport": {
        "headers": {
          "Host": "secret too"
        },
        "path": "I thinck also secret",
        "type": "ws"
      },
      "type": "vless",
      "uuid": "not secret, but I hide too)"
    }
  ],
  "route": {
    "auto_detect_interface": true
  }
}

Logs

A tail of logs:
DEBUG[0041] [4218556867 10.0s] dns: lookup failed for ....: lookup .....: i/o timeout
ERROR[0041] [4218556867 10.0s] inbound/tun[tun-in]: lookup .....: i/o timeout
DEBUG[0041] [1537022381 10.0s] dns: lookup failed for .....: lookup ....: i/o timeout
ERROR[0041] [1537022381 10.0s] inbound/tun[tun-in]: lookup ....: i/o timeout
DEBUG[0041] [971500677 10.0s] dns: lookup failed for ....: lookup ....: i/o timeout
ERROR[0041] [971500677 10.0s] inbound/tun[tun-in]: lookup ....: i/o timeout
DEBUG[0042] [13501710 10.0s] dns: lookup failed for ....: lookup ....: i/o timeout
ERROR[0042] [13501710 10.0s] inbound/tun[tun-in]: lookup ....: i/o timeout
DEBUG[0042] [1734910218 10.0s] dns: lookup failed for ....: lookup ....: i/o timeout
ERROR[0042] [1734910218 10.0s] inbound/tun[tun-in]: lookup ....: i/o timeout
INFO[0042] [1644663170 0ms] inbound/tun[tun-in]: inbound connection from 172.19.0.1:60944
INFO[0042] [1644663170 0ms] inbound/tun[tun-in]: inbound connection to .....
INFO[0042] [1644663170 0ms] outbound/vless[proxy]: outbound connection to .....
DEBUG[0042] [1644663170 0ms] dns: lookup domain ...
INFO[0042] [1129512478 0ms] inbound/tun[tun-in]: inbound connection from 172.19.0.1:56834
INFO[0042] [1129512478 0ms] inbound/tun[tun-in]: inbound connection to 0000000:80
INFO[0042] [1129512478 0ms] outbound/vless[proxy]: outbound connection to 00000:80
DEBUG[0042] [1129512478 0ms] dns: lookup domain .....
DEBUG[0044] [3819227022 10.0s] dns: lookup failed for ....: lookup ....: i/o timeout
ERROR[0044] [3819227022 10.0s] inbound/tun[tun-in]: lookup ....: i/o timeout
DEBUG[0044] [3144897981 10.0s] dns: lookup failed for .....: lookup ....: i/o timeout
ERROR[0044] [3144897981 10.0s] inbound/tun[tun-in]: lookup .....: i/o timeout

Supporter

Integrity requirements

yremac commented 4 months ago

add dns server to configuration

AFrantsevich commented 3 months ago

add dns server to configuration

I added. But it still doesn't work(

"dns": {
    "servers": [
      {
        "tag": "dns_proxy",
        "address": "https://1.1.1.1/dns-query",
        "address_resolver": "dns_resolver",
        "strategy": "ipv4_only",
        "detour": "proxy"
      },
      {
        "tag": "dns_direct",
        "address": "https://dns.alidns.com/dns-query",
        "address_resolver": "dns_resolver",
        "strategy": "ipv4_only",
        "detour": "direct"
      },
      {
        "tag": "dns_resolver",
        "address": "223.5.5.5",
        "detour": "direct"
      }
    ],
    "rules": [
      {
        "outbound": "any",
        "server": "dns_proxy"
      }
    ],
    "final": "dns_direct"
  },