On this page
System proxy: an address in the settings
A system proxy is a line in the network settings: send web traffic to 127.0.0.1, port such-and-such. The client listens on that port and carries whatever arrives to the server. On Windows it is in Settings → Network & internet → Proxy.
The setting is a request, not a rule. Chrome, Edge and Firefox with default settings follow it. A program that doesn't read it connects straight to the network: many games, messengers and updaters, and nearly all command-line tools. The usual system proxy is an HTTP proxy, which carries only TCP, so UDP, the traffic of calls, games and WebRTC, goes past it.
TUN mode: a virtual network adapter
TUN is a virtual network adapter the client creates, with the system's routes changed so that traffic to the internet goes into it instead of Wi-Fi or Ethernet. The client reads every packet coming out of the adapter, TCP or UDP, and carries it through the tunnel; programs don't need to know. WireGuard and OpenVPN have always worked this way, and this is what “TUN mode” means in clients built on Xray, sing-box or mihomo.
Creating an adapter and changing routes are system changes, so TUN needs administrator rights on Windows and root on macOS and Linux: clients ask to run as administrator or install a helper service once. On Android every VPN app works this way: after you allow the VPN, the system gives the app a virtual adapter for the whole phone.
- Routes — the client keeps its own connection to the server out of the adapter, or that traffic would go round in a loop.
- DNS — name lookups enter the adapter too; a good client answers them itself or sends them through the tunnel.
What goes through: proxy vs TUN
Pages in the browser
System proxyYes, if the browser follows the system setting
TUNYes
WebRTC in the browser (UDP)
System proxyNo, it goes direct
TUNYes
Messengers, launchers, updaters
System proxyOnly those that read the setting
TUNYes
Games
System proxyNo: their own connections, mostly UDP
TUNYes, if the server's protocol carries UDP
Voice and video calls in apps
System proxyUsually not: calls go over UDP
TUNYes
curl, git, pip, npm
System proxyNo: they read
HTTP_PROXYandHTTPS_PROXYTUNYes
System DNS lookups
System proxyNo: to your provider's DNS
TUNYes, taken in the adapter
Administrator rights
System proxyUsually not needed
TUNNeeded
Global, Rule and Direct are not TUN
Clash-like clients have a mode switch: Rule, Global, Direct. It decides where traffic goes once the client has it: by the rules, all through the server, or all straight out. Which traffic reaches the client at all is decided by the system proxy or TUN.
So Global with a system proxy still misses games, calls and terminal tools: they never reach the client. TUN with Rule takes everything and sends part of it direct. For a VPN for the whole computer you need TUN; global or rule is routing on top of it.
Why a proxy leaks WebRTC and DNS
With TUN both gaps close by themselves: STUN requests and DNS lookups enter the adapter. What stays outside is what the rules send direct, and IPv6 if the tunnel carries only IPv4.
- WebRTC — calls in the browser learn your public address with a UDP request to a STUN server. UDP goes past an HTTP proxy, so a WebRTC test shows your provider's address while IP check sites show the server.
- DNS — the browser hands the site's name to the proxy, but programs outside the proxy ask your provider's DNS, and a DNS leak test shows those servers.
How to see which mode is on
reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" | findstr /i proxyProxyEnable 0x1 with ProxyServer 127.0.0.1:… — the proxy browsers follow is on; 0x0 — off. Same switch as Settings → Network & internet → Proxy.
netsh winhttp show proxyA separate setting for system services. Direct access (no proxy server). means none here, but clients usually set the one above.
scutil --proxyHTTPEnable : 1, HTTPSEnable : 1 or SOCKSEnable : 1 with HTTPProxy : 127.0.0.1 — a system proxy is on.
gsettings get org.gnome.system.proxy mode'manual' or 'auto' — a proxy is set; 'none' — no proxy. Terminal tools follow variables instead: env | grep -i proxy.
Get-NetAdapterWith TUN on, an extra adapter is Up; its description usually names the driver or program, such as Wintun or WireGuard. It goes away after you disconnect.
ifconfig | grep utunmacOS keeps a few utun interfaces of its own. Compare before and after connecting: the new one is the tunnel.
ip linkLook for tun0, wg0 or a name the client chose, with POINTOPOINT and UP in its flags.
TUN is on, but there's no internet
The TUN switch doesn't stay on, or the adapter isn't created
CauseNo administrator or root rights, or the client's helper service isn't installed
What to doRun the client as administrator or install its service, then turn TUN on again
Nothing opens in any program
CauseAnother VPN or TUN is up at the same time, and their routes and DNS clash
What to doLeave one tunnel; check
Get-NetAdapterorip linkfor extra adaptersNothing opens, but the system proxy works
CauseA firewall or antivirus blocks the client's core (xray, sing-box, mihomo), or the connection to the server loops back into the adapter
What to doAllow the core in the firewall, update the client, check that no rule sends the server's own address into the tunnel
Sites don't open by name;
nslookup example.comtimes outCauseDNS isn't taken into the adapter, or the client's DNS server doesn't answer
What to doTurn on DNS capture (often DNS hijack) in the TUN settings, or pick another DNS server
Only one browser fails
CauseIts own secure DNS (DoH) server or a proxy extension
What to doSet secure DNS back to the default, turn the extension off
After closing the client the browser shows ERR_PROXY_CONNECTION_FAILED
CauseThe system proxy still points to
127.0.0.1, and nothing listens thereWhat to doTurn the proxy off in Settings → Network & internet → Proxy
Sites open, games and calls don't
CauseThe server or its protocol doesn't carry UDP
What to doAllow UDP on the server, or use a protocol that carries it