Moving Models into an Air-Gapped Network: Download, Verify, Transfer
An air-gapped network keeps data in, but models, binaries and container images still have to get in somehow. That crossing point is where things go wrong: tampered weights, pickle files carrying code, half-copied shards, and files nobody can trace back to a source six months later. This tutorial walks through a repeatable path from the public source to a running model on the isolated side.
What are we building?
The result is a documented transfer path. A connected staging machine fetches Ollama, a model and container images, verifies them and writes a checksum manifest. Removable media carries the bundle across. On the isolated side everything is verified again, installed, and recorded in a log that ties every file to its origin.
For the bigger picture, covering architecture, hardware and operating models, see the overview of air-gapped AI with LLMs in fully isolated networks; the glossary entry on air-gapped operation defines the term. This article only covers the transfer itself. By the end you will have:
- an Ollama server installed from the official release archive rather than the install script,
- a model in GGUF or safetensors format, imported via a Modelfile,
- an internal container registry holding the images your applications need,
- a transfer record with checksums, sources and pinned revisions.
What do you need, and which versions?
You need two Linux hosts, a connected staging machine and a target server inside the isolated network, plus approved removable media. Commands were checked against the documentation as of November 2026: Ollama v0.40.15, huggingface_hub 2.4.0 with its hf CLI, skopeo 1.24.1 and the registry:3 image.
Staging machine:
- Python 3 with
pip install huggingface_hub, which provides thehfcommand, sha256sumfrom GNU coreutils,- Docker or skopeo for exporting images,
- optionally
pip install model-signingfor signature checks.
Target server:
tarwith zstd support andsha256sum,- Docker or another OCI runtime to host the internal registry,
- enough disk: on Linux, models live in
/usr/share/ollama/.ollama/modelsby default, and the Ollama FAQ explains how to move them withOLLAMA_MODELS.
Also name the person who signs off each transfer. Without an owner, the transfer point quietly turns into a shared drop folder.
Step 1: Fetch pinned binaries and model files on the staging machine
Only fetch artefacts with a fixed identity: a specific Ollama release and a model at a recorded commit. "Latest" is not a usable state in an air gap, because later you cannot say what actually went across. Pinning is what makes the audit trail meaningful.
Each Ollama release ships Linux archives plus a sha256sum.txt, for example on the v0.40.15 release page. The install script fetches components at run time, so it is no use on the isolated side.
# one working directory per transfer
mkdir -p transfer-2026-11 && cd transfer-2026-11
VER=v0.40.15
BASE=https://github.com/ollama/ollama/releases/download/$VER
curl -fLO "$BASE/ollama-linux-amd64.tar.zst"
curl -fLO "$BASE/sha256sum.txt"
For the model, use hf download with --revision. The CLI guide accepts a commit hash, branch or tag; use the commit hash, because it is the only one that cannot move. --include and --exclude add pattern filters if you only need part of a repository.
# set these yourself: repository id and commit hash
REPO="<organisation>/<model>"
REV="<commit-hash>"
hf download "$REPO" --revision "$REV"
Ollama usually needs a single GGUF file. Transformers-based servers need the folder of safetensors shards plus configuration and tokenizer files.
Step 2: Verify integrity and provenance
Keep two questions apart: did the file arrive unchanged, and did it come from a publisher you trust? Checksums answer the first, signatures or a documented source the second. On top of that, rule out file formats that can run code when they are loaded.
Check the Ollama archive against the published checksum first:
# check only the line for the archive you downloaded
grep ' ollama-linux-amd64.tar.zst$' sha256sum.txt | sha256sum -c -
For models in the Hugging Face cache, hf cache verify compares local files with the checksums on the Hub, as described in the cache guide. Then copy the verified snapshot into the transfer folder as real files, with symlinks resolved:
hf cache verify "$REPO" --revision "$REV"
SNAP=$(ls -d ~/.cache/huggingface/hub/models--*/snapshots/"$REV")
cp -rL "$SNAP" ./model
Format matters as much as integrity. Pickle-based weights (.bin, .pt, .pkl) can execute arbitrary code on load; Hugging Face walks through the mechanism on its pickle scanning page. The safetensors format is an 8-byte length field, a JSON header and a byte buffer, nothing more. Make it policy that only safetensors or GGUF cross the gap, and strip everything else before the manifest is written:
# drop pickle formats from the transfer folder
find ./model -type f \( -name "*.bin" -o -name "*.pt" -o -name "*.pth" -o -name "*.pkl" \) -print -delete
Where the publisher signs releases, verify the signature. The sigstore/model-transparency project provides the model_signing tool, which supports plain public keys as well as Sigstore:
model_signing verify key ./model --signature model.sig --public-key publisher.pub
Many public models are not signed. In that case, record that only integrity against the Hub was checked, along with the repository and commit.
Step 3: Write a checksum manifest and package the transfer
The manifest is the core document of the transfer: every file with its SHA-256 hash, generated after verification and before copying. The isolated side checks exactly this list. One mismatch or one missing file, and the bundle goes back to staging.
# manifest over all transfer files, excluding itself
find . -type f ! -name MANIFEST.sha256 -print0 \
| sort -z | xargs -0 sha256sum > MANIFEST.sha256
wc -l MANIFEST.sha256
Add a short human-readable record next to it. In our own operations a plain structure like this has proved enough:
transfer: 2026-11-06-01
approved_by: name of the approver
artefacts:
- file: ollama-linux-amd64.tar.zst
source: https://github.com/ollama/ollama/releases/tag/v0.40.15
check: release sha256sum.txt
- file: model/
source: Hugging Face repository and commit hash
check: hf cache verify, safetensors only
signature: none published
Then copy the folder to the media. If your organisation already runs internal signing, sign the manifest as well, so the isolated side can confirm who produced it.
Step 4: Export container images for the transfer
Export images as archives and load them into an internal registry on the isolated side, so every server pulls from one place instead of passing tarballs around. Two tools work well: docker image save, or skopeo, which needs no running daemon and, for most operations, no root.
With Docker, restricted to one platform as shown in the docker image save reference:
docker pull registry:3
docker image save --platform=linux/amd64 -o registry-3.tar registry:3
skopeo can mirror whole repositories into a directory, as in the skopeo README:
skopeo sync --src docker --dest dir registry.example.com/busybox /media/usb
Ship the registry image itself in the first transfer, otherwise the isolated side has nowhere to put the rest. Regenerate the manifest from Step 3 afterwards so the archives are covered.
Step 5: Verify and install inside the isolated network
On the isolated side the process runs in reverse: check the manifest first, install second. If even one line fails, install nothing. Only when every entry reports OK do you move on to Ollama, the model import and the registry.
cd /mnt/transfer-2026-11
sha256sum -c --quiet MANIFEST.sha256 && echo "manifest OK"
Install Ollama from the archive. The Linux docs extract into /usr and advise removing /usr/lib/ollama first when upgrading:
sudo rm -rf /usr/lib/ollama # upgrades only
sudo tar --zstd -x -C /usr -f ollama-linux-amd64.tar.zst
ollama -v
Import the model with a Modelfile. Per the import docs, FROM points either at a GGUF file or at a directory of safetensors weights, and GGUF files are not quantised during import.
cat > Modelfile <<'EOF'
FROM ./model/model.gguf
EOF
ollama create internal-model -f Modelfile
ollama list
Start the registry from the transferred image and push into it, following the Distribution deployment guide:
docker load -i registry-3.tar
docker run -d -p 5000:5000 --restart=always --name registry \
-v /srv/registry:/var/lib/registry registry:3
docker tag my-image:1.0 localhost:5000/my-image:1.0
docker push localhost:5000/my-image:1.0
If other hosts need to reach the registry, put TLS in front of it; the Distribution guide describes unverified certificates as "for testing only".
Testing: does everything really run offline?
A transfer is only finished when the model answers and nothing tries to reach the outside world. Test behaviour on the network, not just functionality. For Hugging Face tooling, HF_HUB_OFFLINE=1 forces cache-only operation, so a missing file fails loudly instead of hanging on a timeout.
# the imported model should answer
ollama run internal-model "Reply with exactly one word: ready"
# Hugging Face tools: cache only
export HF_HUB_OFFLINE=1
According to the Hugging Face environment variable reference, with this variable set huggingface_hub makes no HTTP calls and raises an error when a file is not cached. That is the behaviour you want: a missing tokenizer surfaces immediately. Also check your firewall logs for any outbound connection attempts from the new hosts.
Operations, security and limits
This process protects against corrupted or swapped files and against code hidden in pickle weights. It does not protect against a model that is already flawed at the source, for example through poisoned training data. Only a deliberate choice of publishers and your own task-specific tests before approval address that.
Points for ongoing operation:
- Every update is a new transfer. New Ollama versions and new models go through the same steps with their own manifest.
- Permissions. If you move the model directory, the Ollama FAQ notes that the
ollamauser needs read and write access to it. - Network binding. Ollama listens on
127.0.0.1:11434by default; if you open it to other hosts, put authentication in front of it. - Retention. Keep manifests, transfer records and verification output in an archive that outlives the server.
When this approach does not fit: if models change weekly or many teams need their own variants, a manual transfer point becomes a bottleneck. At that scale a data diode or an automated mirror with fixed acceptance rules is worth the investment.
Next steps
Once the first transfer is through, turn it into a routine: a script for Steps 1 to 3, a fixed location for manifests, and a rule for who may approve which sources.
After that, look at day-to-day operation, covered in running self-hosted AI over time, and at the choice of serving stack in the overview of Ollama, vLLM and llama.cpp.
How data residency, model choice and operation without a cloud provider fit together is the subject of sovereign AI. For the architecture decision that comes before all this, the air-gapped AI overview is the right starting point; this article adds the concrete path files take across the gap.
Frequently asked questions
How do I install Ollama without internet access?
Download the Linux archive and the release's sha256sum.txt from GitHub on a connected machine, verify the checksum, and extract the archive into /usr on the target. Models are then imported with a Modelfile instead of ollama pull.
Why insist on safetensors rather than .bin or .pt files?
Pickle-based weight files can run arbitrary Python code when loaded. A safetensors file is just a JSON header plus a raw byte buffer, so loading it does not execute code.
Is a SHA-256 checksum enough?
A checksum proves the file was not altered in transit. It does not prove who produced it; for that you need a publisher signature or a documented source pinned to a specific commit.
How do I stop Hugging Face libraries from calling home on the isolated side?
Set HF_HUB_OFFLINE=1. huggingface_hub then makes no HTTP calls, reads only from the local cache, and raises an error if a file is missing.
Sources
- Ollama: Linux manual install docs.ollama.com
- Ollama: Importing GGUF and Safetensors models docs.ollama.com
- Ollama FAQ: model storage, OLLAMA_MODELS, OLLAMA_HOST docs.ollama.com
- Ollama release v0.40.15 with sha256sum.txt github.com
- Hugging Face: the hf CLI and hf download huggingface.co
- Hugging Face: cache layout and hf cache verify huggingface.co
- Hugging Face: environment variables, HF_HUB_OFFLINE huggingface.co
- Hugging Face: Pickle scanning and why pickle is dangerous huggingface.co
- safetensors: format and safety properties github.com
- sigstore/model-transparency: Model Signing github.com
- Docker: docker image save docs.docker.com
- skopeo: copy and sync images without a daemon github.com
- CNCF Distribution: deploying a registry distribution.github.io