TUN vs. System Proxy: How Traffic Routing Works

Compare system proxy settings, which apps must choose to use, with TUN's network-level traffic capture, and learn when to use each.

Where traffic enters: local proxy ports and virtual interfaces

A system proxy changes the proxy settings apps can read; it does not change the system routing table. In Windows 11 24H2, check the address and port under Settings → Network & internet → Proxy → Manual proxy setup. Suppose Clash Verge Rev uses a mihomo configuration with mixed-port: 7890 and listens on the loopback address. Apps that read this setting can send supported HTTP or HTTPS requests to 127.0.0.1:7890. For HTTPS, an HTTP proxy typically first receives a CONNECT request containing the destination host and port. The app then establishes TLS with the destination site through the tunnel.

Command-line tools, background services, and some desktop apps may use their own networking libraries. They might ignore the system proxy entirely, or prefer environment variables or their own proxy settings. So if a browser works but another program doesn't, that alone doesn't point to a problem with your subscription or nodes. Manually pointing the program at the same local port is a different test from letting it read the system proxy settings.

TUN traffic enters through a Layer 3 virtual network interface. Apps connect as usual; the system checks its routes and sends IP packets matching a TUN route to the virtual interface, where mihomo handles them. Apps don't need to know about a local proxy port. “All traffic” capture means broader coverage, not that every packet on the device must pass through TUN: loopback connections, excluded subnets, IPv6 routes not covered by the setup, and traffic claimed first by another virtual interface may take a different path.

TCP, UDP, and DNS coverage

Traffic typeSystem proxyTUN
Browser HTTPSAfter reading the proxy settings, an app can establish a tunnel through an HTTP proxy.When the destination matches a TUN route, traffic reaches the core without relying on browser proxy settings.
Voice calls or QUIC over UDPA standard system HTTP proxy doesn't forward arbitrary UDP packets from apps to the core.A matching route can capture UDP, but proxy forwarding also requires UDP support from the selected node and outbound path.
DNS queriesAn app may send a hostname to the proxy or resolve it first. Other programs' queries aren't automatically redirected when you toggle the setting.Check whether the query reaches TUN and matches dns-hijack. Enabling TUN doesn't automatically capture every DNS query.

UDP reaching the core doesn't guarantee it can be forwarded through a proxy node

For example, a webpage loads but a voice call gets stuck connecting. The webpage may use TCP 443, while the voice app uses UDP. After enabling TUN, find the relevant UDP entry on the client's Connections page, then check the matched rule and selected outbound. If the entry shows traffic sent to a proxy group, focus on the node actually selected in that group and whether it supports UDP—not on repeatedly toggling the system proxy. If the app connects after falling back to TCP, that only confirms the fallback path works.

DNS capture and domain-based rules

tun.dns-hijack can route matching traditional DNS traffic to mihomo's DNS module. An app's built-in DoH wraps queries in HTTPS, so rules targeting ordinary port 53 traffic won't recognize them as DNS. In that case, even if the app's connection passes through TUN, the core may not know the destination domain. If the connection entry shows only an IP and your configuration relies on DOMAIN-SUFFIX, check the DNS path and the actual rule match first. Don't blame rule order just because a connection matched MATCH.

mihomo settings: routing, network stack, and outbound

  • tun.enable: Enables or disables the TUN inbound. Creating the interface and installing routes typically require elevated permissions. In Clash Verge Rev, first check the client service status and confirm in the logs that the interface was actually created. An enabled toggle doesn't mean startup succeeded.
  • tun.auto-route: Automatically sets up TUN routes. When using a corporate VPN or another virtual interface, check which interface the destination address ultimately uses. Check IPv4 and IPv6 separately; an IPv4 test tells you nothing conclusive about the other address family.
  • tun.stack: Selects the network stack for handling TUN traffic. Available values include system, gvisor, and mixed. Switching stacks can help compare compatibility with a specific app, but it doesn't replace route checks or make a node without UDP support usable for outbound traffic.
  • rules: Once traffic reaches the core, rule mode typically checks rules in order; the first match determines what happens next. When troubleshooting, note the matched rule, proxy group, and actual outbound. DIRECT means the core connects directly to the destination; it doesn't mean the app bypassed the core entirely.

When troubleshooting local network access, distinguish route exclusions from direct-connection rules. For example, with a home router at 192.168.1.1, excluding the subnet actually used on your LAN can keep that traffic on its original route, so it won't appear in TUN connection logs. With only a DIRECT rule, traffic may still enter the core before connecting directly. Network discovery may also rely on local multicast, so opening the router's web interface doesn't prove printer discovery works.

Choosing a mode: match it to your apps

If you mainly use browsers and desktop apps that follow proxy settings, start with the system proxy. The local port, each app's proxy settings, and the core's rules give you three clear checkpoints, without requiring changes to system routes. If only one tool ignores the system proxy, first check whether it supports a separate HTTP or SOCKS proxy setting.

Consider TUN if multiple programs ignore the system proxy or you need the core to handle app-generated UDP. Before switching, note the system proxy toggle and current proxy group. For testing, turn off the system proxy first so a browser doesn't keep using the local port and make a successful proxy-port test look like TUN is working. Both entry points can coexist, but testing one at a time makes troubleshooting clearer.

Don't treat TUN as a speed boost. If both entry points match the same rules and use the same node, the remote route and node load still matter. For a fair speed comparison, keep the destination, node, and test window constant, and confirm both tests use the same transport protocol. Comparing one TCP download with one QUIC download won't isolate the effect of the entry point.

Trace the path: local port, TUN, and rule matches

  1. First, test the explicit proxy. Turn off TUN and leave mihomo running. This example is for PowerShell on Windows 11 and assumes the local HTTP or mixed-proxy port is 7890; replace it if your port is different. The command specifies a proxy explicitly, so it doesn't test whether an app reads the Windows system proxy settings.
curl.exe -I --proxy http://127.0.0.1:7890 --max-time 10 https://example.com/
  1. Next, test TUN. Turn off the system proxy, enable TUN, and keep the existing rule mode and node selection. Run the command below. --noproxy "*" makes this request bypass curl's application-level proxy, but it doesn't change system routing. Check the client's Connections page or logs at the same time; a short-lived request may close before you refresh the list.
curl.exe -I --noproxy "*" --max-time 10 https://example.com/
  1. Finally, check the outbound path. Compare the destination hostname or IP, matched rule, and actual node. A successful request with no corresponding entry doesn't prove TUN captured it; first check the route and exclusions for that address family. If an entry appears but the request fails, continue with the DNS result, matched policy, and node connectivity. If only the first command fails to connect to the local port, check that the port is listening before changing TUN settings.

These two commands test only this HTTPS request; they don't test voice traffic over UDP, in-app DoH, or local network discovery. Once you've confirmed the basic path, retest the app that originally had the problem. Change one setting at a time and establish a new connection, or an existing connection may keep using its previous path.

Download Clash