Local inference is a supply chain, not a single tab
In 2026, the conversation around local LLM tooling is loud for good reason: you can run capable models on a workstation, a small server, or even a well-cooled laptop, and the Ollama project made that experience approachable for a wide audience. The painful part is rarely the first paragraph of a README. It is the long pull: multi-gigabyte weights, LFS objects, resumable chunks, and occasionally a redirect chain that bounces you between a hub, a cloud edge, and a storage bucket that you never see spelled out in marketing copy.
When ollama pull prints a timeout, people tend to reach for a faster node or a bigger subscription. Sometimes that helps. More often, the process is stalling because model download traffic is split across hostnames with different latency profiles, and your Clash profile routes them with the same broad brush. The browser that loads a documentation page can look “fine” while the binary path that fetches a blob is stuck behind a suboptimal exit or an accidental DIRECT hop your ISP shapes aggressively. This article is about making those layers explicit, not about comparing chat front ends.
If you are new to the idea of per-domain policy groups, start from the Clash official home page for a product overview, then read the beginner routing rules guide so the YAML vocabulary below is not your first contact with the rule-matching order.
Treat Hugging Face and registry traffic as multiple products
Do not try to memorize a static host list from a random screenshot, because Hugging Face and Ollama both evolve their edges. Instead, use categories you confirm in your own Mihomo or Clash connection log while a failing ollama pull runs. The categories below are a mental model, not a promise about tomorrow’s SNI list.
Hub-shaped metadata and small API calls. Model cards, file listings, authentication flows, and HTML pages often live under familiar huggingface.co (and related) hostnames. These requests are not huge, but they are latency-sensitive in the sense that a stalled handshake or a wrong DNS answer stops everything downstream.
Large-object and CDN-shaped downloads. When weights move as big blobs, the client may follow redirects toward CDNs, regional edges, or storage endpoints whose autonomous systems do not look like a tidy “Hugging Face” label in a traceroute. A routing rule that only names the top-level site can miss a sibling hostname that still carries 90% of the bytes. That gap is a classic reason people who run bilingual setups talk about split routing in Clash: one hostname in the list is not the whole story.
Ollama’s own distribution path. The Ollama application coordinates models through its own registry and update channels. In practice, you should expect distinct SNIs for “library” operations versus the actual payload movement. Your logs, not a forum post, are the source of truth for which name appeared when the stall happened.
Optional mirrors and environment overrides. Teams in regions with difficult paths to the default endpoints sometimes set a mirror base URL for Hugging Face–compatible downloads or use documented environment variables. Those endpoints deserve explicit rules, because sending a domestic mirror through a faraway foreign exit is as wasteful as sending a public Hub API through a tunnel that your employer rate-limits.
Design policy groups for throughput versus stability
Readable defaults look like: HF_HUB for the primary Hub interaction family you observe in logs, HF_BLOB for large-file or CDN-shaped hostnames, OLLAMA_LIB for Ollama’s registry and coordination hosts, and MIRROR or HF_MIRROR for any alternate base URL you configure intentionally. The names are arbitrary; the point is to avoid one catch-all “Proxy” group that is simultaneously your best throughput pick and your only stable long-session pick.
Within HF_BLOB, you usually want exits that sustain TCP well at high throughput, tolerate occasional packet loss, and do not reset connections the moment a download crosses five minutes. Within HF_HUB, you may prioritize lower handshake latency. Within OLLAMA_LIB, you may care about session stickiness if you observe odd behavior when nodes rotate during a long pull.
Readers who also split terminal OpenAI traffic can reuse the habit from our Codex CLI and API split-routing article, but do not copy those suffix lists: local LLM pulls touch a different vendor graph.
Explicit DOMAIN rules, not keyword soup
Clash-family cores take the first matching rule. A broad GEOIP,CN stroke or a community RULE-SET is convenient until it swallows a range you still wanted to proxy, or the opposite: an overly aggressive domestic rule sends a foreign CDN hostname out the wrong interface.
Prefer DOMAIN-SUFFIX and DOMAIN lines you validated from logs for the Ollama and Hugging Face families you care about, then place them above large remote lists and GEOIP. Start with huggingface.co as a family anchor only if your captures show traffic there; follow up with the actual blob hosts your client requested during a failed model download.
Avoid DOMAIN-KEYWORD,hf unless you like debugging false positives. Keyword rules age poorly, and a short substring that looked clever in April can break unrelated services in June. If you need a short experiment, date-stamp a comment in your YAML and graduate to explicit suffixes once you have exported real SNIs.
For remote RULE-SET maintenance, the advanced rule providers guide explains how local overrides and provider ordering interact; the same idea keeps your Ollama lines from being shadowed by a community list you forgot about.
Why a silent DIRECT hit looks like a random timeout
The most frustrating error messages are the honest ones. A tool reports “context deadline exceeded” or “i/o timeout” and you are left guessing. Under the hood, your profile may be sending the manifest request through a stable proxy but the object store through a path that your ISP throttles on IPv4 while IPv6 takes another route, or a secondary hostname fell through to MATCH in a way that never appears in a short test.
Keep a clear ordering habit: your verified inline DOMAIN lines for the local LLM supply chain first, then curated rule sets, then GEOIP, then the final MATCH. If a community set wins the race, your pretty group names are decorative.
When you suspect half of the work is on HTTP/3 or UDP-shaped transports, the QUIC and HTTP/3 troubleshooting article is the companion read. Blob downloads that suddenly stall only on HTTP/3 are not theoretical in 2026.
A minimal YAML sketch you must validate
The block below is deliberately illustrative. Confirm every suffix and registry hostname against your own capture, align group names with your real proxies, and insert the block above any sweeping rules that might quietly override it.
# Example only — names and suffixes are placeholders; verify SNIs in your logs.
proxy-groups:
- name: HF_HUB
type: select
proxies:
- stable-low-latency
- backup-node
- DIRECT
- name: HF_BLOB
type: select
proxies:
- high-throughput-a
- high-throughput-b
- DIRECT
- name: OLLAMA_LIB
type: select
proxies:
- stable-low-latency
- DIRECT
rules:
- DOMAIN-SUFFIX,huggingface.co,HF_HUB
# Add blob/CDN hostnames you actually observed, e.g. cdn-*.huggingface.co:
# - DOMAIN-SUFFIX,cdn-lfs.huggingface.co,HF_BLOB
# Ollama library/registry hosts from your own logs:
# - DOMAIN,registry.ollama.ai,OLLAMA_LIB
- MATCH,DEFAULT
Notice the comments: real deployments almost always add more than one DOMAIN-SUFFIX for large downloads. If you run a HF mirror for enterprise or regional reasons, add those suffixes to a dedicated group or to DIRECT on purpose, and document why, so a teammate does not “clean up” your YAML into a single foreign pool again.
Ollama, proxies, and where the process actually connects
Ollama runs as a system service on many machines. A browser that respects the macOS or Windows “system proxy” is not the same as a background daemon that opens sockets on its own. You may need to export HTTP_PROXY and HTTPS_PROXY for the service environment, or you may prefer a TUN-style route so the OS forwarding table steers bytes without per-daemon configuration.
Documented variables such as a Hugging Face–compatible base URL for downloads exist precisely because the default path is not universal. If you set one, your Clash policy must route that mirror’s hostnames the way you intend—often DIRECT when the mirror is domestic—while still keeping foreign Hub access consistent with your security policy. Split brain between environment variables and routing tables is a frequent root cause of “it worked once, then I changed Wi-Fi and it died.”
On Windows 11 with WSL2, the failure mode often duplicates itself: a happy Edge session on the host, a pull inside Linux that does not see the same IP or the same proxy. When that is your world, the WSL2 port forward and DNS guide is not optional side reading; it is the other half of the same incident ticket.
DNS, fake-ip, and resolver split-brain
Misaligned DNS is the quiet killer of split-routing plans in Clash. If the system resolver and the core resolver return different answers for the same AAAA or A record, the application and the proxy are not even speaking to the same remote peer. Fat downloads exacerbate the issue because a wrong address might still ping while TLS or chunked transfer later collapses in ways that look like a slow disk.
Under fake-ip modes, domain rules and resolution interact in ways that surprise newcomers. Read your client’s documentation for the exact build you run, and test hostname resolution with the same pipeline your rules expect. A quick dig on the host does not refute a different answer inside the tunnel.
When the symptom is “Clash is connected, yet apps feel broken,” the connected but no internet log and DNS guide walks a broader check-list that still applies to local LLM stacks that mix user-space proxies with kernel routes.
Verification you can repeat after every profile change
- Reproduce a failing
ollama pullwith logging enabled, and export the SNIs that appear in the same second as the user-visible timeout. - Map each SNI to
HF_HUB,HF_BLOB, orOLLAMA_LIBin the log, not to an unplannedDIRECTline you forgot. - Run a small-file request against a Hub metadata path and a separate large request path, and confirm they use the intended groups.
- Compare IPv4-only and dual-stack runs; half the mystery tickets in 2026 still involve IPv6 taking a different AS path.
- Re-test from a clean shell environment to rule out stale
HTTPS_PROXYvalues left over from last week’s experiment.
Symptoms and what to inspect first
| What you see | What to inspect first |
|---|---|
| Manifest or model list works; huge download stalls at a few percent | Blob hostname on a different group than the Hub; unify HF_BLOB and confirm UDP if HTTP/3 is in play |
| First run after reboot always fails; retry succeeds | Resolver race or service start order; compare DNS with and without the tunnel, check IPv6 |
| Works on one Wi-Fi, fails on another with the same YAML | Captive portal or DNS hijack on the new network, or ISP mid-box behavior on the blob path |
| Pull succeeds in browser-based tools on the same machine | Daemon is not using the same proxy or route as the browser; re-check TUN, env, and WSL2 NAT |
Ethics, terms, and what routing cannot do
Routing to another region can intersect with platform terms, export control, and local law. This guide explains network mechanics for readers who are allowed to access the services they route. It is not an encouragement to bypass account restrictions, licensing walls, or acceptable-use policies. Technology also cannot fix a genuine upstream outage: when a hub is degraded globally, the constructive move is patience, a mirror you are entitled to use, or an official status channel—not endless node roulette.
Closing: make local LLM downloads boring again
Compared with a single “Global” switch, named groups for the Hub, blob edges, and Ollama’s own library path trade a few minutes of careful YAML for fewer midnight mysteries. Clash shines when the rule engine tells a clear story: explicit host families first, large community sets later, DNS that matches the tunnel, and evidence from logs when something drifts.
That predictability is the same reason teams standardize on Mihomo-class cores for developer machines: when ollama pull fails, you can tell the difference between a bad day on the public internet and a self-inflicted misroute. When you are ready to align the client install with that philosophy, the Clash download page lists platform builds that match the documentation tone here—installers on this site first, open-source transparency second.