BlogUpdated 2026-09-24

Running Cargo on a Restricted Network

How Mohammad Pouya Ghourchiani keeps Rust builds moving when crates.io is unreliable — mirrors, vendor discipline, and installers.

By Pouya GhourchianiGhourchiani

engineeringrust

When crates.io is slow or unreachable, “just wait” is not a release plan. This note documents the workflow used around cargo-rust-network-ir: treat the registry as an unreliable dependency and make the build path own its inputs.

Direct answer

  1. Pin a reachable mirror (or an internal sparse index) instead of hoping DNS will behave.
  2. Prefer cargo vendor / offline flags for CI images that must not call the public registry.
  3. Ship installers that already contain the crate graph you need for first boot.
  4. Measure: time-to-first-compile with egress blocked — if it fails in the lab, it will fail on-site.

What not to do

Do not paste anonymous mirror URLs into every laptop without ownership. Do not mix nightly toolchains across machines “because it worked once.” Do not pretend cargo update is safe on air-gapped nights.