How TUN Mode Works and How to Enable It: Full Traffic Takeover Done Right

Explains the difference between the TUN virtual adapter and system proxy, which apps need TUN mode to be proxied at all, and the permission and DNS pitfalls to watch for when enabling TUN on each platform.

01

Where System Proxy Ends and TUN Mode Begins

SECTION / PROXY VS TUN

A system proxy is an OS-level setting. In practice it writes a set of proxy addresses into the system or an app's runtime environment (environment variables like HTTP_PROXY / HTTPS_PROXY, or Windows' WinINet/WinHTTP settings, or macOS Network preferences). Only when a program actually reads that configuration and routes its own traffic to the proxy port does it count as "going through the proxy." It's a **cooperative** form of forwarding — whether the proxy takes effect depends entirely on whether the target program plays along.

TUN mode works completely differently. When Clash Meta (mihomo) enables TUN, it creates a virtual network adapter on the system (backed by the Wintun driver on Windows, or a utun/tun0 device on macOS/Linux) and points the system's default route at that virtual adapter. From then on, every IP packet that passes through the network layer — regardless of which process sent it or whether that process even knows a proxy exists — is intercepted by the virtual adapter first and handed to the Clash core for rule-based processing. This is a **forced takeover at the network layer**, with no cooperation from any program required.

In short: system proxy controls "whether traffic is willing to go through," while TUN mode controls "traffic goes through me no matter what."

NOTE

TUN mode isn't a "beefed-up" replacement for the system proxy — it's a separate forwarding path entirely. Most clients let both coexist, but when both are enabled at once, watch for the routing table overriding itself. It's generally best to pick one or the other to keep troubleshooting simple.

02

Traffic That Only TUN Mode Can Proxy

SECTION / WHO NEEDS TUN

In the following scenarios, a system proxy simply won't work — only TUN mode covers them:

If you notice an app "still connecting directly even with the proxy on," it's most likely one of the cases above — and enabling TUN mode is the most direct fix.

03

How to Enable TUN on Each Platform, and What Permissions It Needs

SECTION / PLATFORM SETUP

Because TUN mode has to create a virtual adapter and modify the system routing table, all three major platforms require elevated permissions — though the specifics differ.

On Windows, creating a virtual adapter relies on the Wintun driver. Mainstream clients (Clash Verge, derivatives of Clash for Windows) install this driver automatically on setup or the first time TUN is enabled. Steps:

  1. Run the client as administrator (right-click → "Run as administrator," or enable "Launch with admin privileges at startup" in settings).
  2. Find the TUN mode toggle in the settings panel and turn it on. The first time, Windows will prompt for driver installation or network adapter authorization — click Allow.
  3. If Windows Defender Firewall blocks the virtual adapter's outbound rules, manually allow the relevant network category for that driver in the firewall settings (usually choosing "Private network" the first time the prompt appears is enough).

Not running the client as administrator is the most common reason TUN mode fails to enable on Windows — it typically shows up as the toggle flipping back off right after you turn it on.

CAUTION

TUN mode gives a client the ability to take over all system routing. Only obtain clients from official channels and verify the download source — never grant administrator rights or CAP_NET_ADMIN to a program from an unknown source.

04

DNS Behavior: fake-ip, Hijacking, and Routing Loops

SECTION / DNS BEHAVIOR

Once TUN mode is enabled, DNS queries are intercepted by the virtual adapter too — and this is where things most often go wrong. Your config usually needs to explicitly declare a DNS hijacking and resolution strategy:

tun:
  enable: true
  stack: system
  dns-hijack:
    - "any:53"
  auto-route: true
  auto-detect-interface: true
dns:
  enable: true
  fake-ip-range: 198.18.0.1/16
  nameserver:
    - 223.5.5.5
    - 1.1.1.1

dns-hijack forces all outbound DNS requests on port 53 to be intercepted and handled by the Clash core, preventing traffic from bypassing the rules and connecting directly to a censored or otherwise unreliable DNS server. fake-ip mode assigns each domain a fake IP within a private address range; apps see this fake IP, and the core only swaps in the real outbound address once the connection is actually established. The benefit is that rules can match by domain name without waiting on the real DNS resolution result.

Common troubleshooting angles:

05

Confirming TUN Mode Is Actually Working

SECTION / VERIFICATION

After enabling TUN mode, verify it in the following order rather than trusting the toggle's on/off state alone:

  1. Check that the virtual adapter exists. On Windows, open "Network Connections" and look for a new adapter named something like "Mihomo" or "Clash." On macOS/Linux, run ifconfig or ip addr to check for a utun / tun0 device.
  2. Check the default route. Use route print on Windows, or netstat -rn / ip route on macOS/Linux, to confirm the default route points to the virtual adapter rather than the physical one.
  3. Test with a tool that ignores the system proxy. For example, run curl in a terminal without any proxy flags, or ping a domain from the command line that your rules say should be proxied, and see whether it takes the expected route.
  4. Check the client's connection log. Most clients label each connection's inbound type in the "Connections" or "Logs" panel. Connections under TUN mode are usually tagged TUN rather than HTTP/SOCKS — a reliable way to confirm which path is actually in effect.

If all of the above checks out but a specific app still isn't being proxied, it's most likely bound to a fixed network interface at the OS level or using a custom DNS resolver. Troubleshoot that program's own network settings rather than continuing to adjust the Clash config.

CTA-01

Need a client that supports TUN mode?

Both Clash Verge and the mihomo core support a TUN mode toggle — pair it with the permission and DNS notes in this article to get set up. If you haven't installed a client yet, grab the right package for your platform from the download page; if you'd like a refresher on the basic install flow first, check the tutorial page.

Get the ClientDL·711