У меня проблема при подключении к моему xray серве...

Created on: October 14, 2025

Answered using GPT-5 Thinking by Chat01

Question

У меня проблема при подключении к моему xray серверу. Клиент sing-box, система linux.

Текущая настройка в система для DNS

DNS over sing box

📝 Настройка DNS через sing-box + dnsmasq

  • Все программы в Linux будут стучать в локальный 127.0.0.1:53
  • dnsmasq примет запрос → форвардит в sing-box (на нестандартный порт, например 1053)
  • sing-box отправит DNS-запрос через твой VLESS-прокси

Провайдер при этом увидит только TLS-трафик к серверу, но не исходные DNS-запросы.

Что мы сделали

  1. Отключили системный резолвер

    • В /etc/NetworkManager/NetworkManager.conf добавили:

      ini
      [main] dns=none
    • Перезапустили NetworkManager:

      bash
      sudo systemctl restart NetworkManager
  2. Настроили dnsmasq как локальный DNS-stub
    В /etc/dnsmasq.conf прописали:

    ini
    # слушаем только локальный интерфейс listen-address=127.0.0.1 # жёстко привязывает сокет к конкретному IP/интерфейсу, указанному в listen-address. # Это критически важно, потому что мы хотим, чтобы dnsmasq строго слушал только 127.0.0.1, # а не случайно открыл DNS наружу (на enp2s0 или tun0). bind-interfaces # не читать /etc/resolv.conf (чтобы случайно не использовать DNS провайдера) no-resolv # пересылаем ВСЕ запросы в sing-box (локальный порт 1053) server=127.0.0.1#1053 # не пересылать ненужные PTR-запросы наружу bogus-priv # блокируем IPv6-запросы (по желанию, если нужно) # filter-aaaa

    Перезапустили сервис:

    bash
    sudo systemctl enable --now dnsmasq
  3. Указали в системе использовать только dnsmasq
    В /etc/resolv.conf:

    ini
    nameserver 127.0.0.1

    Если стоит resolvconf или systemd-resolved → закрепили этот файл через chattr:

    bash
    sudo chattr +i /etc/resolv.conf
  4. Проверка

    • Локальные запросы:

      bash
      dig @127.0.0.1 google.com

      должны уходить в 127.0.0.1#1053 (sing-box).

    • На реальном интерфейсе (enp2s0) нет трафика на порт 53:

      bash
      sudo tcpdump -i enp2s0 -n port 53

Важно! Раньше с этой конфигурацией всё работало, но перестало без видимых причин.
Вот какие ошибки получаю.
+0300 2025-10-14 21:48:59 INFO [1820780125 0ms] inbound/direct[local-dns-in]: inbound packet connection from 127.0.0.1:41268
+0300 2025-10-14 21:48:59 INFO [1820780125 0ms] inbound/direct[local-dns-in]: inbound packet connection to 127.0.0.1:53
+0300 2025-10-14 21:48:59 DEBUG [1820780125 0ms] router: match[0] => sniff
+0300 2025-10-14 21:48:59 DEBUG [1820780125 0ms] router: sniffed packet protocol: dns
+0300 2025-10-14 21:48:59 DEBUG [1820780125 0ms] router: match[1] => resolve
+0300 2025-10-14 21:48:59 DEBUG [1820780125 0ms] router: match[2] protocol=dns || port=53 => hijack-dns
+0300 2025-10-14 21:48:59 DEBUG [1820780125 0ms] dns: exchange ping.manjaro.org. IN A
+0300 2025-10-14 21:48:59 INFO [2575630200 0ms] inbound/direct[local-dns-in]: inbound packet connection from 127.0.0.1:42907
+0300 2025-10-14 21:48:59 INFO [2575630200 0ms] inbound/direct[local-dns-in]: inbound packet connection to 127.0.0.1:53
+0300 2025-10-14 21:48:59 DEBUG [2575630200 0ms] router: match[0] => sniff
+0300 2025-10-14 21:48:59 DEBUG [2575630200 0ms] router: sniffed packet protocol: dns
+0300 2025-10-14 21:48:59 DEBUG [2575630200 0ms] router: match[1] => resolve
+0300 2025-10-14 21:48:59 DEBUG [2575630200 0ms] router: match[2] protocol=dns || port=53 => hijack-dns
+0300 2025-10-14 21:48:59 DEBUG [123803605 20.2s] dns: exchange www.youtube.com. IN A
+0300 2025-10-14 21:48:59 DEBUG [2575630200 0ms] dns: exchange www.youtube.com. IN AAAA
+0300 2025-10-14 21:49:00 DEBUG [2009591431 20.2s] dns: exchange detectportal.firefox.com. IN AAAA
+0300 2025-10-14 21:49:00 DEBUG [3850157977 20.2s] dns: exchange detectportal.firefox.com. IN A
+0300 2025-10-14 21:49:02 DEBUG [3615164628 11.2s] dns: exchange ident.me. IN AAAA
+0300 2025-10-14 21:49:02 DEBUG [1182458267 22.4s] dns: exchange ident.me. IN A
+0300 2025-10-14 21:49:04 INFO [123803605 24.53s] outbound/vless[proxy]: outbound packet connection to 1.1.1.1:53
+0300 2025-10-14 21:49:04 INFO [1182458267 24.19s] outbound/vless[proxy]: outbound packet connection to 1.1.1.1:53
+0300 2025-10-14 21:49:04 ERROR [3430647593 24.53s] dns: exchange failed for www.youtube.com. IN AAAA: dial tcp 85.192.63.245:443: i/o timeout
+0300 2025-10-14 21:49:04 INFO [4026147774 24.9s] outbound/vless[proxy]: outbound packet connection to 1.1.1.1:53
+0300 2025-10-14 21:49:04 ERROR [123803605 24.53s] dns: exchange failed for www.youtube.com. IN A: dial tcp 85.192.63.245:443: i/o timeout
+0300 2025-10-14 21:49:04 INFO [2095817429 24.9s] outbound/vless[proxy]: outbound packet connection to 1.1.1.1:53
+0300 2025-10-14 21:49:04 INFO [1239575017 24.9s] outbound/vless[proxy]: outbound packet connection to 1.1.1.1:53
+0300 2025-10-14 21:49:04 ERROR [4026147774 24.9s] dns: exchange failed for example.org. IN A: dial tcp 85.192.63.245:443: i/o timeout
+0300 2025-10-14 21:49:04 ERROR [1182458267 24.19s] dns: exchange failed for ident.me. IN A: dial tcp 85.192.63.245:443: i/o timeout
+0300 2025-10-14 21:49:04 INFO [2815120891 24.9s] outbound/vless[proxy]: outbound packet connection to 1.1.1.1:53
+0300 2025-10-14 21:49:04 ERROR [2095817429 24.9s] dns: exchange failed for example.org. IN AAAA: dial tcp 85.192.63.245:443: i/o timeout
+0300 2025-10-14 21:49:04 INFO [2009591431 24.9s] outbound/vless[proxy]: outbound packet connection to 1.1.1.1:53
+0300 2025-10-14 21:49:04 ERROR [1239575017 24.9s] dns: exchange failed for ipv4only.arpa. IN A: dial tcp 85.192.63.245:443: i/o timeout
+0300 2025-10-14 21:49:04 ERROR [2815120891 24.9s] dns: exchange failed for ipv4only.arpa. IN AAAA: dial tcp 85.192.63.245:443: i/o timeout
+0300 2025-10-14 21:49:04 ERROR [2009591431 24.9s] dns: exchange failed for detectportal.firefox.com. IN AAAA: dial tcp 85.192.63.245:443: i/o timeout
+0300 2025-10-14 21:49:04 INFO [3850157977 24.9s] outbound/vless[proxy]: outbound packet connection to 1.1.1.1:53
+0300 2025-10-14 21:49:04 ERROR [3850157977 24.9s] dns: exchange failed for detectportal.firefox.com. IN A: dial tcp 85.192.63.245:443: i/o timeout
+0300 2025-10-14 21:49:04 INFO [1586948756 25.8s] outbound/vless[proxy]: outbound packet connection to 1.1.1.1:53
+0300 2025-10-14 21:49:04 INFO [1468295140 25.0s] outbound/vless[proxy]: outbound packet connection to 1.1.1.1:53
+0300 2025-10-14 21:49:04 ERROR [1586948756 25.8s] dns: exchange failed for ident.me. IN AAAA: dial tcp 85.192.63.245:443: i/o timeout
+0300 2025-10-14 21:49:04 INFO [1586948756 25.8s] outbound/vless[proxy]: outbound packet connection to 1.1.1.1:53
+0300 2025-10-14 21:49:04 INFO [1553874406 25.0s] outbound/vless[proxy]: outbound packet connection to 1.1.1.1:53
+0300 2025-10-14 21:49:04 ERROR [1586948756 25.8s] dns: exchange failed for ident.me. IN AAAA: dial tcp 85.192.63.245:443: i/o timeout
+0300 2025-10-14 21:49:04 ERROR [1468295140 25.0s] dns: exchange failed for ping.manjaro.org. IN A: dial tcp 85.192.63.245:443: i/o timeout
+0300 2025-10-14 21:49:04 INFO [1468295140 25.0s] outbound/vless[proxy]: outbound packet connection to 1.1.1.1:53
+0300 2025-10-14 21:49:04 ERROR [1553874406 25.0s] dns: exchange failed for ping.manjaro.org. IN AAAA: dial tcp 85.192.63.245:443: i/o timeout
+0300 2025-10-14 21:49:04 INFO [1468295140 25.0s] outbound/vless[proxy]: outbound packet connection to 1.1.1.1:53
+0300 2025-10-14 21:49:04 INFO [1468295140 25.0s] outbound/vless[proxy]: outbound packet connection to 1.1.1.1:53
+0300 2025-10-14 21:49:04 ERROR [1468295140 25.0s] dns: exchange failed for ping.manjaro.org. IN A: dial tcp 85.192.63.245:443: i/o timeout
+0300 2025-10-14 21:49:04 ERROR [1468295140 25.0s] dns: exchange failed for ping.manjaro.org. IN A: dial tcp 85.192.63.245:443: i/o timeout
+0300 2025-10-14 21:49:04 INFO [1468295140 25.0s] outbound/vless[proxy]: outbound packet connection to 1.1.1.1:53
+0300 2025-10-14 21:49:04 ERROR [1468295140 25.0s] dns: exchange failed for ping.manjaro.org. IN A: dial tcp 85.192.63.245:443: i/o timeout
+0300 2025-10-14 21:49:04 ERROR [1468295140 25.0s] dns: exchange failed for ping.manjaro.org. IN A: dial tcp 85.192.63.245:443: i/o timeout
+0300 2025-10-14 21:49:04 INFO [1468295140 25.0s] outbound/vless[proxy]: outbound packet connection to 1.1.1.1:53
+0300 2025-10-14 21:49:04 ERROR [1468295140 25.0s] dns: exchange failed for ping.manjaro.org. IN A: dial tcp 85.192.63.245:443: i/o timeout
+0300 2025-10-14 21:49:04 INFO [1468295140 25.0s] outbound/vless[proxy]: outbound packet connection to 1.1.1.1:53
+0300 2025-10-14 21:49:04 INFO [1468295140 25.0s] outbound/vless[proxy]: outbound packet connection to 1.1.1.1:53
+0300 2025-10-14 21:49:04 INFO [1468295140 25.0s] outbound/vless[proxy]: outbound packet connection to 1.1.1.1:53
+0300 2025-10-14 21:49:04 INFO [3615164628 13.17s] outbound/vless[proxy]: outbound packet connection to 1.1.1.1:53
+0300 2025-10-14 21:49:04 INFO [1553874406 25.0s] outbound/vless[proxy]: outbound packet connection to 1.1.1.1:53
+0300 2025-10-14 21:49:04 ERROR [1468295140 25.0s] dns: exchange failed for ping.manjaro.org. IN A: dial tcp 85.192.63.245:443: i/o timeout
+0300 2025-10-14 21:49:04 ERROR [1468295140 25.0s] dns: exchange failed for ping.manjaro.org. IN A: dial tcp 85.192.63.245:443: i/o timeout
+0300 2025-10-14 21:49:04 ERROR [3615164628 13.17s] dns: exchange failed for ident.me. IN AAAA: dial tcp 85.192.63.245:443: i/o timeout
+0300 2025-10-14 21:49:04 ERROR [1468295140 25.0s] dns: exchange failed for ping.manjaro.org. IN A: dial tcp 85.192.63.245:443: i/o timeout
+0300 2025-10-14 21:49:04 DEBUG [2575630200 5.0s] dns: exchange www.youtube.com. IN AAAA
+0300 2025-10-14 21:49:04 INFO [2008844448 0ms] inbound/direct[local-dns-in]: inbound packet connection from 127.0.0.1:57708
+0300 2025-10-14 21:49:04 INFO [2008844448 0ms] inbound/direct[local-dns-in]: inbound packet connection to 127.0.0.1:53
+0300 2025-10-14 21:49:04 DEBUG [2008844448 0ms] router: match[0] => sniff
+0300 2025-10-14 21:49:04 DEBUG [2008844448 0ms] router: sniffed packet protocol: dns
+0300 2025-10-14 21:49:04 DEBUG [2008844448 0ms] router: match[1] => resolve
+0300 2025-10-14 21:49:04 DEBUG [2008844448 0ms] router: match[2] protocol=dns || port=53 => hijack-dns

Thought

Troubleshooting sing-box setup

We need to troubleshoot the user's sing-box and dnsmasq setup, considering the provided logs. The error implies a connection attempt to 1.1.1.1:53 via VLESS, but it fails due to a timeout. This could point to issues with the VLESS server being unreachable, a port closure, or a routing problem. The sing-box seems to be using DNS over the VLESS connection.

Diagnosing VLESS connection issue

The error shows the VLESS server timeout when trying to connect at 85.192.63.245:443. This suggests the server is unreachable, like a potential IP change or firewall issue. The DNS queries via sing-box to Cloudflare (1.1.1.1) fail due to this. I'll outline a step-by-step diagnosis and a fallback DNS solution.

Investigating server connection issues

The VLESS server is using IP 85.192.63.245, and if TLS is involved, there’s the possibility of using Reality or Vision for obfuscation, which doesn’t require a valid cert. To troubleshoot, I'll recommend checking TCP connectivity, possible ISP blocks, or firewall issues. Additionally, I'll look into the DNS resolution loop and binding issues on the local DNS server.

Investigating DNS configuration mismatch

It looks like there may be a configuration mismatch: while dnsmasq was set to forward to 127.0.0.1:1053, the logs show DNS traffic going to 127.0.0.1:53. This suggests sing-box might be hijacking traffic on port 53, possibly bypassing dnsmasq's intended forwarding settings. I'll recommend checking this routing setup and making necessary adjustments.

Providing troubleshooting steps for DNS and VLESS issues

The configuration mismatch between dnsmasq and sing-box could be a key issue. To investigate, check if dnsmasq is forwarding correctly to the intended port and confirm sing-box DNS settings. Additionally, ensure VLESS connectivity with tests like curl and nc. Explore potential server access issues and offer a rescue DNS method for testing.

Providing troubleshooting steps in Russian

Based on the logs, sing-box is listening on port 53, not dnsmasq, which might be causing issues. If there's a port conflict or misconfiguration, follow these basic steps:

  1. Check server connection via nc or curl to rule out network issues.
  2. Verify dnsmasq configuration or port binding.
  3. Confirm server

Thought for 1m 49s

Answer

Похоже, у тебя сломалось не «DNS через dnsmasq/sing-box», а сам выезд в интернет через прокси: sing-box не может достучаться до твоего VLESS-сервера.

Что видно из логов

  • Запросы приходят в inbound local-dns-in на 127.0.0.1:53:
    text
    inbound packet connection to 127.0.0.1:53 router: protocol=dns => hijack-dns
    ⇒ Сейчас sing-box слушает порт 53, а не 1053.
  • Дальше sing-box пытается резолвить через твой DNS-апстрим (1.1.1.1) поверх прокси, но сам прокси не поднимается:
    text
    outbound/vless[proxy]: ... to 1.1.1.1:53 dns: ... dial tcp 85.192.63.245:443: i/o timeout
    ⇒ TCP-подключение к твоему VLESS-серверу 85.192.63.245:443 из клиента не устанавливается (таймаут на соединении). Это либо:
    • сервер лег/не слушает 443,
    • фаервол/провайдер блокирует,
    • IP поменялся/route сломан,
    • порт на сервере изменили.

Из-за этого все DNS-обмены «через прокси» падают.


Быстрая диагностика (клиент)

  1. Проверить доступность сервера
bash
# простой коннект nc -vz 85.192.63.245 443 # трассировка до узла mtr -rwzc 5 85.192.63.245 # попытка TCP SYN (увидишь хотя бы SYN/ACK/RST) sudo hping3 -S -p 443 -c 3 85.192.63.245
  • Если везде таймаут → блок/route проблема вне sing-box.
  • Если «refused»/RST → порт открыт, но служба не слушает/не совпадает протокол.
  1. Кто держит 53/1053 локально
bash
sudo ss -lunpt | egrep '(:53|:1053)\b' systemctl status dnsmasq systemctl status systemd-resolved
  • Если sing-box слушает 53, а dnsmasq тоже пытается занять 53 — будет конфликт. Либо переведи sing-box на 1053, либо в dnsmasq.conf укажи server=127.0.0.1#53. Главное — синхронизируй порт.

Проверка/исправление на сервере (если есть доступ)

bash
# Xray/ sing-box на сервере sudo systemctl status xray sudo journalctl -u xray -n 100 --no-pager # порт и фаервол sudo ss -ltnup 'sport = :443' sudo ufw status verbose || sudo iptables -S | grep 443

Убедись, что:

  • слушается TCP 443 (и тот транспорт, который настроен — tcp/ws/grpc/REALITY),
  • UUID/flow/SNI/host/shortId/publicKey (для REALITY/Vision) не менялись,
  • если переносил порт — измени его и на клиенте.

Важно: твой лог — таймаут на TCP-коннекте. Это происходит до TLS/REALITY-рукопожатия. Значит, проблема с сетевой доступностью (IP/порт/фаервол/блок), а не с несовпадением ключей/shortId.


Временный «буфер» чтобы оживить резолв

Пока чинится доступ к серверу, можно временно дать DNS ходить в обход прокси (понимая риски утечки DNS к провайдеру):

Вариант A (быстро через dnsmasq):

ini
# /etc/dnsmasq.conf (временно) no-resolv server=1.1.1.1 # или DoT через stubby/unbound, если хочешь шифрование без прокси

Перезапусти:

bash
sudo systemctl restart dnsmasq

Вариант B (через sing-box): В dns.servers[] для одного апстрима поставь "detour": "direct", а dns.final укажи на него:

json
"dns": { "servers": [ { "tag": "cf-direct", "address": "1.1.1.1", "strategy": "prefer_ipv4", "detour": "direct" }, { "tag": "cf-proxy", "address": "1.1.1.1", "strategy": "prefer_ipv4", "detour": "proxy" } ], "final": "cf-direct" }

Потом вернёшь на cf-proxy, когда VLESS оживёт.


Приведи в порядок порт 53/1053 (на выбор)

Вариант 1: sing-box на 1053, dnsmasq форвардит на 1053

sing-box (фрагмент)

json
"inbounds": [ { "type": "direct", "tag": "local-dns-in", "listen": "127.0.0.1", "listen_port": 1053, "sniff": true } ], "route": { "rules": [ { "protocol": "dns", "outbound": "hijack-dns" } ] }

/etc/dnsmasq.conf

ini
listen-address=127.0.0.1 bind-interfaces no-resolv server=127.0.0.1#1053 bogus-priv # filter-aaaa # если нужно

Вариант 2: sing-box слушает 53, dnsmasq не нужен

Тогда отключи dnsmasq, освободи 53 от других демонов и укажи в /etc/resolv.conf:

nameserver 127.0.0.1

(и закрепи chattr +i, если требуется).


Чек-лист «почему внезапно перестало»

  • На сервере обновили Xray/sing-box и сменились ключи/shortId/flow (для REALITY/Vision) — клиент остался со старым конфигом. Но у тебя именно таймаут, так что сперва проверь доступность порта/IP.
  • Хостер/провайдер начал фильтровать TCP 443 к твоему IP. Попробуй порт 2053/2087/2096/8443 или другой IP.
  • На сервере включили/ужесточили UFW/iptables/security-group.
  • IP сервера изменился (если совпадал с доменом, а ты сейчас подключаешься по голому IP).
  • На клиенте что-то перехватило порт 53 (systemd-resolved) и мешает твоей схеме.

Мини-план действий

  1. Прогони nc -vz 85.192.63.245 443 и mtr — пойми, доступен ли сервер с клиента.
  2. Если недоступен → проверь фаервол/порт/маршрут/смену IP на сервере; попробуй альтернативный порт.
  3. На время — переключи DNS на direct, чтобы не быть «слепым».
  4. Синхронизируй, кто слушает 53/1053 (sing-box vs dnsmasq), чтобы не было конфликта.

Если хочешь, скидывай свои фрагменты конфигов sing-box (dns, inbounds, outbounds[proxy]) и вывод трёх команд:

text
nc -vz 85.192.63.245 443 sudo ss -ltnup 'sport = :443' sudo systemctl status xray

— подскажу точечно, что именно править.

Question

Вот мой конфиг

{
"log": {
"level": "debug",
"timestamp": true
},
"dns": {
"servers": [
{
"tag": "dns_proxy",
"type": "udp",
"server": "9.9.9.9",
"detour": "proxy"
}
],
"rules": [],
"final": "dns_proxy"
},
"inbounds": [
{
"type": "tun",
"tag": "tun-in",
"interface_name": "singtun0",
"address": [
"172.18.0.1/30"
],
"mtu": 1500,
"auto_route": true,
"strict_route": true,
"route_exclude_address": [
"192.168.0.0/16",
"10.0.0.0/8",
"172.16.0.0/12"
]
},
{
"type": "direct",
"tag": "local-dns-in",
"listen": "127.0.0.1",
"listen_port": 1053,
"override_port": 53
}
],
"outbounds": [
{
"type": "direct",
"tag": "direct"
},
{
"type": "vless",
"tag": "proxy",
"server": "85.192.63.245",
"server_port": 443,
"uuid": "--------------------------",
"flow": "xtls-rprx-vision",
"tls": {
"enabled": true,
"server_name": "github.com",
"utls": {
"enabled": true,
"fingerprint": "chrome"
},
"reality": {
"enabled": true,
"public_key": "--------------",
"short_id": "------"
}
}
},
{
"type": "block",
"tag": "block"
}
],
"route": {
"rules": [
{ "action": "sniff" },
{ "protocol": "dns", "action": "hijack-dns" },
{ "inbound": "local-dns-in", "outbound": "dns_proxy" },
{
"type": "logical",
"mode": "or",
"rules": [
{ "port": 853 },
{ "network": "udp", "port": 443 },
{ "protocol": "stun" }
],
"action": "reject",
"method": "default"
},
{ "ip_is_private": true, "outbound": "direct" },
{ "domain": ["vd.aq.ru"], "outbound": "direct" },
{ "domain": ["www.speedtest.net"], "outbound": "direct" },
{ "domain": ["www.lk.tltinet.ru"], "outbound": "direct" }
],
"final": "proxy",
"auto_detect_interface": true
}
}

на сервере:
kira@Bifrst:/xray/simple-xray-coresudoufwstatusverbosesudoiptablesSgrep443[sudo]passwordforkira:Status:inactivekira@Bifrst: /xray/simplexraycore sudo ufw status verbose || sudo iptables -S | grep 443 [sudo] password for kira: Status: inactive kira@Bifrst:~/xray/simple-xray-core sudo ss -ltnup 'sport = :443'
Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
tcp LISTEN 0 4096 *:443 : users:(("xray",pid=703,fd=4))
kira@Bifrst:
/xray/simple-xray-core$

kira@Bifrst:~/xray/simple-xray-core$ sudo systemctl status xray
[sudo] password for kira:
● xray.service - Xray Service
Loaded: loaded (/etc/systemd/system/xray.service; enabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/xray.service.d
└─10-donot_touch_single_conf.conf
Active: active (running) since Mon 2025-10-13 23:05:20 MSK; 23h ago
Docs: https://github.com/xtls
Main PID: 703 (xray)
Tasks: 7 (limit: 2291)
Memory: 63.8M
CPU: 19.593s
CGroup: /system.slice/xray.service
└─703 /usr/local/bin/xray run -config /usr/local/etc/xray/config.json

Oct 13 23:05:20 Bifrst.aeza.network systemd[1]: Started Xray Service.
Oct 13 23:05:21 Bifrst.aeza.network xray[703]: Xray 25.9.11 (Xray, Penetrates Everything.) 3edfb0e (go1.25.1 linux/amd64)
Oct 13 23:05:21 Bifrst.aeza.network xray[703]: A unified platform for anti-censorship.
Oct 13 23:05:21 Bifrst.aeza.network xray[703]: 2025/10/13 23:05:21.296093 [Info] infra/conf/serial: Reading config: &{Name:/usr/local/etc/xray/config.json Format:json}
Oct 13 23:05:22 Bifrst.aeza.network xray[703]: 2025/10/13 23:05:22.191799 [Warning] core: Xray 25.9.11 started

на моей linux машине:

nc -vz 85.192.63.245 443
Connection to 85.192.63.245 443 port [tcp/https] succeeded!

Thought

Analyzing sing-box configuration

It looks like the configuration involves DNS over UDP via a proxy — using the Quad9 DNS server with vless for outbound connections. The issue might be related to "override_port: 53" and potential port hijacking in your "direct" inbound setup. I need to confirm if "direct" inbound in sing-box interacts with override settings and TProxy correctly. Let’s further explore this.

Analyzing DNS hijack and connectivity

It seems like there’s a chance that the override_port 53 configuration is causing some conflicts with the inbound DNS packets. This might be due to a "hijack-dns" rule or a mismatch in port handling, but the key error earlier was the timeout when dialing the server. Now, it seems like the server is reachable, and connectivity is working fine.

Evaluating outbound connection issue

The issue could be related to using the wrong outbound network type or a mismatch with the TLS settings in the vless transport. Since REALITY provides TLS-like obfuscation, the "vision" handshake might need TLS disabled for proper operation. The timeout error earlier might suggest blocking of the connection attempt.

Checking for routing loop

It looks like the route might be configured to send traffic through "tun" with strict_route enabled, causing a possible routing loop — routing the server IP back through the proxy. This could lead to unreachable connections, as the tunnel won’t be established until the proxy is working. Adding an outbound direct rule for the server IP might fix the issue.

Troubleshooting routing and connection issue

It seems like the server connection attempts are facing a routing loop or blockage. To resolve it, I’d recommend adding a direct route rule for the server IP and excluding it from the TUN route. Setting the server's IP explicitly on "route_exclude_address" and adjusting relevant configurations should help prevent loops. If needed, tweaking the DNS settings and ensuring proper outbound rules may help streamline connections.

Addressing timeout and connection failures

To fix connection issues, I suggest:

  • Routing server IP directly, excluding it from TUN.
  • Check DNS configuration for syntax errors, using "address" instead of "server" for DNS servers.
  • Review inbound types, ensuring proper settings for DNS handling.
  • Improve outbound proxies using "detour" with updated DNS addressing, ensuring UDP or DoH protocols work.

These should help resolve the routing and connection difficulties.

Thought for 55s

Answer

Спасибо за конфиг и проверки — картина сложилась.

Главное: у тебя TUN (auto_route:true, strict_route:true) + final: "proxy". Без явного «байпаса» сам сервер (85.192.63.245:443) уходит… через тот же прокси/туннель. Пока туннель не поднят, трафик до сервера зацикливается и connect() ловит таймаут — ровно то, что было в логах (dial tcp 85.192.63.245:443: i/o timeout). nc -vz сейчас успешен, потому что он шёл прямо по системному маршруту (либо в момент проверки TUN был неактивен/маршрут уже выправился). Чтобы это не «плавало», сервер надо исключить из туннеля и отправлять DIRECT всегда.

Плюс у тебя в dns.servers[] объект с полями type/server, а в sing-box используется поле address (а протокол задают префиксом udp://, tls://, https://). Это не критично для объяснения таймаутов к серверу, но лучше поправить, чтобы DNS-конфиг был корректным и предсказуемым.


Что поправить (минимальный патч)

  1. Исключи IP сервера из TUN и рути его DIRECT
  • В inbounds[0].tun.route_exclude_address добавь IP:
json
"route_exclude_address": [ "192.168.0.0/16", "10.0.0.0/8", "172.16.0.0/12", "85.192.63.245/32" ]
  • В route.rules выше правила final добавь принудительный DIRECT:
json
{ "ip_cidr": ["85.192.63.245/32"], "outbound": "direct" }
  1. Приведи DNS-блок к валидному синтаксису
    (и оставь возможность быстро переключиться на direct, если прокси снова отвалится)
json
"dns": { "servers": [ { "tag": "dns_proxy", "address": "udp://9.9.9.9", "strategy": "prefer_ipv4", "detour": "proxy" }, { "tag": "dns_direct", "address": "tls://1.1.1.1:853", "strategy": "prefer_ipv4", "detour": "direct" } ], "rules": [], "final": "dns_proxy" }

Если нужно «временно оживить» резолв при падении прокси — замени final на "dns_direct" и верни назад, когда VLESS оживёт.

  1. DNS inbound: оставь порт 1053 и убери override_port
    override_port: 53 тут не нужен и только путает логи.
json
{ "type": "direct", "tag": "local-dns-in", "listen": "127.0.0.1", "listen_port": 1053 }

dnsmasq по-прежнему форвардит на 127.0.0.1#1053 — всё сойдётся.

  1. Порядок правил маршрутизации
    Оставь как есть, но проверь, что правило ip_cidr 85.192.63.245/32 -> direct стоит выше логического REJECT и выше любых общих правил, чтобы точно сработало:
json
"route": { "rules": [ { "action": "sniff" }, { "protocol": "dns", "action": "hijack-dns" }, { "inbound": "local-dns-in", "outbound": "dns_proxy" }, { "ip_cidr": ["85.192.63.245/32"], "outbound": "direct" }, { "type": "logical", "mode": "or", "rules": [ { "port": 853 }, { "network": "udp", "port": 443 }, { "protocol": "stun" } ], "action": "reject", "method": "default" }, { "ip_is_private": true, "outbound": "direct" }, { "domain": ["vd.aq.ru"], "outbound": "direct" }, { "domain": ["www.speedtest.net"], "outbound": "direct" }, { "domain": ["www.lk.tltinet.ru"], "outbound": "direct" } ], "final": "proxy", "auto_detect_interface": true }

Быстрая проверка после правок

bash
# 1) Валидация конфига sing-box check -c /путь/к/config.json # 2) Перезапуск sudo systemctl restart sing-box # 3) Кто слушает DNS-порты sudo ss -lunpt | egrep '(:53|:1053)\b' systemctl status dnsmasq # 4) Локальный DNS через цепочку dig @127.0.0.1 -p 53 example.org +time=2 +tries=1 dig @127.0.0.1 -p 1053 example.org +time=2 +tries=1 # если напрямую в sing-box # 5) Нет ли утечек DNS наружу: sudo tcpdump -i enp2s0 -n port 53

Если после этих правок ещё увидишь «dial tcp … i/o timeout», пришли 20–30 строк свежих логов sing-box (уровень debug) сразу после старта и результат:

ip route get 85.192.63.245

— проверим, что маршрут до сервера действительно идёт в обход singtun0.

Отдельно: на сервере Xray активен и слушает *:443, UFW выключен — это хорошо. Для REALITY/Vision важно, чтобы server_name на клиенте (github.com) входил в serverNames на сервере, и public_key/shortId совпадали, но при таймауте connect() до этого этапа дело не доходит — сперва нужно стабильно добираться до 85.192.63.245:443 без попыток завернуть этот трафик в туннель.

Question

sing-box check -c sing_box_e1ectr0n.json
WARN[0000] legacy DNS servers is deprecated in sing-box 1.12.0 and will be removed in sing-box 1.14.0, checkout documentation for migration: https://sing-box.sagernet.org/migration/#migrate-to-new-dns-server-formats
WARN[0000] missing route.default_domain_resolver or domain_resolver in dial fields is deprecated in sing-box 1.12.0 and will be removed in sing-box 1.14.0, checkout documentation for migration: https://sing-box.sagernet.org/migration/#migrate-outbound-dns-rule-items-to-domain-resolver

~/opt/xray_conf

curl ident.me
curl: (56) Recv failure: Соединение разорвано другой стороной

~/opt/xray_conf 15s

sudo ss -lunpt | egrep '(:53|:1053)\b'
udp UNCONN 0 0 127.0.0.1:1053 0.0.0.0:* users:(("sing-box",pid=399443,fd=9))
udp UNCONN 0 0 127.0.0.1:53 0.0.0.0:* users:(("dnsmasq",pid=350877,fd=4))
tcp LISTEN 0 32 127.0.0.1:53 0.0.0.0:* users:(("dnsmasq",pid=350877,fd=5))
tcp LISTEN 0 4096 127.0.0.1:1053 0.0.0.0:* users:(("sing-box",pid=399443,fd=8))

~/opt/xray_conf

dig @127.0.0.1 -p 53 example.org +time=2 +tries=1

; <<>> DiG 9.20.13 <<>> @127.0.0.1 -p 53 example.org +time=2 +tries=1
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 53304
;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;example.org. IN A

;; ANSWER SECTION:
example.org. 104 IN A 23.215.0.133
example.org. 104 IN A 23.220.75.235
example.org. 104 IN A 23.215.0.132
example.org. 104 IN A 23.220.75.238

;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1) (UDP)
;; WHEN: Tue Oct 14 22:29:37 MSK 2025
;; MSG SIZE rcvd: 104

~/opt/xray_conf

dig @127.0.0.1 -p 1053 example.org +time=2 +tries=1

; <<>> DiG 9.20.13 <<>> @127.0.0.1 -p 1053 example.org +time=2 +tries=1
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 41098
;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; MBZ: 0x0052, udp: 1232
; PADDING: (360 bytes)
;; QUESTION SECTION:
;example.org. IN A

;; ANSWER SECTION:
example.org. 82 IN A 23.215.0.133
example.org. 82 IN A 23.220.75.235
example.org. 82 IN A 23.215.0.132
example.org. 82 IN A 23.220.75.238

;; Query time: 1 msec
;; SERVER: 127.0.0.1#1053(127.0.0.1) (UDP)
;; WHEN: Tue Oct 14 22:29:59 MSK 2025
;; MSG SIZE rcvd: 512

~/opt/xray_conf

sudo tcpdump -i enp2s0 -n port 53
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on enp2s0, link-type EN10MB (Ethernet), snapshot length 262144 bytes
22:30:27.465990 IP 192.168.0.85.48015 > 8.8.8.8.53: 1013+ A? chat01.ai. (27)
22:30:27.465997 IP 192.168.0.85.48015 > 8.8.8.8.53: 23796+ AAAA? chat01.ai. (27)
22:30:27.516976 IP 8.8.8.8.53 > 192.168.0.85.48015: 1013 2/0/0 A 8.47.69.6, A 8.6.112.6 (59)
22:30:27.521413 IP 8.8.8.8.53 > 192.168.0.85.48015: 23796 2/0/0 AAAA 2a06:98c1:3123:8000::6, AAAA 2a06:98c1:3122:8000::6 (83)
22:31:06.447757 IP 192.168.0.85.37128 > 8.8.8.8.53: 43195+ A? yandex.ru. (27)
22:31:06.447765 IP 192.168.0.85.37128 > 8.8.8.8.53: 39613+ AAAA? yandex.ru. (27)
22:31:06.489811 IP 8.8.8.8.53 > 192.168.0.85.37128: 43195 3/0/0 A 77.88.55.88, A 5.255.255.77, A 77.88.44.55 (75)
22:31:06.489875 IP 8.8.8.8.53 > 192.168.0.85.37128: 39613 1/0/0 AAAA 2a02:6b8:a::a (55)
^C
8 packets captured
8 packets received by filter
0 packets dropped by kernel

Thought

Identifying DNS leak issue

We need to address their logs, particularly about DNS configuration. It seems like sing-box is working well, but there’s a DNS leak when queries are going directly to 8.8.8.8. This might be caused by a system setting or app bypassing local DNS. I'll look further into resolving this routing issue.

Investigating connectivity issue

The DNS leak isn’t the real issue here; the main problem was timeouts connecting to 85.192.63.245:443. They mentioned adding a direct route but didn’t show updated configurations. The failure in curl ident.me suggests possible proxy issues, either from a Reality mismatch or route problem. I'll check logs further.

Investigating VLESS and connection reset

The curl failure with "Recv failure: Connection reset by peer" might indicate an issue with the VLESS handshake or proxy flow, possibly related to XTLS or Vision configuration. If the server is misconfigured (e.g., mismatched server names or keys), it could cause early termination or resets. I'll review their outbound and server settings.

Investigating DNS routing issue

The system uses TUN to route traffic through sing-box via VLESS, but DNS queries to 8.8.8.8 suggest some apps are bypassing the intended route. The issue may be an accidental exclusion or a misconfiguration, such as dnsmasq redirecting traffic. I’ll need to check the route settings and resolv.conf for any gaps.

Investigating DNS leak issue

The DNS request issue seems linked to a process bypassing the intended TUN route, possibly due to apps directly querying 8.8.8.8 instead of using 127.0.0.1:53. The underlying VLESS may also be failing due to handshake mismatches. I'll propose checking the client/server settings and verifying logs to clarify whether the proxy setup is working as expected.

Providing updated config suggestions

The DNS chain setup with 127.0.0.1:53 to dnsmasq works, but there's still a leak to 8.8.8.8. Additionally, the curl reset suggests VLESS issues. I'll propose an updated config addressing DNS schema migration, routing fix, and ensuring the TUN captures UDP DNS traffic properly. Ensuring the network settings for DNS interception should help prevent further leaks.

Providing DNS leak fix and config

To address the DNS leak and connection issues, I’ll suggest the following steps: update the config with proper DNS proxy, add iptables rules to capture all DNS queries, and ensure that dnsmasq is restricted from using external resolvers like 8.8.8.8. The strategy includes refining routing, updating domain resolvers, and fixing identified leaks.

Thought for 2m 19s

Answer

Отличные прогоны! Сейчас видно:

  • DNS-цепочка dnsmasq(53) → sing-box(1053) работает (оба dig ок).
  • Но у тебя есть утечки DNS наружу: tcpdump показал прямые пакеты на 8.8.8.8:53 с реального интерфейса enp2s0.
  • Плюс curl ident.me рвётся — это уже плоскость data-plane через VLESS/REALITY.

Ниже — компактный план, который закрывает обе проблемы и убирает предупреждения sing-box check (миграция DNS-секции).


1) Обнови конфиг sing-box (новый формат DNS + байпас до сервера)

Заменяй соответствующие куски (секреты не забудь подставить):

json
{ "log": { "level": "debug", "timestamp": true }, "dns": { "servers": [ { "tag": "dns_proxy", "address": "https://dns.quad9.net/dns-query", "strategy": "prefer_ipv4", "detour": "proxy" }, { "tag": "dns_direct", "address": "tls://1.1.1.1:853", "strategy": "prefer_ipv4", "detour": "direct" } ], "final": "dns_proxy" }, "inbounds": [ { "type": "tun", "tag": "tun-in", "interface_name": "singtun0", "address": ["172.18.0.1/30"], "mtu": 1500, "auto_route": true, "strict_route": true, "route_exclude_address": [ "192.168.0.0/16", "10.0.0.0/8", "172.16.0.0/12", "85.192.63.245/32" // ВАЖНО: твой сервер всегда в обход туннеля ] }, { "type": "direct", "tag": "local-dns-in", "listen": "127.0.0.1", "listen_port": 1053 } ], "outbounds": [ { "type": "direct", "tag": "direct" }, { "type": "vless", "tag": "proxy", "server": "85.192.63.245", "server_port": 443, "uuid": "YOUR-UUID", "flow": "xtls-rprx-vision", "tls": { "enabled": true, "server_name": "github.com", "utls": { "enabled": true, "fingerprint": "chrome" }, "reality": { "enabled": true, "public_key": "PUBKEY", "short_id": "SHORTID" } } }, { "type": "block", "tag": "block" } ], "route": { "default_domain_resolver": "dns_proxy", // убирает предупреждение о миграции "auto_detect_interface": true, "rules": [ { "action": "sniff" }, { "protocol": "dns", "action": "hijack-dns" }, { "inbound": "local-dns-in", "outbound": "dns_proxy" }, { "ip_cidr": ["85.192.63.245/32"], "outbound": "direct" }, // БАЙПАС до сервера { "type": "logical", "mode": "or", "rules": [ { "port": 853 }, { "network": "udp", "port": 443 }, { "protocol": "stun" } ], "action": "reject", "method": "default" }, { "ip_is_private": true, "outbound": "direct" }, { "domain": ["vd.aq.ru","www.speedtest.net","www.lk.tltinet.ru"], "outbound": "direct" } ], "final": "proxy" } }

Почему это важно:

  • Новый формат DNS (address: с https:///tls://) — без деприкаций.
  • БАЙПАС 85.192.63.245/32 гарантирует, что соединение к серверу никогда не уйдёт в сам туннель.
  • default_domain_resolver убирает второе предупреждение check.

2) Жёстко пресечь утечки DNS на уровне хоста

Даже если какое-то приложение игнорирует resolv.conf и шлёт на 8.8.8.8, перехватим это локально.

nftables (современные системы)

bash
sudo nft add table inet dnsredir sudo nft add chain inet dnsredir output '{ type nat hook output priority 0; }' sudo nft add rule inet dnsredir output udp dport 53 redirect to :53 sudo nft add rule inet dnsredir output tcp dport 53 redirect to :53

iptables-nft (если удобнее iptables)

bash
sudo iptables -t nat -A OUTPUT -p udp --dport 53 -j REDIRECT --to-ports 53 sudo iptables -t nat -A OUTPUT -p tcp --dport 53 -j REDIRECT --to-ports 53

Это «пояс с подтяжками»: весь локальный :53 уходит к твоему dnsmasq на 127.0.0.1:53, а тот уже форвардит в sing-box:1053.

Проверь, что в /etc/dnsmasq.conf действительно есть:

text
listen-address=127.0.0.1 bind-interfaces no-resolv server=127.0.0.1#1053

и нет лишних server= из /etc/NetworkManager/dnsmasq.d/*.conf:

bash
grep -R "server=" /etc/dnsmasq* /etc/NetworkManager/dnsmasq.d/ -n || true sudo systemctl restart dnsmasq

3) Перезапуск и проверки

bash
# Валидация конфига sing-box check -c /путь/к/конфигу.json # Перезапуск sudo systemctl restart sing-box # Должно слушать ровно так: sudo ss -lunpt | egrep '(:53|:1053)\b' # udp 127.0.0.1:53 (dnsmasq), udp/tcp 127.0.0.1:1053 (sing-box) # DNS через цепочку dig @127.0.0.1 example.org +time=2 +tries=1 dig @127.0.0.1 -p 1053 example.org +time=2 +tries=1 # Отсутствие утечек: sudo tcpdump -i enp2s0 -n port 53 # должно быть пусто при обычном резолве

4) Проверка data-plane через прокси (VLESS/REALITY)

  1. Убедись, что маршрут к серверу действительно DIRECT:
bash
ip route get 85.192.63.245 # Ожидаем dev enp2s0 (или твой физический iface), НЕ singtun0
  1. Тест страницы:
bash
curl -v https://ident.me/ --max-time 5

Если снова Recv failure/RST:

  • Это уже согласование Vision/REALITY. Проверь на сервере Xray:
    • inbound flow: "xtls-rprx-vision"
    • realityprivate_key соответствует твоему public_key на клиенте,
    • short_ids содержит твой short_id,
    • server_names включает github.com (или поменяй server_name у клиента на то, что реально разрешено на сервере).

В случае именно Vision/REALITY несоответствий в логах sing-box обычно есть явные сообщения (invalid short id / reality handshake failed). Если понадобится — кинь 20–30 строк sing-box логов уровня debug вокруг попытки curl.


Почему tcpdump видел 8.8.8.8

Какие-то процессы (иногда браузеры/проги, Docker-контейнеры, NetworkManager-скрипты) игнорируют resolv.conf и бьют на публичные DNS. TUN всё равно должен их перехватывать, но в реальной жизни иногда «проскальзывает». Редирект на уровне хоста (п.2) убивает класс утечек гарантированно.


Если сделаешь правки и всё равно будут сбои — пришли:

  • вывод ip rule, ip route show table all | sed -n '1,200p' | sed -n '200,400p' (или хотя бы ip route get 85.192.63.245);
  • 20–30 строк свежих логов sing-box уровня debug при неудачном curl.

Должно полететь. 🚀

Question

Ошибка сохраняется

+0300 2025-10-14 22:54:28 ERROR [3324043763 20.0s] dns: exchange failed for detectportal.firefox.com. IN A: context deadline exceeded
+0300 2025-10-14 22:54:28 ERROR [3324043763 20.0s] dns: exchange failed for detectportal.firefox.com. IN A: context deadline exceeded
+0300 2025-10-14 22:54:28 ERROR [3324043763 20.0s] dns: exchange failed for detectportal.firefox.com. IN A: context deadline exceeded
+0300 2025-10-14 22:54:28 ERROR [1836561970 20.0s] dns: exchange failed for detectportal.firefox.com. IN AAAA: context deadline exceeded
+0300 2025-10-14 22:54:28 ERROR [1836561970 20.0s] dns: exchange failed for detectportal.firefox.com. IN AAAA: context deadline exceeded
+0300 2025-10-14 22:54:28 ERROR [3324043763 20.2s] dns: exchange failed for detectportal.firefox.com. IN A: context deadline exceeded
+0300 2025-10-14 22:54:28 INFO [3324043763 20.2s] outbound/vless[proxy]: outbound connection to dns.quad9.net:443
+0300 2025-10-14 22:54:28 DEBUG [1836561970 20.2s] dns: exchange detectportal.firefox.com. IN AAAA
+0300 2025-10-14 22:54:28 INFO [1836561970 20.2s] outbound/vless[proxy]: outbound connection to dns.quad9.net:443
+0300 2025-10-14 22:54:28 DEBUG [3324043763 20.3s] dns: exchange detectportal.firefox.com. IN A
+0300 2025-10-14 22:54:28 INFO [3324043763 20.3s] outbound/vless[proxy]: outbound connection to dns.quad9.net:443
+0300 2025-10-14 22:54:29 ERROR [3303497901 20.0s] dns: exchange failed for cdn.ghostery.com. IN A: context deadline exceeded
+0300 2025-10-14 22:54:29 ERROR [1235402463 20.0s] dns: exchange failed for cdn.ghostery.com. IN AAAA: context deadline exceeded
+0300 2025-10-14 22:54:29 ERROR [1235402463 20.1s] dns: exchange failed for cdn.ghostery.com. IN AAAA: context deadline exceeded
+0300 2025-10-14 22:54:29 ERROR [3303497901 20.1s] dns: exchange failed for cdn.ghostery.com. IN A: context deadline exceeded
+0300 2025-10-14 22:54:29 ERROR [1986449171 21.70s] dns: exchange failed for www.youtube.com. IN A: context deadline exceeded
+0300 2025-10-14 22:54:29 INFO [1986449171 21.70s] outbound/vless[proxy]: outbound connection to dns.quad9.net:443
+0300 2025-10-14 22:54:29 DEBUG [226357336 5.0s] dns: exchange www.youtube.com. IN AAAA
+0300 2025-10-14 22:54:29 DEBUG [1986449171 21.71s] dns: exchange www.youtube.com. IN A
+0300 2025-10-14 22:54:29 INFO [1986449171 21.71s] outbound/vless[proxy]: outbound connection to dns.quad9.net:443
+0300 2025-10-14 22:54:29 ERROR [609812009 22.2s] dns: exchange failed for ping.manjaro.org. IN AAAA: context deadline exceeded
+0300 2025-10-14 22:54:29 ERROR [1391471292 22.2s] dns: exchange failed for ping.manjaro.org. IN A: context deadline exceeded
+0300 2025-10-14 22:54:29 INFO [1391471292 22.2s] outbound/vless[proxy]: outbound connection to dns.quad9.net:443
+0300 2025-10-14 22:54:29 INFO [609812009 22.2s] outbound/vless[proxy]: outbound connection to dns.quad9.net:443
+0300 2025-10-14 22:54:29 INFO [609812009 22.2s] outbound/vless[proxy]: outbound connection to dns.quad9.net:443
+0300 2025-10-14 22:54:29 INFO [1391471292 22.2s] outbound/vless[proxy]: outbound connection to dns.quad9.net:443
+0300 2025-10-14 22:54:29 INFO [609812009 22.2s] outbound/vless[proxy]: outbound connection to dns.quad9.net:443
+0300 2025-10-14 22:54:29 INFO [1391471292 22.2s] outbound/vless[proxy]: outbound connection to dns.quad9.net:443
+0300 2025-10-14 22:54:29 INFO [1391471292 22.2s] outbound/vless[proxy]: outbound connection to dns.quad9.net:443
+0300 2025-10-14 22:54:29 INFO [1391471292 22.2s] outbound/vless[proxy]: outbound connection to dns.quad9.net:443
+0300 2025-10-14 22:54:29 INFO [609812009 22.2s] outbound/vless[proxy]: outbound connection to dns.quad9.net:443
+0300 2025-10-14 22:54:29 INFO [609812009 22.2s] outbound/vless[proxy]: outbound connection to dns.quad9.net:443
+0300 2025-10-14 22:54:30 ERROR [634839945 20.0s] dns: exchange failed for ident.me. IN A: context deadline exceeded
+0300 2025-10-14 22:54:30 ERROR [634839945 20.0s] dns: exchange failed for ident.me. IN A: context deadline exceeded
+0300 2025-10-14 22:54:30 ERROR [634839945 20.18s] dns: exchange failed for ident.me. IN A: context deadline exceeded
+0300 2025-10-14 22:54:30 INFO [634839945 20.18s] outbound/vless[proxy]: outbound connection to dns.quad9.net:443
+0300 2025-10-14 22:54:31 DEBUG [634839945 21.20s] dns: exchange ident.me. IN A
+0300 2025-10-14 22:54:31 INFO [634839945 21.20s] outbound/vless[proxy]: outbound connection to dns.quad9.net:443
+0300 2025-10-14 22:54:33 DEBUG [1836561970 25.3s] dns: exchange detectportal.firefox.com. IN AAAA
+0300 2025-10-14 22:54:33 DEBUG [3324043763 25.3s] dns: exchange detectportal.firefox.com. IN A
+0300 2025-10-14 22:54:33 ERROR [2198947280 20.0s] dns: exchange failed for google.com. IN AAAA: context deadline exceeded
+0300 2025-10-14 22:54:33 ERROR [3262239201 20.0s] dns: exchange failed for google.com. IN A: context deadline exceeded
+0300 2025-10-14 22:54:34 ERROR [226357336 10.0s] dns: exchange failed for www.youtube.com. IN AAAA: context deadline exceeded
+0300 2025-10-14 22:54:34 INFO [226357336 10.0s] outbound/vless[proxy]: outbound connection to dns.quad9.net:443

Может попробуем использвать другой порт, не 443,
как это сделать, и есть ли в этом смысл?

Thought

Considering port changes

In REALITY, I can bind to multiple ports, but changing the port means editing the server's inbound settings. I noticed Xray only listens on *:443. To add more ports like 2087, I’ll need to verify the proxy handshake works first and check if TUN strict_route might be blocking DoH requests.

Troubleshooting connection timeouts

It’s HTTPS over TCP on port 443 within the VLESS outbound proxy, but the 'reject' rule only affects pre-proxy flows, not proxied ones. So, the timeout might be because the server isn’t handling VLESS Vision properly, possibly due to a short_id/public_key mismatch. I need to review earlier logs to understand the issue better.

Checking server connectivity

It seems like the server is repeatedly trying to connect to dns.quad9.net:443 without a handshake result. This could be due to the server’s lack of outbound connectivity, possibly blocked by a firewall or hosting provider. I'll need to confirm that Xray is properly configured to allow outbound traffic.

Examining server and proxy setup

If Xray is set up correctly with inbound "detour," it should work fine, but TUN strict_route might intercept everything. We've excluded the server IP, but maybe we also need to exclude the default gateway—though I'm not sure it’s necessary. If curl fails, it suggests the proxy may not be functioning, so I'd test DNS resolution bypass.

Guiding port change and DNS fix

Yes, changing ports can help avoid throttling or SNI fingerprinting, but first, it's better to address DNS issues. If Quad9 is blocked, switch to a DNS provider like Cloudflare or Google DoH with correct settings. After that, you can test the changes and perhaps add a new server port for better flexibility.

Thought for 1m 50s

Answer

Спасибо за логи — теперь видно точнее, что ломается.

Что именно падает сейчас

В каждой строке видно: outbound/vless[proxy]: outbound connection to dns.quad9.net:443, а затем dns: exchange failed … context deadline exceeded.
Это означает: DNS-апстрим внутри sing-box (DoH к Quad9 через прокси) не отвечает. Причём это уже трафик сервер → Quad9, т.е. после установления канала клиент→VLESS-сервер. Если на хостинге сервера Quad9 недоступен/фильтруется, все DNS-запросы через прокси будут «зависать».

Менять клиентский порт с 443 на 2096/8443 имеет смысл только если блокируется соединение клиент → ваш сервер. Тут же отваливается сервер → Quad9, поэтому смена порта клиента проблему DNS не решит. Сначала сделаем апстрим, который гарантированно доступен с вашего сервера.


Поправляем DNS в sing-box (без деприкаций и без «зависаний»)

Сделайте один из вариантов для dns.servers и добавьте default_domain_resolver (чтобы убрать предупреждения check). Плюс — важно — зададим резолвер адреса апстрим-хоста как direct, чтобы не было «курица-яйцо».

Вариант A (надёжный): DoT Cloudflare по IP (не требует резолва)

json
"dns": { "servers": [ { "tag": "dns_proxy", "address": "tls://1.1.1.1:853", "strategy": "prefer_ipv4", "detour": "proxy" }, { "tag": "dns_direct", "address": "tls://1.0.0.1:853", "strategy": "prefer_ipv4", "detour": "direct" } ], "final": "dns_proxy" }, "route": { "default_domain_resolver": "dns_direct", ... }

Плюс: не нужен DNS для самого апстрима (IP), значит исключаем циркулярную зависимость. Если хостинг режет Quad9 — Cloudflare обычно жив.

Вариант B (если хотите DoH): Cloudflare DoH с «подстраховкой»

json
"dns": { "servers": [ { "tag": "dns_proxy", "address": "https://cloudflare-dns.com/dns-query", "address_resolver": "dns_direct", "strategy": "prefer_ipv4", "detour": "proxy" }, { "tag": "dns_direct", "address": "tls://1.1.1.1:853", "strategy": "prefer_ipv4", "detour": "direct" } ], "final": "dns_proxy" }, "route": { "default_domain_resolver": "dns_direct", ... }

Здесь address_resolver: "dns_direct" гарантирует, что имя cloudflare-dns.com будет резолвиться в обход прокси, и DoH не «зависнет» из-за отсутствия DNS до него.

Оставьте ваши предыдущие «антиутечки» (dnsmasq на 53, sing-box на 1053, iptables/nft редирект 53→локально) — это правильно.


Проверьте доступность апстримов с сервера

(это как раз то место, где всё и «сыпется»):

bash
# На ВАШЕМ сервере (где xray слушает 443): nc -vz 1.1.1.1 853 nc -vz cloudflare-dns.com 443 # Если Quad9 был недоступен: nc -vz dns.quad9.net 443

Если dns.quad9.net:443 таймаутится, а Cloudflare — ок, то причина найдена.


БАЙПАС до вашего VLESS-сервера — обязателен

Не убирайте то, что уже добавили:

  • в tun.route_exclude_address: "85.192.63.245/32",
  • в route.rules выше всех общих правил:
json
{ "ip_cidr": ["85.192.63.245/32"], "outbound": "direct" }

И проверьте маршрутизацию:

bash
ip route get 85.192.63.245 # должно показать dev вашего реального iface (НЕ singtun0)

Перезапуск и быстрые тесты

bash
sing-box check -c /путь/к/config.json sudo systemctl restart sing-box # DNS через цепочку: dig @127.0.0.1 example.org +time=2 +tries=1 # Убедиться, что на внешнем интерфейсе нет «сырого» 53: sudo tcpdump -i enp2s0 -n port 53

Если теперь DNS ожил, проверяйте data-plane:

bash
curl -v https://ident.me/ --max-time 5

А что насчёт смены порта (443 → 2096/8443/2053)?

Имеет смысл, если именно ваш провайдер блокирует/шэйпит клиентское соединение к серверу на 443 (например, из-за сигнатур). Тогда:

Вариант 1 — добавить порт в Xray

На сервере в inbounds добавьте второй inbound с теми же настройками, но с другим портом, например 2096. Перезапустите Xray и в клиенте поменяйте:

json
"outbounds": [ { "type": "vless", "tag": "proxy", "server": "85.192.63.245", "server_port": 2096, ... } ]

Вариант 2 — DNAT порта на сервере (если не хочется править Xray)

bash
# Проброс TCP 2096 → 443 на сервере sudo iptables -t nat -A PREROUTING -p tcp --dport 2096 -j REDIRECT --to-ports 443 sudo iptables -t nat -A PREROUTING -p tcp --dport 8443 -j REDIRECT --to-ports 443

Плюс открыть порты в firewall/SG, если есть. На клиенте ставите server_port: 2096 (или 8443).

Но подчёркиваю: текущая ошибка — timeout к dns.quad9.net через прокси. Переключение порта клиента без смены DNS-апстрима не устранит «context deadline exceeded».


Если всё ещё «context deadline exceeded»

Пришлите небольшой набор:

  • 20–30 строк sing-box (debug) вокруг одного запроса DNS после правок,
  • вывод ip route get 85.192.63.245,
  • и (по возможности на сервере) результат:
    text
    nc -vz 1.1.1.1 853 nc -vz cloudflare-dns.com 443 nc -vz dns.quad9.net 443

Тогда точечно добьём остатки.

Question

kira@Bifrst:/xray/simple-xray-corencvz1.1.1.1853Connectionto1.1.1.1853port[tcp/domains]succeeded!kira@Bifrst: /xray/simplexraycore nc -vz 1.1.1.1 853 Connection to 1.1.1.1 853 port [tcp/domain-s] succeeded! kira@Bifrst:~/xray/simple-xray-core nc -vz cloudflare-dns.com 443
Connection to cloudflare-dns.com (104.16.248.249) 443 port [tcp/https] succeeded!
kira@Bifrst:
/xray/simple-xray-corencvzdns.quad9.net443Connectiontodns.quad9.net(9.9.9.9)443port[tcp/https]succeeded!kira@Bifrst: /xray/simplexraycore nc -vz dns.quad9.net 443 Connection to dns.quad9.net (9.9.9.9) 443 port [tcp/https] succeeded! kira@Bifrst:~/xray/simple-xray-core

Лог запуска

WARN[0000] legacy DNS servers is deprecated in sing-box 1.12.0 and will be removed in sing-box 1.14.0, checkout documentation for migration: https://sing-box.sagernet.org/migration/#migrate-to-new-dns-server-formats
+0300 2025-10-14 23:04:34 INFO network: updated default interface enp2s0, index 2
+0300 2025-10-14 23:04:34 INFO inbound/tun[tun-in]: started at singtun0
+0300 2025-10-14 23:04:34 INFO inbound/direct[local-dns-in]: tcp server started at 127.0.0.1:1053
+0300 2025-10-14 23:04:34 INFO inbound/direct[local-dns-in]: udp server started at 127.0.0.1:1053
+0300 2025-10-14 23:04:34 INFO [764901384 4ms] inbound/direct[local-dns-in]: inbound packet connection from 127.0.0.1:41016
+0300 2025-10-14 23:04:34 INFO [764901384 4ms] inbound/direct[local-dns-in]: inbound packet connection to 127.0.0.1:1053
+0300 2025-10-14 23:04:34 DEBUG [764901384 5ms] router: match[0] => sniff
+0300 2025-10-14 23:04:34 DEBUG [764901384 6ms] router: sniffed packet protocol: dns
+0300 2025-10-14 23:04:34 DEBUG [764901384 6ms] router: match[1] protocol=dns => hijack-dns
+0300 2025-10-14 23:04:34 DEBUG [764901384 6ms] dns: exchange www.youtube.com. IN AAAA
+0300 2025-10-14 23:04:34 INFO [764901384 6ms] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:34 INFO [1601716269 1ms] inbound/direct[local-dns-in]: inbound packet connection from 127.0.0.1:49100
+0300 2025-10-14 23:04:34 INFO [1601716269 1ms] inbound/direct[local-dns-in]: inbound packet connection to 127.0.0.1:1053
+0300 2025-10-14 23:04:34 DEBUG [1601716269 1ms] router: match[0] => sniff
+0300 2025-10-14 23:04:34 DEBUG [1601716269 1ms] router: sniffed packet protocol: dns
+0300 2025-10-14 23:04:34 DEBUG [1601716269 1ms] router: match[1] protocol=dns => hijack-dns
+0300 2025-10-14 23:04:34 DEBUG [1601716269 1ms] dns: exchange ping.manjaro.org. IN AAAA
+0300 2025-10-14 23:04:34 INFO [1601716269 1ms] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:34 INFO [3080693603 1ms] inbound/direct[local-dns-in]: inbound packet connection from 127.0.0.1:43204
+0300 2025-10-14 23:04:34 INFO [3080693603 1ms] inbound/direct[local-dns-in]: inbound packet connection to 127.0.0.1:1053
+0300 2025-10-14 23:04:34 DEBUG [3080693603 1ms] router: match[0] => sniff
+0300 2025-10-14 23:04:34 DEBUG [3080693603 1ms] router: sniffed packet protocol: dns
+0300 2025-10-14 23:04:34 DEBUG [3080693603 1ms] router: match[1] protocol=dns => hijack-dns
+0300 2025-10-14 23:04:34 DEBUG [3080693603 1ms] dns: exchange ping.manjaro.org. IN A
+0300 2025-10-14 23:04:34 INFO [3080693603 1ms] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:34 DEBUG [1601716269 1ms] dns: exchange ping.manjaro.org. IN AAAA
+0300 2025-10-14 23:04:34 DEBUG [1601716269 1ms] dns: exchange ping.manjaro.org. IN AAAA
+0300 2025-10-14 23:04:34 DEBUG [1601716269 1ms] dns: exchange ping.manjaro.org. IN AAAA
+0300 2025-10-14 23:04:34 DEBUG [3080693603 1ms] dns: exchange ping.manjaro.org. IN A
+0300 2025-10-14 23:04:34 DEBUG [3080693603 1ms] dns: exchange ping.manjaro.org. IN A
+0300 2025-10-14 23:04:34 DEBUG [3080693603 1ms] dns: exchange ping.manjaro.org. IN A
+0300 2025-10-14 23:04:34 INFO sing-box started (0.44s)
+0300 2025-10-14 23:04:34 DEBUG [3080693603 23ms] dns: exchange ping.manjaro.org. IN A
+0300 2025-10-14 23:04:34 DEBUG [3080693603 23ms] dns: exchange ping.manjaro.org. IN A
+0300 2025-10-14 23:04:34 DEBUG [1601716269 24ms] dns: exchange ping.manjaro.org. IN AAAA
+0300 2025-10-14 23:04:34 DEBUG [1601716269 24ms] dns: exchange ping.manjaro.org. IN AAAA
+0300 2025-10-14 23:04:35 INFO [3333122753 0ms] inbound/direct[local-dns-in]: inbound packet connection from 127.0.0.1:56103
+0300 2025-10-14 23:04:35 INFO [3333122753 0ms] inbound/direct[local-dns-in]: inbound packet connection to 127.0.0.1:1053
+0300 2025-10-14 23:04:35 DEBUG [3333122753 0ms] router: match[0] => sniff
+0300 2025-10-14 23:04:35 DEBUG [3333122753 0ms] router: sniffed packet protocol: dns
+0300 2025-10-14 23:04:35 DEBUG [3333122753 0ms] router: match[1] protocol=dns => hijack-dns
+0300 2025-10-14 23:04:35 DEBUG [3333122753 0ms] dns: exchange example.org. IN A
+0300 2025-10-14 23:04:35 INFO [3333122753 0ms] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:35 INFO [12797202 0ms] inbound/direct[local-dns-in]: inbound packet connection from 127.0.0.1:41479
+0300 2025-10-14 23:04:35 INFO [12797202 0ms] inbound/direct[local-dns-in]: inbound packet connection to 127.0.0.1:1053
+0300 2025-10-14 23:04:35 DEBUG [12797202 0ms] router: match[0] => sniff
+0300 2025-10-14 23:04:35 DEBUG [12797202 0ms] router: sniffed packet protocol: dns
+0300 2025-10-14 23:04:35 DEBUG [12797202 0ms] router: match[1] protocol=dns => hijack-dns
+0300 2025-10-14 23:04:35 DEBUG [12797202 0ms] dns: exchange detectportal.firefox.com. IN A
+0300 2025-10-14 23:04:35 INFO [12797202 0ms] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:35 INFO [1495406153 0ms] inbound/direct[local-dns-in]: inbound packet connection from 127.0.0.1:42684
+0300 2025-10-14 23:04:35 INFO [1495406153 0ms] inbound/direct[local-dns-in]: inbound packet connection to 127.0.0.1:1053
+0300 2025-10-14 23:04:35 DEBUG [1495406153 0ms] router: match[0] => sniff
+0300 2025-10-14 23:04:35 DEBUG [1495406153 0ms] router: sniffed packet protocol: dns
+0300 2025-10-14 23:04:35 INFO [815946798 0ms] inbound/direct[local-dns-in]: inbound packet connection from 127.0.0.1:35722
+0300 2025-10-14 23:04:35 INFO [815946798 0ms] inbound/direct[local-dns-in]: inbound packet connection to 127.0.0.1:1053
+0300 2025-10-14 23:04:35 DEBUG [815946798 0ms] router: match[0] => sniff
+0300 2025-10-14 23:04:35 DEBUG [815946798 0ms] router: sniffed packet protocol: dns
+0300 2025-10-14 23:04:35 DEBUG [815946798 0ms] router: match[1] protocol=dns => hijack-dns
+0300 2025-10-14 23:04:35 DEBUG [815946798 0ms] dns: exchange detectportal.firefox.com. IN AAAA
+0300 2025-10-14 23:04:35 INFO [815946798 0ms] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:35 DEBUG [1495406153 1ms] router: match[1] protocol=dns => hijack-dns
+0300 2025-10-14 23:04:35 DEBUG [1495406153 1ms] dns: exchange example.org. IN AAAA
+0300 2025-10-14 23:04:35 INFO [1495406153 1ms] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:35 INFO [4117825500 0ms] inbound/direct[local-dns-in]: inbound packet connection from 127.0.0.1:53665
+0300 2025-10-14 23:04:35 INFO [4117825500 0ms] inbound/direct[local-dns-in]: inbound packet connection to 127.0.0.1:1053
+0300 2025-10-14 23:04:35 DEBUG [4117825500 0ms] router: match[0] => sniff
+0300 2025-10-14 23:04:35 DEBUG [4117825500 0ms] router: sniffed packet protocol: dns
+0300 2025-10-14 23:04:35 DEBUG [4117825500 0ms] router: match[1] protocol=dns => hijack-dns
+0300 2025-10-14 23:04:35 INFO [520433613 0ms] inbound/direct[local-dns-in]: inbound packet connection from 127.0.0.1:44792
+0300 2025-10-14 23:04:35 DEBUG [4117825500 0ms] dns: exchange ping.manjaro.org. IN AAAA
+0300 2025-10-14 23:04:35 INFO [520433613 0ms] inbound/direct[local-dns-in]: inbound packet connection to 127.0.0.1:1053
+0300 2025-10-14 23:04:35 DEBUG [520433613 0ms] router: match[0] => sniff
+0300 2025-10-14 23:04:35 DEBUG [520433613 0ms] router: sniffed packet protocol: dns
+0300 2025-10-14 23:04:35 DEBUG [520433613 0ms] router: match[1] protocol=dns => hijack-dns
+0300 2025-10-14 23:04:35 DEBUG [520433613 0ms] dns: exchange ping.manjaro.org. IN A
+0300 2025-10-14 23:04:37 DEBUG [4117825500 1.99s] dns: exchange ping.manjaro.org. IN AAAA
+0300 2025-10-14 23:04:37 DEBUG [520433613 1.99s] dns: exchange ping.manjaro.org. IN A
+0300 2025-10-14 23:04:37 DEBUG [520433613 1.99s] dns: exchange ping.manjaro.org. IN A
+0300 2025-10-14 23:04:37 DEBUG [4117825500 1.99s] dns: exchange ping.manjaro.org. IN AAAA
+0300 2025-10-14 23:04:38 INFO [2536787664 0ms] inbound/direct[local-dns-in]: inbound packet connection from 127.0.0.1:38553
+0300 2025-10-14 23:04:38 INFO [2536787664 0ms] inbound/direct[local-dns-in]: inbound packet connection to 127.0.0.1:1053
+0300 2025-10-14 23:04:38 DEBUG [2536787664 0ms] router: match[0] => sniff
+0300 2025-10-14 23:04:38 INFO [923962375 0ms] inbound/direct[local-dns-in]: inbound packet connection from 127.0.0.1:59798
+0300 2025-10-14 23:04:38 DEBUG [2536787664 0ms] router: sniffed packet protocol: dns
+0300 2025-10-14 23:04:38 INFO [923962375 0ms] inbound/direct[local-dns-in]: inbound packet connection to 127.0.0.1:1053
+0300 2025-10-14 23:04:38 DEBUG [2536787664 0ms] router: match[1] protocol=dns => hijack-dns
+0300 2025-10-14 23:04:38 DEBUG [923962375 0ms] router: match[0] => sniff
+0300 2025-10-14 23:04:38 DEBUG [2536787664 0ms] dns: exchange ident.me. IN AAAA
+0300 2025-10-14 23:04:38 INFO [2536787664 0ms] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:38 DEBUG [923962375 0ms] router: sniffed packet protocol: dns
+0300 2025-10-14 23:04:38 DEBUG [923962375 0ms] router: match[1] protocol=dns => hijack-dns
+0300 2025-10-14 23:04:38 DEBUG [923962375 0ms] dns: exchange ident.me. IN A
+0300 2025-10-14 23:04:38 INFO [923962375 0ms] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:39 INFO [2760901255 0ms] inbound/direct[local-dns-in]: inbound packet connection from 127.0.0.1:47445
+0300 2025-10-14 23:04:39 INFO [2760901255 0ms] inbound/direct[local-dns-in]: inbound packet connection to 127.0.0.1:1053
+0300 2025-10-14 23:04:39 DEBUG [2760901255 0ms] router: match[0] => sniff
+0300 2025-10-14 23:04:39 DEBUG [2760901255 0ms] router: sniffed packet protocol: dns
+0300 2025-10-14 23:04:39 DEBUG [2760901255 0ms] router: match[1] protocol=dns => hijack-dns
+0300 2025-10-14 23:04:39 DEBUG [2760901255 0ms] dns: exchange cdn.ghostery.com. IN A
+0300 2025-10-14 23:04:39 INFO [2760901255 0ms] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:39 INFO [4273785745 0ms] inbound/direct[local-dns-in]: inbound packet connection from 127.0.0.1:46491
+0300 2025-10-14 23:04:39 INFO [4273785745 0ms] inbound/direct[local-dns-in]: inbound packet connection to 127.0.0.1:1053
+0300 2025-10-14 23:04:39 DEBUG [4273785745 0ms] router: match[0] => sniff
+0300 2025-10-14 23:04:39 INFO [100347221 0ms] inbound/direct[local-dns-in]: inbound packet connection from 127.0.0.1:58481
+0300 2025-10-14 23:04:39 INFO [100347221 0ms] inbound/direct[local-dns-in]: inbound packet connection to 127.0.0.1:1053
+0300 2025-10-14 23:04:39 DEBUG [100347221 0ms] router: match[0] => sniff
+0300 2025-10-14 23:04:39 DEBUG [4273785745 0ms] router: sniffed packet protocol: dns
+0300 2025-10-14 23:04:39 DEBUG [4273785745 0ms] router: match[1] protocol=dns => hijack-dns
+0300 2025-10-14 23:04:39 DEBUG [4273785745 0ms] dns: exchange www.youtube.com. IN AAAA
+0300 2025-10-14 23:04:39 DEBUG [100347221 0ms] router: sniffed packet protocol: dns
+0300 2025-10-14 23:04:39 DEBUG [100347221 0ms] router: match[1] protocol=dns => hijack-dns
+0300 2025-10-14 23:04:39 DEBUG [100347221 0ms] dns: exchange www.youtube.com. IN A
+0300 2025-10-14 23:04:39 INFO [100347221 0ms] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:39 DEBUG [520433613 3.97s] dns: exchange ping.manjaro.org. IN A
+0300 2025-10-14 23:04:39 DEBUG [4117825500 3.98s] dns: exchange ping.manjaro.org. IN AAAA
+0300 2025-10-14 23:04:39 DEBUG [520433613 3.98s] dns: exchange ping.manjaro.org. IN A
+0300 2025-10-14 23:04:39 DEBUG [4117825500 3.98s] dns: exchange ping.manjaro.org. IN AAAA
+0300 2025-10-14 23:04:39 DEBUG [4117825500 3.98s] dns: exchange ping.manjaro.org. IN AAAA
+0300 2025-10-14 23:04:39 DEBUG [520433613 3.98s] dns: exchange ping.manjaro.org. IN A
+0300 2025-10-14 23:04:39 DEBUG [4117825500 3.98s] dns: exchange ping.manjaro.org. IN AAAA
+0300 2025-10-14 23:04:39 DEBUG [520433613 3.98s] dns: exchange ping.manjaro.org. IN A
+0300 2025-10-14 23:04:39 DEBUG [520433613 4.0s] dns: exchange ping.manjaro.org. IN A
+0300 2025-10-14 23:04:39 DEBUG [4117825500 4.0s] dns: exchange ping.manjaro.org. IN AAAA
+0300 2025-10-14 23:04:39 DEBUG [4117825500 4.0s] dns: exchange ping.manjaro.org. IN AAAA
+0300 2025-10-14 23:04:39 DEBUG [520433613 4.0s] dns: exchange ping.manjaro.org. IN A
+0300 2025-10-14 23:04:40 DEBUG [3333122753 5.0s] dns: exchange example.org. IN A
+0300 2025-10-14 23:04:40 DEBUG [12797202 5.0s] dns: exchange detectportal.firefox.com. IN A
+0300 2025-10-14 23:04:40 DEBUG [1495406153 5.0s] dns: exchange example.org. IN AAAA
+0300 2025-10-14 23:04:40 DEBUG [3333122753 5.0s] dns: exchange example.org. IN A
+0300 2025-10-14 23:04:40 DEBUG [815946798 5.0s] dns: exchange detectportal.firefox.com. IN AAAA
+0300 2025-10-14 23:04:40 DEBUG [12797202 5.0s] dns: exchange detectportal.firefox.com. IN A
+0300 2025-10-14 23:04:40 DEBUG [12797202 5.0s] dns: exchange detectportal.firefox.com. IN A
+0300 2025-10-14 23:04:40 DEBUG [520433613 5.0s] dns: exchange ping.manjaro.org. IN A
+0300 2025-10-14 23:04:40 DEBUG [520433613 5.0s] dns: exchange ping.manjaro.org. IN A
+0300 2025-10-14 23:04:40 DEBUG [4117825500 5.0s] dns: exchange ping.manjaro.org. IN AAAA
+0300 2025-10-14 23:04:40 DEBUG [4117825500 5.0s] dns: exchange ping.manjaro.org. IN AAAA
+0300 2025-10-14 23:04:41 DEBUG [4117825500 6.0s] dns: exchange ping.manjaro.org. IN AAAA
+0300 2025-10-14 23:04:41 DEBUG [520433613 6.0s] dns: exchange ping.manjaro.org. IN A
+0300 2025-10-14 23:04:41 DEBUG [520433613 6.0s] dns: exchange ping.manjaro.org. IN A
+0300 2025-10-14 23:04:41 DEBUG [4117825500 6.0s] dns: exchange ping.manjaro.org. IN AAAA
+0300 2025-10-14 23:04:42 DEBUG [520433613 7.0s] dns: exchange ping.manjaro.org. IN A
+0300 2025-10-14 23:04:42 DEBUG [520433613 7.0s] dns: exchange ping.manjaro.org. IN A
+0300 2025-10-14 23:04:42 DEBUG [4117825500 7.0s] dns: exchange ping.manjaro.org. IN AAAA
+0300 2025-10-14 23:04:42 DEBUG [4117825500 7.0s] dns: exchange ping.manjaro.org. IN AAAA
+0300 2025-10-14 23:04:43 DEBUG [2536787664 5.0s] dns: exchange ident.me. IN AAAA
+0300 2025-10-14 23:04:43 DEBUG [923962375 5.0s] dns: exchange ident.me. IN A
+0300 2025-10-14 23:04:44 DEBUG [2760901255 5.0s] dns: exchange cdn.ghostery.com. IN A
+0300 2025-10-14 23:04:44 DEBUG [4273785745 5.0s] dns: exchange www.youtube.com. IN AAAA
+0300 2025-10-14 23:04:44 DEBUG [100347221 5.0s] dns: exchange www.youtube.com. IN A
+0300 2025-10-14 23:04:44 ERROR [764901384 10.0s] dns: exchange failed for www.youtube.com. IN AAAA: context deadline exceeded
+0300 2025-10-14 23:04:44 INFO [4273785745 5.45s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:44 INFO [4273785745 5.45s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:44 ERROR [1601716269 10.0s] dns: exchange failed for ping.manjaro.org. IN AAAA: context deadline exceeded
+0300 2025-10-14 23:04:44 INFO [3080693603 10.0s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:44 INFO [1601716269 10.0s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:44 ERROR [3080693603 10.0s] dns: exchange failed for ping.manjaro.org. IN A: context deadline exceeded
+0300 2025-10-14 23:04:44 INFO [520433613 8.97s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:44 INFO [4117825500 8.97s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:44 INFO [520433613 8.97s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:44 INFO [520433613 8.97s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:44 INFO [4117825500 8.97s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:44 INFO [520433613 8.97s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:44 INFO [520433613 8.97s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:44 INFO [4117825500 8.97s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:44 INFO [520433613 8.97s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:44 INFO [520433613 8.97s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:44 INFO [4117825500 8.97s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:44 INFO [520433613 8.97s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:44 INFO [4117825500 8.97s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:44 INFO [520433613 8.97s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:44 INFO [520433613 8.97s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:44 INFO [1601716269 10.0s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:44 INFO [520433613 8.97s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:44 INFO [3080693603 10.0s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:44 INFO [1601716269 10.0s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:44 INFO [520433613 8.97s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:44 INFO [3080693603 10.0s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:44 INFO [1601716269 10.0s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:44 INFO [520433613 8.97s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:44 INFO [1601716269 10.0s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:44 INFO [3080693603 10.0s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:44 INFO [520433613 8.97s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:44 INFO [3080693603 10.0s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:44 INFO [520433613 8.97s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:44 INFO [4117825500 8.97s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:44 INFO [4117825500 8.97s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:44 INFO [4117825500 8.97s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:44 INFO [4117825500 8.97s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:44 INFO [4117825500 8.97s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:44 INFO [4117825500 8.97s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:44 INFO [4117825500 8.97s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:44 INFO [4117825500 8.97s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:44 INFO [4117825500 8.97s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:44 INFO [4117825500 8.97s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:45 ERROR [3333122753 10.0s] dns: exchange failed for example.org. IN A: context deadline exceeded
+0300 2025-10-14 23:04:45 INFO [3333122753 10.0s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:45 INFO [3333122753 10.0s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:45 ERROR [12797202 10.0s] dns: exchange failed for detectportal.firefox.com. IN A: context deadline exceeded
+0300 2025-10-14 23:04:45 INFO [12797202 10.0s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:45 INFO [12797202 10.0s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:45 INFO [12797202 10.0s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:45 ERROR [815946798 10.0s] dns: exchange failed for detectportal.firefox.com. IN AAAA: context deadline exceeded
+0300 2025-10-14 23:04:45 INFO [815946798 10.0s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:45 ERROR [1495406153 10.0s] dns: exchange failed for example.org. IN AAAA: context deadline exceeded
+0300 2025-10-14 23:04:45 INFO [1495406153 10.0s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:45 DEBUG [815946798 10.1s] dns: exchange detectportal.firefox.com. IN AAAA
+0300 2025-10-14 23:04:45 DEBUG [12797202 10.1s] dns: exchange detectportal.firefox.com. IN A
+0300 2025-10-14 23:04:45 INFO [815946798 10.1s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:45 INFO [12797202 10.1s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:46 DEBUG [520433613 11.0s] dns: exchange ping.manjaro.org. IN A
+0300 2025-10-14 23:04:46 DEBUG [4117825500 11.0s] dns: exchange ping.manjaro.org. IN AAAA
+0300 2025-10-14 23:04:46 INFO [520433613 11.0s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:46 INFO [4117825500 11.0s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:46 DEBUG [4117825500 11.0s] dns: exchange ping.manjaro.org. IN AAAA
+0300 2025-10-14 23:04:46 DEBUG [520433613 11.0s] dns: exchange ping.manjaro.org. IN A
+0300 2025-10-14 23:04:48 ERROR [2536787664 10.0s] dns: exchange failed for ident.me. IN AAAA: context deadline exceeded
+0300 2025-10-14 23:04:48 ERROR [923962375 10.0s] dns: exchange failed for ident.me. IN A: context deadline exceeded
+0300 2025-10-14 23:04:48 INFO [2536787664 10.0s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:48 INFO [923962375 10.0s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:49 ERROR [2760901255 10.0s] dns: exchange failed for cdn.ghostery.com. IN A: context deadline exceeded
+0300 2025-10-14 23:04:49 INFO [2760901255 10.0s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:49 ERROR [100347221 10.0s] dns: exchange failed for www.youtube.com. IN A: context deadline exceeded
+0300 2025-10-14 23:04:49 INFO [100347221 10.0s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:49 DEBUG [100347221 10.1s] dns: exchange www.youtube.com. IN A
+0300 2025-10-14 23:04:49 INFO [100347221 10.1s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:49 DEBUG [4273785745 10.1s] dns: exchange www.youtube.com. IN AAAA
+0300 2025-10-14 23:04:49 INFO [4273785745 10.1s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:49 DEBUG [2536787664 11.2s] dns: exchange ident.me. IN AAAA
+0300 2025-10-14 23:04:49 INFO [2536787664 11.2s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:49 DEBUG [923962375 11.2s] dns: exchange ident.me. IN A
+0300 2025-10-14 23:04:49 INFO [923962375 11.2s] outbound/vless[proxy]: outbound connection to 1.1.1.1:853
+0300 2025-10-14 23:04:49 ERROR [4117825500 13.97s] dns: exchange failed for ping.manjaro.org. IN AAAA: dial tcp 85.192.63.245:443: i/o timeout
+0300 2025-10-14 23:04:49 ERROR [4117825500 13.97s] dns: exchange failed for ping.manjaro.org. IN AAAA: dial tcp 85.192.63.245:443: i/o timeout
+0300 2025-10-14 23:04:49 DEBUG [520433613 13.99s] dns: exchange ping.manjaro.org. IN A
+0300 2025-10-14 23:04:49 DEBUG [4117825500 13.99s] dns: exchange ping.manjaro.org. IN AAAA
+0300 2025-10-14 23:04:49 DEBUG [4117825500 13.99s] dns: exchange ping.manjaro.org. IN AAAA
+0300 2025-10-14 23:04:49 DEBUG [520433613 13.99s] dns: exchange ping.manjaro.org. IN A
+0300 2025-10-14 23:04:50 ERROR [12797202 15.0s] dns: exchange failed for detectportal.firefox.com. IN A: dial tcp 85.192.63.245:443: i/o timeout
+0300 2025-10-14 23:04:50 ERROR [12797202 15.0s] dns: exchange failed for detectportal.firefox.com. IN A: dial tcp 85.192.63.245:443: i/o timeout
+0300 2025-10-14 23:04:50 ERROR [815946798 15.0s] dns: exchange failed for detectportal.firefox.com. IN AAAA: dial tcp 85.192.63.245:443: i/o timeout
+0300 2025-10-14 23:04:50 DEBUG [815946798 15.1s] dns: exchange detectportal.firefox.com. IN AAAA
+0300 2025-10-14 23:04:50 DEBUG [12797202 15.1s] dns: exchange detectportal.firefox.com. IN A
+0300 2025-10-14 23:04:54 DEBUG [100347221 15.1s] dns: exchange www.youtube.com. IN A
+0300 2025-10-14 23:04:54 DEBUG [4273785745 15.1s] dns: exchange www.youtube.com. IN AAAA
+0300 2025-10-14 23:04:54 DEBUG [2536787664 16.2s] dns: exchange ident.me. IN AAAA
+0300 2025-10-14 23:04:54 DEBUG [923962375 16.2s] dns: exchange ident.me. IN A

Thought

Examining outbound connection issue

The route documentation suggests that having "auto_detect_interface" enabled should prevent connection loops. It's already on, but we're still seeing timeouts in the logs. The issue might not be a loop, but something else affecting the handshake. Perhaps setting "outbound.bind_interface" for the proxy could help by forcing it onto a specific NIC.

Investigating connection timeout

The issue seems to be that the VLESS session isn't being established. After 10 seconds, the connect to 85.192.63.245:443 times out. The messages about 1.1.1.1:853 are just intended connections before the actual server connection. The timeout likely occurs because the TUN route is affecting it. Let's check the routing path with ip route get.

Requesting user action

I can guide the user to run the command ip route get 85.192.63.245 and share the result, but I won't clarify further unless needed. I can suggest setting "bind_interface": "enp2s0" in the outbound configuration to ensure the connection uses the correct NIC, which should help resolve the issue.

Configuring outbound settings

The correct configuration for sing-box should set "bind_interface": "enp2s0" within the outbound fields for the VLESS connection. We don’t need to use the "detour" option. Alternatively, setting "server_addresses" can avoid domain resolution. Ensure that "tun.strict_route": true is applied to prevent unsupported routes.

Tracing the fix for failed connection

The issue is that DNS context fails during VLESS connection setup, causing timeouts. To fix this, we need to set an OS static route to bypass TUN and adjust sing

Thought for 1m 59s

Answer

Спасибо за подробные логи — они очень показательные.

Что именно сейчас ломается

  1. Каждая DNS-заявка уходит как outbound/vless[proxy] … → 1.1.1.1:853, а потом падает context deadline exceeded.
  2. Чуть позже видно первопричину: dial tcp 85.192.63.245:443: i/o timeout.

То есть клиенту sing-box периодически не удаётся установить TCP к твоему VLESS-серверу. Все «context deadline exceeded» по DNS — это лишь следствие: пока не поднят VLESS-канал, DoT/DoH через прокси не поедет.

С учётом TUN (auto_route:true, strict_route:true) это почти всегда означает маршрутную петлю: попытка соединиться с самим сервером случайно уходит в TUN/прокси и застревает. Чтобы исключить это на 100%, нужно принудительно послать трафик к серверу в обход TUN, строго через физический интерфейс.


Исправление (надёжно против петель)

1) Жёсткий маршрут ОС до сервера

Зададим статический маршрут к 85.192.63.245 через твой реальный шлюз/интерфейс (замени enp2s0 и 192.168.0.1 на свои значения, если отличаются):

bash
# посмотреть текущий дефолтный шлюз ip route | awk '/default/ {print "GW="$3,"IF="$5; exit}' # установить фиксированный маршрут до сервера sudo ip route replace 85.192.63.245/32 via 192.168.0.1 dev enp2s0 metric 5 # проверить, что путь реально идёт НЕ через singtun0 ip route get 85.192.63.245

Сделай маршрут постоянным (через NetworkManager connection / systemd-networkd — как тебе удобно).

2) Принудительно привяжем «прокси-аутбаунд» к реальному интерфейсу

В outbounds для твоего vless добавь dial-поля (они как раз для этого и существуют):

json
{ "type": "vless", "tag": "proxy", "server": "85.192.63.245", "server_port": 443, "uuid": "…", "flow": "xtls-rprx-vision", "bind_interface": "enp2s0", // <- главная строчка "inet4_bind_address": "192.168.0.85", // (опционально) IP твоего enp2s0 "tls": { "enabled": true, "server_name": "github.com", "utls": { "enabled": true, "fingerprint": "chrome" }, "reality": { "enabled": true, "public_key": "…", "short_id": "…" } } }

bind_interface относится к Dial Fields и заставляет sing-box открывать сокет к серверу строго через указанный NIC, что обрубает петли под TUN. Документация: Dial Fields → bind_interface/detour/… (sing-box.sagernet.org)

У тебя уже включено route.auto_detect_interface:true, что «в общем случае» тоже должно предотвращать петли, но в TUN-сценариях это иногда не срабатывает. Прямой bind_interface надёжнее. Описание auto_detect_interface: «Привязывать исходящие соединения к дефолтному NIC, чтобы предотвратить петли под tun». (sing-box.sagernet.org)

3) Оставь байпас в TUN-inbound и в правилах

Ты уже добавлял исключение, но на всякий случай проверь, что оба есть и стоят выше общих правил:

  • в inbounds.tun.route_exclude_address: "85.192.63.245/32";
  • в route.rules:
    json
    { "ip_cidr": ["85.192.63.245/32"], "outbound": "direct" }

NB: route_exclude_address — это про настройку ОС-маршрутов под TUN и работает не всегда идеально, поэтому мы дополнительно делаем OS-маршрут (п.1) и bind_interface (п.2). Это вместе закрывает тему даже при «капризном» TUN. Есть открытые тикеты про нестабильное поведение exclude-полей. (GitHub)

4) Временно переведи DNS «в обход» прокси для проверки

Пока чиним доступ к серверу, можно на 2–3 минуты поставить:

json
"dns": { "final": "dns_direct" }

и вернуть обратно на dns_proxy, как только VLESS-канал оживёт.

5) Приведи DNS к новому формату (чтобы ушли WARN)

Пример без доменных имён (никаких лишних резолвов «до того как»), плюс default_domain_resolver:

json
"dns": { "servers": [ { "tag": "dns_proxy", "address": "tls://1.1.1.1:853", "strategy": "prefer_ipv4", "detour": "proxy" }, { "tag": "dns_direct", "address": "tls://1.0.0.1:853", "strategy": "prefer_ipv4", "detour": "direct" } ], "final": "dns_proxy" }, "route": { "default_domain_resolver": "dns_direct", }

В 1.12+ старый DNS-формат и «legacy outbound DNS rules» депрекированы; переход на address: + domain_resolver — рекомендованный путь. (New Releases)
(Если используешь DoH по имени, у нового HTTPS-DNS серверa резолв самого хоста задаётся через Dial Fields domain_resolver, а не через устаревший address_resolver.) (sing-box.sagernet.org)


Проверка после правок

bash
sing-box check -c /путь/к/config.json sudo systemctl restart sing-box # Маршрут до сервера должен быть не через tun: ip route get 85.192.63.245 # DNS-тест через цепочку: dig @127.0.0.1 example.org +time=2 +tries=1 # И уже data-plane: curl -v https://ident.me/ --max-time 5

Если после пунктов 1–2 ещё будет i/o timeout к 85.192.63.245:443, кинь одной строкой вывод:

ip route get 85.192.63.245

— и 10–15 свежих строк sing-box (debug) вокруг одного запроса. Тогда точечно посмотрим, что ещё цепляет маршрут.


Про смену порта с 443

Смысл есть, если именно твой провайдер душит исходящие к твоему серверу на 443. Тогда:

  • добавь на сервере второй inbound/порт (напр., 2096 или 8443) или сделай DNAT 2096→443;
  • в клиенте поменяй server_port.

Но текущий лог указывает прежде всего на петлю/маршрут на клиенте, а не на блокировку 443. Поэтому сначала зафиксируй путь к серверу (пп. 1–2).

Question

Я не стал фиксировать путь, это не то что мне нужно. мне нужно что бы всё шло через sing tun интерфейс,

Вот что у меня есть на сервере (вывод sudo tcpdump port 443 -A -s 0)

23:22:27.341102 IP Bifrst.ptr.network.https > 91.205.160.191.57966: Flags [F.], seq 0, ack 1, win 249, options [nop,nop,TS val 476057539 ecr 1463236949], length 0
E..4.]@.@..%U.?.[......n..l..=.......h.....
...W79U 23:22:27.341121 IP Bifrst.ptr.network.https > 91.205.160.191.57980: Flags [F.], seq 0, ack 1, win 249, options [nop,nop,TS val 476057539 ecr 1463236965], length 0 E..4.X@.@..)U.?.[......|..ua.h.-.....h..... ...W79e
23:22:27.341126 IP Bifrst.ptr.network.https > 91.205.160.191.58018: Flags [F.], seq 0, ack 1, win 249, options [nop,nop,TS val 476057539 ecr 1463237030], length 0
E..4c.@[email protected].?.[.......O....W.......h.....
...W79. 23:22:27.405137 IP Bifrst.ptr.network.https > 91.205.160.191.53852: Flags [F.], seq 730677946, ack 2809293376, win 249, options [nop,nop,TS val 476057603 ecr 1463221506], length 0 E..4#.@[email protected].?.[......\[email protected]..... ...W6..
23:22:27.405171 IP Bifrst.ptr.network.https > 91.205.160.191.53866: Flags [F.], seq 2425953146, ack 1307233801, win 249, options [nop,nop,TS val 476057603 ecr 1463221874], length 0
E..4.<@[email protected].?.[......j...zM.. .....h.....
...W6.r 23:22:27.405194 IP Bifrst.ptr.network.https > 91.205.160.191.57992: Flags [F.], seq 0, ack 1, win 249, options [nop,nop,TS val 476057603 ecr 1463236974], length 0 E..4Pe@[email protected].?.[....... ..q.........h..... ...W79n
23:22:27.499016 IP lb-140-82-121-4-fra.github.com.https > Bifrst.ptr.network.35272: Flags [S.], seq 4149652978, ack 2808847292, win 65535, options [mss 1320,sackOK,TS val 2441673138 ecr 3734715942,nop,wscale 10], length 0
E..<[email protected].?......V...k.......z.....(...
......>&...

23:22:27.499061 IP Bifrst.ptr.network.35272 > lb-140-82-121-4-fra.github.com.https: Flags [.], ack 1, win 251, options [nop,nop,TS val 3734716990 ecr 2441672114], length 0
E..4..@[email protected].?..Ry......k...V.......2.....
..B>....
23:22:27.917115 IP Bifrst.ptr.network.https > 91.205.160.191.53894: Flags [F.], seq 97302824, ack 3040489310, win 249, options [nop,nop,TS val 476058115 ecr 1463221901], length 0
E..4.Y@.@..(U.?.[..........(.:/^.....h.....
...W6.. 23:22:27.917141 IP Bifrst.ptr.network.https > 91.205.160.191.53890: Flags [F.], seq 3984766975, ack 3793103971, win 249, options [nop,nop,TS val 476058115 ecr 1463221893], length 0 E..4].@[email protected].?.[.............,c.....h..... ...W6..
23:22:27.917160 IP Bifrst.ptr.network.https > 91.205.160.191.53906: Flags [F.], seq 3168358960, ack 2843608541, win 249, options [nop,nop,TS val 476058115 ecr 1463221955], length 0
E..4z.@[email protected].?.[.........R0.~.......h.....
...W6.. 23:22:28.301119 IP Bifrst.ptr.network.https > 91.205.160.191.57998: Flags [F.], seq 0, ack 1, win 249, options [nop,nop,TS val 476058499 ecr 1463237971], length 0 E..4..@[email protected].?.[.......7............h..... ...W7=S
23:22:28.301143 IP Bifrst.ptr.network.https > 91.205.160.191.57946: Flags [F.], seq 0, ack 1, win 249, options [nop,nop,TS val 476058499 ecr 1463235752], length 0
E..4}.@.@.*.U.?.[......Z5Yd..#].....h..... ...W74.
23:22:28.365099 IP Bifrst.ptr.network.https > 91.205.160.191.58008: Flags [F.], seq 0, ack 1, win 249, options [nop,nop,TS val 476058563 ecr 1463238026], length 0
E..4..@[email protected].?.[.............O-.....h.....
...W7=. 23:22:28.429101 IP Bifrst.ptr.network.https > 91.205.160.191.53874: Flags [F.], seq 1171106508, ack 3869719853, win 249, options [nop,nop,TS val 476058627 ecr 1463221893], length 0 E..4r.@[email protected].?.[......rE.....=-.....h..... ...W6..
23:22:28.429143 IP Bifrst.ptr.network.https > 91.205.160.191.53868: Flags [F.], seq 3795724568, ack 648340432, win 249, options [nop,nop,TS val 476058627 ecr 1463221893], length 0
E..4..@[email protected].?.[......l.>).&........h.....
...W6.. 23:22:28.429154 IP Bifrst.ptr.network.https > 91.205.160.191.52974: Flags [F.], seq 1532404752, ack 3985151383, win 249, options [nop,nop,TS val 476058627 ecr 1463203869], length 0 E..4.6@[email protected].?.[.......[V...........h..... ...W6..
23:22:28.429160 IP Bifrst.ptr.network.https > 91.205.160.191.52968: Flags [F.], seq 4145253330, ack 4161053513, win 249, options [nop,nop,TS val 476058627 ecr 1463203868], length 0
E..4..@[email protected].?.[..............I.....h.....
...W6.. 23:22:28.941101 IP Bifrst.ptr.network.https > 91.205.160.191.52980: Flags [F.], seq 2690326773, ack 1603981513, win 249, options [nop,nop,TS val 476059139 ecr 1463205608], length 0 E..4..@[email protected].?.[........[ ._........h..... ...W6..
23:22:29.261106 IP Bifrst.ptr.network.https > 91.205.160.191.57960: Flags [F.], seq 0, ack 1, win 249, options [nop,nop,TS val 476059459 ecr 1463236585], length 0
E..4..@.@.$.U.?.[......h".)...y.....h..... ..CW77.
^C
173 packets captured
177 packets received by filter
0 packets dropped by kernel

Thought

Considering server connections

It looks like the server may be attempting to mimic a TLS handshake, but doesn't actually connect to GitHub directly. Instead, traffic from GitHub could indicate that the server is performing a health check or testing something, possibly on port 35272. The server also appears to be sending a FIN to a client's IP on other ephemeral ports. So, there might be more going on with server operations like testing or monitoring.

Examining server-client connection issue

It looks like the server accepted inbound connections (ACK response), but it's sending a FIN-ACK back, which might explain the client's "i/o timeout". Normally, this error happens when there's no response, but the immediate FIN could be causing the connection to close instead. The client's consistent outbound logs suggest it believed the proxy connection succeeded.

Considering connection routing

Looking at the sing-box logs, it seems the connection to the DNS server via proxy is only logged after the VLESS handshake succeeds. The context deadline might happen later, though. According to the user's request, all traffic should go through the singtun interface, so using an OS-route won't work. I need to find a solution that routes everything through tun without causing a loop.

Handling sing-box tunneling

The sing-box creates a TUN device, and if auto_route and strict_route are enabled, it'll route everything via TUN, with exceptions. A connection from the sing-box process might bypass the TUN interface through SO_MARK or bind. But the user wants everything to go through singtun, which complicates the logic since server connections need to use the real NIC.

Explaining singtun routing setup

The user seems to want all traffic through singtun, but with the proxy connection handled directly. This requires adjustments, like using "bind_interface" for the direct connection while still ensuring the rest of the traffic routes through singtun. Additionally, I should suggest specific configurations for the server-side Reality setup to prevent mismatches and connection issues. I'll need to offer configuration checks and logs to diagnose handshake failures further.

Finalizing solution for singtun setup

To meet the user's needs, I'll guide them to keep all traffic through the TUN interface while allowing the initial server connection to go direct. Configurations will include route rules, DNS through direct, and using bind_interface for the outbound. I'll clarify likely causes for VLESS handshake errors and provide step-by-step checks for mismatches. The user's server settings should prioritize consistency, ensuring the "flow" and "short_id" match correctly. I'll summarize the DNS setup and offer port adjustment steps if needed.

Thought for 1m 20s

Answer

Окей, вижу, почему всё «висит», и при этом ты прав — фиксить системный маршрут не обязательно. Можно оставить «всё через TUN» для приложений, но само подключение клиента к серверу (единственный «бутстрап»-трафик) должно выходить напрямую через физический интерфейс из процесса sing-box, иначе получается петля.

Сейчас по логам и по tcpdump на сервере:

  • Клиент постоянно пытается установить VLESS-сессию и затем послать DNS через прокси (outbound … → 1.1.1.1:853), но сессия не встаёт → context deadline exceeded.
  • На сервере видно массовые FIN к твоему клиентскому IP: Xray принимает соединение на 443 и сразу закрывает его. Это классический признак несовпадения REALITY/Vision/UUID/SNI/shortId (или потока). В таком случае клиент не «таймаутится» прямо на TCP-SYN, а «подвисает» дальше, когда не может завершить рукопожатие и начать передавать DNS.

Ниже — план, который не ломает твою модель «всё через singtun», но гарантирует, что sing-box сможет сам выйти к серверу «в обход TUN», и параллельно устраняет причины мгновенных закрытий на сервере.


1) Избежать петли без правок системных маршрутов

Нам достаточно ограничиться настройками в самом sing-box.

(А) Привязать исходящее «proxy» к реальному интерфейсу

В твоём outbounds для VLESS добавь dial-поля:

json
{ "type": "vless", "tag": "proxy", "server": "85.192.63.245", "server_port": 443, "uuid": "…", "flow": "xtls-rprx-vision", "bind_interface": "enp2s0", "inet4_bind_address": "192.168.0.85", "tls": { "enabled": true, "server_name": "github.com", "utls": { "enabled": true, "fingerprint": "chrome" }, "reality": { "enabled": true, "public_key": "…", "short_id": "…" } } }

bind_interface заставит именно соединение к серверу идти через реальный NIC, не попадая в TUN. Всё остальное (трафик приложений) по-прежнему маршрутизируется TUN’ом.

(Б) Оставь два страховочных правила

Они действуют только на соединения, которые инициирует сам sing-box (а не приложения), так что «всё через TUN» не пострадает:

  • в inbounds.tun.route_exclude_address уже есть:
    "85.192.63.245/32"
    
  • и в route.rules (выше общих правил):
    json
    { "ip_cidr": ["85.192.63.245/32"], "outbound": "direct" }

Этого достаточно, без статических маршрутов ОС.


2) Починить REALITY/Vision на сервере (сейчас сервер сразу шлёт FIN)

Проверь inbound на сервере (Xray). Минимально корректный пример:

json
{ "inbounds": [ { "port": 443, "protocol": "vless", "settings": { "decryption": "none", "clients": [ { "id": "YOUR-UUID", "flow": "xtls-rprx-vision" } ] }, "streamSettings": { "network": "tcp", "security": "reality", "realitySettings": { "show": false, "dest": "github.com:443", "serverNames": ["github.com"], "privateKey": "SERVER-REALITY-PRIVKEY", "shortIds": ["SHORTID"] } }, "sniffing": { "enabled": true, "destOverride": ["http", "tls"] } } ] }

Проверь строго:

  • UUID на клиенте == clients[].id на сервере.
  • flow с двух сторон: "xtls-rprx-vision".
  • server_name (клиент) ∈ serverNames (сервер), напр. github.com.
  • public_key (клиент) соответствует privateKey (сервер). Если сомневаешься — сгенерируй пару заново:
    bash
    xray x25519 # privateKey -> в server.realitySettings.privateKey # publicKey -> в client.tls.reality.public_key
  • short_id (клиент) ∈ shortIds (сервер). Длина 8/16 (hex).

Если что-то из этого не совпадает, Xray принимает коннект и сразу закрывает (что ты видишь как FIN в tcpdump).

Полезно запустить на сервере в момент попытки коннекта:

bash
journalctl -u xray -n 200 -f

Обычно видно сообщения вида «short id not found / invalid user / reality handshake failed».


3) DNS — новый формат и «подстраховка»

Чтобы убрать WARN и исключить «курицу-яйцо», используй новый синтаксис и апстрим по IP:

json
"dns": { "servers": [ { "tag": "dns_proxy", "address": "tls://1.1.1.1:853", "strategy": "prefer_ipv4", "detour": "proxy" }, { "tag": "dns_direct", "address": "tls://1.0.0.1:853", "strategy": "prefer_ipv4", "detour": "direct" } ], "final": "dns_proxy" }, "route": { "default_domain_resolver": "dns_direct", ... }

Пока чинится пункт 2, можно временно:

"dns": { "final": "dns_direct" }

и вернуть dns_proxy, когда VLESS оживёт.


4) Проверки по шагам

  1. Перезапуск:
bash
sing-box check -c /путь/к/config.json sudo systemctl restart sing-box
  1. Убедись, что sing-box открывает TCP к серверу в обход TUN (за это отвечает bind_interface — дополнительной проверки маршрутов ОС не требуется).

  2. На сервере (параллельно) смотри логи:

bash
journalctl -u xray -n 50 -f

При удачном рукопожатии не будет мгновенных FIN после SYN — TCP-сессии станут «длинными».

  1. Когда VLESS встал, проверь:
bash
dig @127.0.0.1 example.org +time=2 +tries=1 curl -v https://ident.me/ --max-time 5

А что насчёт смены порта 443?

Можно, но это решает лишь случаи DPI/шэйпинга по 443 между клиентом и сервером. Твои текущие симптомы — именно закрытие на сервере (FIN), то есть проблема уровня конфигурации REALITY/Vision/UUID/SNI/shortId.
Если всё-таки хочешь добавить альтернативный порт (например, 2096):

  • На сервере добавь второй inbound с теми же параметрами на port: 2096 или DNAT 2096→443.
  • На клиенте поменяй server_port на 2096.
    (Правила из пунктов 1–3 остаются прежними.)

Итог

  • Петлю мы убираем внутри sing-box через bind_interface + точечные правила (без «фикса пути» в ОС).
  • Сервер сейчас отстреливает соединения (FIN) — синхронизируй REALITY/Vision/UUID/SNI/shortId/privateKey/publicKey по чек-листу выше. После этого DNS через прокси начнёт отвечать, и TUN-режим останется полностью рабочим для остального трафика.

Если после правок сервер всё ещё шлёт FIN, скинь 10–20 строк journalctl -u xray вокруг попытки — там будет точная причина (short id / user / reality handshake).

Share this Q&A