TUN Mode vs. System Proxy: How Traffic Routing Works
Compare system proxy and TUN routing across the network stack, app compatibility, UDP support, and DNS handling. Learn when to use each and what to check when switching.
Network Stack: Proxy Ports vs. Virtual Network Adapters
A system proxy takes effect when an app opens a connection. Apps that support system proxy settings read the proxy address provided by the operating system, then connect to a local proxy port. For example, when an app visits an HTTPS site, it can send an HTTP CONNECT request to 127.0.0.1:7890 to establish a tunnel. Apps that don't read system proxy settings continue connecting according to their own network configuration. 7890 is the port used in this article's configuration, not a default for all clients.
TUN receives IP packets after the operating system routes them. Apps connect to their destination as usual; packets matching a capture route are sent to the virtual network adapter for the kernel to handle. In mihomo, for example, tun.auto-route automatically configures routes for traffic capture. The actual scope also depends on the platform, route exclusions, and routes or policies installed by other VPNs. Seeing that the virtual adapter is enabled only confirms that the interface is up—it doesn't prove that a particular connection passed through it.
App Compatibility and UDP Support
| Traffic type | System proxy | TUN |
|---|---|---|
| Browser requests that follow system settings | Can reach the kernel through a local HTTP proxy port. | Connections reach the kernel if they match a capture route. |
| Programs that open TCP connections directly | Usually require a proxy to be configured manually; this depends on the program. | The program doesn't need to implement a proxy protocol, but its connections must match a capture route. |
| UDP traffic from QUIC, voice, or games | A standard HTTP proxy doesn't capture native UDP traffic sent by these apps. | Can receive UDP traffic matching a route; forwarding also depends on the selected rule's outbound and its UDP support. |
| LAN printing and file sharing | Whether traffic uses the proxy depends on app behavior and the system proxy's bypass list. | Depends on capture routes, subnet exclusions, and how the kernel handles the traffic. |
UDP forwarding through SOCKS5, when explicitly configured in an app, is a separate path: the app, proxy listener, and outbound route must all support it. Simply enabling the system proxy—or opening a SOCKS5-compatible listener—doesn't automatically send other programs' UDP traffic to the kernel.
A webpage loading successfully doesn't prove that UDP is working. A browser may fall back to TCP when QUIC is unavailable. A voice app may let you sign in but have no audio because sign-in and media use different transport protocols. To troubleshoot, reproduce the actual issue and check the connection panel for the protocol, destination port, matched rule, and outbound. If there's no corresponding UDP entry, check traffic capture first. If an entry appears, check the outbound's UDP support and the destination's response.
DNS Routing: Where Resolution Happens and What Gets Captured
A system proxy doesn't mean system DNS traffic is forwarded through it. When an app sends a hostname to an HTTP proxy, the proxy can resolve the destination as needed, so the app doesn't have to look up the destination IP first. However, an app's pre-resolution, programs that don't use the proxy, and encrypted DNS queries initiated by the browser may follow different paths. Check separately where the application connection goes and where the DNS query itself goes.
In mihomo's TUN configuration, dns-hijack can pass matching traditional DNS traffic to the kernel's DNS module. any:53 and tcp://any:53 cover UDP and TCP queries on port 53, respectively, when they enter the capture path. They don't intercept DoH over HTTPS or DoT over TLS as ordinary DNS queries. If an app uses its own DoH, its HTTPS connection may still be captured by TUN, but that doesn't send the DNS query to the kernel's DNS module for resolution.
Minimal mihomo Configuration for Comparison
mixed-port: 7890
allow-lan: false
mode: rule
log-level: info
tun:
enable: true
stack: mixed
auto-route: true
dns-hijack:
- "any:53"
- "tcp://any:53"
dns:
enable: true
enhanced-mode: fake-ip
nameserver:
- 1.1.1.1
rules:
- MATCH,DIRECT
This configuration separates traffic capture from outbound routing: MATCH,DIRECT sends connections that reach the kernel directly, so no subscription or proxy node is needed. The example uses 1.1.1.1 as a traditional DNS upstream; if it's unreachable on your network, use a resolver that is. fake-ip returns mapped addresses for eligible domains, which the kernel later maps back to domain names when handling connections. Seeing a mapped address doesn't mean the upstream DNS query went through a proxy. To compare with the system proxy, turn off tun.enable and leave mixed-port available for apps. GUI clients may override kernel fields, so check the active configuration.
Choosing a Mode and Verifying the Switch
If you only need proxy-aware browsers or developer tools to use different routes, start with the system proxy or configure a proxy only in the target app. Enable TUN when you need to cover desktop apps that ignore proxy settings, UDP traffic, or connections that should be handled consistently by capture routes. If the machine already uses a corporate VPN, virtual machine adapter, or LAN service, note how each works before switching and test them again afterward.
- Check the local proxy port first. Keep TUN off. In Windows 11 24H2, go to Settings → Network & internet → Proxy → Manual proxy setup to check the address and port. The first command below explicitly uses an HTTP proxy to test the local listener; it doesn't prove that the command line reads Windows system proxy settings.
- Then test TUN on its own. Turn off the system proxy and clear any proxy configured directly in the test app. Start TUN with the permissions or service required by your client, then run the second command.
--noproxy "*"tells curl not to use an explicitly configured app proxy, but it doesn't bypass operating system routing. Check both requests in the kernel's connection panel or logs. A webpage response or exit IP alone can't tell you whether a connection was captured and matchedDIRECTor never captured at all. - Test DNS resolution and application traffic separately. Trigger a fresh domain lookup and distinguish traditional DNS from the system resolver from encrypted DNS initiated by the app. If the issue affects only one program, check whether it has cached an old result, kept an existing connection open, or prefers IPv6. For IPv6 tests, also confirm that the destination has an IPv6 address and that its route enters TUN.
- Finally, retest LAN access and VPNs. Check shared services, printers, and internal domains. If something breaks, turn TUN off and test again. If the problem disappears, check for conflicting routes and DNS settings. After exiting the client, if apps still try to connect to a local port that's no longer listening, check the system proxy settings for a leftover configuration.
curl.exe --noproxy "" --proxy http://127.0.0.1:7890 --head https://example.com/
curl.exe --noproxy "*" --head https://example.com/
These commands use Windows curl.exe; on macOS or Linux, use curl. If both modes are enabled, apps that follow system proxy settings may still connect through the local proxy port first, while other apps enter TUN through routing. For a clear comparison, enable only one entry point at a time so you can see which mechanism captures the connection.