You turn on the proxy, the browser loads everything, and then curl, git, pip, docker pull or ssh all behave as if the proxy doesn't exist. Nothing is broken — the terminal simply doesn't share the browser's networking model. There are exactly four places the two diverge, and the fix is different in each.

1. Command-line tools read environment variables, not system proxy settings

The browser asks the OS. Most CLI tools read http_proxy, https_proxy, all_proxy, and sometimes no_proxy from their own environment, and they read them once at startup.

env | grep -i proxy 

If that's empty, nothing on the command line is proxied regardless of what the GUI says. Set them for the current shell:

export https_proxy=http://127.0.0.1:7890 export http_proxy=http://127.0.0.1:7890 export all_proxy=socks5://127.0.0.1:7891 export no_proxy=localhost,127.0.0.1,::1,10.0.0.0/8,192.168.0.0/16 

Three details that cause most of the remaining confusion:

  • Case matters in some tools. HTTP_PROXY and http_proxy are both checked by curl, but a few tools only read lowercase. Set lowercase; add uppercase only if something still ignores it.
  • socks5:// vs socks5h://. With socks5://, the client resolves the hostname locally and sends an IP through the proxy. With socks5h://, DNS happens at the proxy. If DNS is the thing being blocked, plain socks5:// fails while the browser works, because the browser is doing remote resolution.
  • no_proxy needs to match how the tool compares. 10.0.0.0/8 is not honoured by every implementation; list the literal hosts when it matters.

curl has its own flag that bypasses all of this, which is why curl -x "proving the proxy works" tells you nothing about whether your environment is set correctly:

curl -x http://127.0.0.1:7890 -sS https://ifconfig.me # explicit, always works if proxy is up curl -sS https://ifconfig.me # what your tools actually see 

If the first returns the proxy's IP and the second returns your real IP, the proxy is fine and the environment is the problem.

2. TUN mode and system proxy are not the same thing

A "system proxy" sets an HTTP/SOCKS endpoint that applications must voluntarily use. TUN mode creates a virtual network interface and routes packets at the IP layer, so applications that know nothing about proxies get captured anyway.

This is why the usual symptom pair looks contradictory:

  • Browser works, terminal doesn't → system proxy mode, environment not set. Fix: export the variables.
  • Neither works, but the client says "connected" → TUN mode with a routing or DNS problem, and nothing is actually being captured.

Check whether packets are really going through the interface rather than trusting the client's status light:

ip route get 1.1.1.1 # Linux: does the route point at the tun device? netstat -rn | head -5 # macOS: look for the utun default route 

If the default route still points at your physical interface, TUN isn't installed, and the "connected" indicator is describing the core, not the tunnel.

3. DNS resolution path

In system-proxy mode, the browser often resolves through its own resolver and, with DNS-over-HTTPS enabled, bypasses the OS resolver entirely. The terminal uses getaddrinfo, which uses /etc/resolv.conf.

scutil --dns | head -20 # macOS: what the system actually uses resolvectl status | head -20 # Linux with systemd-resolved cat /etc/resolv.conf 

The classic failure: the client sets fake-ip mode, the browser is configured to accept the fake range, and the terminal gets 198.18.x.x answers that nothing routes. Or the opposite — the OS resolver still points at a DNS server that the tunnel doesn't reach, so every name lookup times out before the proxy is even consulted.

Test resolution separately from connectivity:

getent hosts github.com # does the name resolve at all? curl -v --max-time 8 https://github.com 2>&1 | head -20 # where exactly does it stop? 

4. IPv6 and "happy eyeballs"

A dual-stack host that advertises AAAA records will be tried over IPv6 first by many clients, and quite a lot of tunnel setups only carry IPv4. The browser falls back fast and you never notice; git or ssh can sit for 20 seconds before failing.

curl -6 -sS -m 5 https://github.com -o /dev/null -w '%{http_code}\n' curl -4 -sS -m 5 https://github.com -o /dev/null -w '%{http_code}\n' 

If -4 works and -6 hangs, the tunnel has no IPv6 path. Either give the tunnel IPv6, or disable AAAA resolution for the tools that suffer:

# curl curl --ipv4 ... # ssh ssh -4 ... # git git config --global http.version HTTP/1.1 # unrelated, but useful when a proxy mangles h2 

The order to check things in

  1. env | grep -i proxy — is anything even set?
  2. curl https://ifconfig.me — which IP does the tool see?
  3. ip route get 1.1.1.1 / netstat -rn — is TUN actually installed?
  4. getent hosts <host> — does DNS resolve, and to what?
  5. curl -4 vs curl -6 — is it an address-family problem?

Each of these is ten seconds and each one eliminates a whole category. The pattern is always the same: the GUI reports the state of the proxy core, and the terminal reports the state of the network. They're allowed to disagree, and when they do, the terminal is telling you the truth.

I wrote up the client-side version of this — the five layers a TUN connection passes through, and what each failure looks like from inside Clash Verge Rev — at TUN mode says connected but nothing loads. The full error-string index for the common clients is at the troubleshooting hub.