SagerNet / SagerNet/sing-box

Linux TUN vless outbound loop: traffic routed into TUN is re-captured → total network loss (strict_route anti-loop not effective)

Open
#4,407 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
38.1k
Forks
4.6k
Avg merge
19d 15h
Merged PRs (30d)
1

Description

On Linux desktop (sing-box 1.13.16), a TUN inbound (auto_route: true, strict_route: true/false both tried) creates the device, installs ip rules and the table-2022 default route correctly — but all traffic including the vless outbound's own connections gets re-captured by the TUN (loop), causing total network loss. Running sing-box as root does NOT help. The strict_route anti-loop mechanism (SO_MARK / nftables) does not appear to take effect.

Environment

  • OS: Linux desktop (GNOME + NetworkManager, WiFi) — also reproduced on root

  • sing-box: v1.13.16 (linux-amd64 glibc)

  • Config: mixed inbound (127.0.0.1:10808) + tun inbound:
    json
    {"type":"tun","tag":"tun-in","interface_name":"singtun0","mtu":9000,
    "address":["172.19.0.1/30"],"auto_route":true,"strict_route":true}

  • Outbound: vless (tls + ws), final route = vless; direct for geoip-cn/private ranges

  • dns: {"servers":[{"type":"udp","tag":"dns-direct","server":"119.29.29.29"}],"strategy":"ipv4_only"}

Reproduction

  1. Start sing-box with the above config. Observed state while running:
    • singtun0 created (172.19.0.1/30, UP) ✓

    • ip rules installed:

      9000: from all to 172.19.0.0/30 lookup 2022
      9001: from all lookup 2022 suppress_prefixlength 0
      9002: not from all dport 53 lookup main suppress_prefixlength 0
      9002: from all iif singtun0 goto 9010
      9003: not from all iif lo lookup 2022
      9010: from all nop

    • table 2022 has default via 172.19.0.2 dev singtun0 ✓

  2. Any traffic (curl/ping/DNS) → total loss (timeout). The vless outbound's connection to the remote server is itself captured by the TUN and loops back into the TUN → vless → TUN…
  3. Same result with strict_route: false; same result running as root (sudo).
  4. Workaround tried: mark singtun0 unmanaged in NetworkManager so routes stay stable (they do), but the loop persists — network is still dead.

Expected

Traffic entering the TUN should be routed per route rules (direct/vless). The vless outbound's own connections (to the remote server) must NOT be re-captured by the TUN — strict_route's SO_MARK/nftables exclusion should handle this, but it does not seem to be applied.

Related

  • #4367 UDP traffic to the exact TUN self-address can loop through the direct outbound
  • #4178 Possible IPv6 self-route loop
  • #3878 Regression in 1.13.2 on Linux TUN + hijack-dns: systemd-resolved DNS loops

This looks like the same loop family on Linux TUN — here it's full-traffic (TCP) loop even with strict_route, not limited to UDP/IPv6/DNS. Happy to provide more logs/config or run debug builds.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the supplied Linux TUN configuration and checking the observed ip rules, table 2022 route, and outbound connection behavior. Inspect the strict_route SO_MARK/nftables exclusion path and debug output; done means traffic follows the configured routes while the vless connection is not re-captured and curl, ping, and DNS work.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, linux
Domain
networking, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.