Clash TUN vs. System Proxy: Coverage, Virtual Adapters, and HTTP Proxies
Learn how system proxies rely on apps to honor proxy settings, while TUN captures traffic at the network layer. Compare coverage, DNS handling, and use cases.
System Proxy vs. TUN: How Traffic Reaches the Core
A system proxy is a set of settings provided by the operating system for apps to read. TUN is a virtual network interface that receives IP packets selected by the routing table. With a system proxy, an app must connect to the proxy port; with TUN, apps usually don't need to know the proxy port. Both determine how traffic enters the core—not which proxy node handles it afterward.
| What to compare | System proxy | TUN |
|---|---|---|
| Traffic entry path | The app connects to a local HTTP proxy port | The system routes IP packets to a virtual network interface |
| App coverage | Apps that read and honor the system proxy settings | Apps whose traffic matches a route handled by TUN, including apps that ignore proxy settings |
| UDP | A standard HTTP proxy does not capture UDP sent directly by apps | Can receive UDP; forwarding still depends on node and protocol support |
| DNS | Depends on the app, local resolver, and proxy behavior | Can send queries matching hijack rules to the core's DNS module |
For example, in mihomo, mode: rule uses rules to choose an outbound. Whether a browser connects through an HTTP proxy or a terminal sends traffic through TUN, it can match DIRECT in rule mode. Conversely, switching to global mode won't make apps that ignore the system proxy send traffic to the core.
System Proxy: Works in Browsers, but Not Always in Terminals
Suppose the client uses mixed-port 7890 and listens on 127.0.0.1. When the system proxy is enabled, browsers that honor the setting connect to 127.0.0.1:7890. For an HTTPS site, they typically send a request such as CONNECT example.org:443 to establish a tunnel. TLS is still negotiated between the browser and the site; this kind of forwarding doesn't require installing a root certificate. 7890 is only an example—check the client's actual port and inbound type before testing.
On Windows 11, find the system proxy settings under Settings → Network & internet → Proxy. On macOS, go to System Settings → Network → select your network service → Details → Proxies. Browser extensions or a browser's own proxy settings may override the system settings. Terminal apps often use environment variables or their own config files, so don't assume they behave like your browser.
Test a specific proxy port with curl
curl -v --proxy http://127.0.0.1:7890 --noproxy "" https://example.org/
In Windows PowerShell, call curl explicitly with curl.exe. Turn TUN off first so the two traffic entry paths don't overlap. This command specifies an HTTP proxy and clears the proxy bypass list for this request; it tests the local proxy port, not the system proxy settings. If verbose output shows that it can't connect to 127.0.0.1:7890, check that the core is running and the port is correct. If it sends CONNECT to the local proxy, check the connection panel for the matched rule and final outbound. Don't judge whether the node is working solely by whether a webpage loads.
TUN: Routing, Permissions, and UDP Are Separate Issues
The app still sends packets to the destination IP, and the system chooses an outgoing interface based on its routing table. If that interface is TUN, mihomo can process the packets and establish the actual outbound connection according to the config. tun.enable enables TUN, while tun.auto-route configures routes for traffic capture. Creating a virtual interface doesn't mean every destination is routed through it. Client-configured exclusions, routes from an existing VPN, and IPv6 routing can all affect the outcome.
- Permissions: Creating an interface and changing routes require system authorization. Desktop clients may handle this through a service; Android typically uses the system VPN permission. If the toggle switches itself back off, check the client logs for interface creation or routing errors.
- UDP: TUN can capture an app's UDP packets, but that doesn't mean the proxy node can forward them. If a game's login works but the connection drops when a match starts, TCP login may be succeeding while the UDP session fails. Check the policy matched by each connection, then confirm that the outbound protocol and node support UDP.
- LAN: If a printer or NAS becomes unreachable with TUN enabled, check its actual address and the routes capturing its traffic. For a device on
192.168.50.0/24, for example, verify that this subnet is still reachable through the original network interface. Excluding a subnet from TUN routes is different from routing captured traffic throughDIRECT.
DNS: Capturing Connections Doesn't Automatically Capture DNS
An HTTP proxy can match rules against the domain in a request, but that doesn't mean every DNS query from the app goes through the proxy. The app may resolve the domain first using the system resolver, or use its own encrypted DNS. TUN, on the other hand, receives IP packets. If the core sees only a destination IP, with no domain mapping or other domain information available, don't assume domain-based rules will match.
With mihomo DNS enabled, tun.dns-hijack can use any:53 to send regular UDP port 53 queries arriving through TUN to the core's DNS module. TCP port 53 must be matched separately with tcp://any:53. Browser DoH queries are usually carried over HTTPS, so these settings won't treat them as DNS queries on port 53. The connection may pass through TUN, but capturing a connection and resolving the DNS request inside it are not the same thing.
Fake IP vs. Real IP
dns.enhanced-mode: fake-ip can return a synthetic address for supported domains. When a connection later targets that address, the core uses its mapping to recover the original domain and apply routing rules. Seeing a synthetic address in a lookup isn't itself a problem; the key is whether the connection returns to the same core. For LAN domains that need real addresses, check fake-ip-filter as appropriate. Filtering out synthetic addresses won't automatically select the right upstream DNS server. If internal company domains fail to resolve, also check whether queries are sent to a server that can resolve them.
Choosing an Entry Point: Enable One, Then Check Connections
- Mostly browsers and desktop apps that honor system settings: Start with the system proxy. It doesn't require a virtual network interface. If only one terminal command needs a proxy, use that tool's proxy option instead of changing routes for the whole machine.
- Apps without proxy settings, or apps that need UDP capture: Try TUN. First note whether your LAN, internal domains, and IPv6 work as expected, then turn off the system proxy for a clean comparison. Keep the same rules and outbound selection; otherwise, you can't tell whether differences come from the entry point or the outbound.
- Verify TUN capture: Turn off the system proxy, run
curl -v --noproxy "*" https://example.org/, then look for the request in the connection panel. This option makes curl skip explicit proxies; it doesn't bypass system routing. A webpage loading only proves connectivity. A matching entry in the core confirms that the request reached it. - Troubleshoot routing: If there's no connection record, check for app-level proxy overrides or TUN routing issues. If there is a record but the wrong outbound was selected, check the matched rule and policy group. If the outbound is correct but the request still times out, check DNS results, node connectivity, and UDP support. If the connection fails only with TUN enabled, restore the original setup and test routing, DNS, and outbound behavior one at a time.
Subscriptions can provide nodes, and some also supply rules or DNS settings. But the system proxy and TUN toggles, permissions, and effective routes are still controlled by the local device. If something breaks after reloading a subscription, compare the client's merged, active config rather than relying on the raw subscription content.