Advanced 11 minHardening

Air-gap your machine of inference

Direct response

Air-gapping an inference machine means cutting it off from all network connections (wired, Wi-Fi, and Bluetooth) and allowing models and updates to enter only through controlled physical media. An outbound firewall is a useful layer, but it isn’t an air gap: it’s only a software configuration. The real weak points are software that calls out (Ollama Cloud, updates, downloads) and the USB drive.

The word “local” is not enough for some sensitive contexts: a local machine remains connected, and its software may contact the outside world. This guide distinguishes true air-gapping from firewall-based isolation, lists the components of an LLM stack that call out by default and how to disable them, describes transferring models by USB drive with fingerprint verification, and proposes leak-proofing tests you can rerun.

By Mohamed Meguedmi·Update 2026-09-30·Tested on Windows, macOS, and Linux

#When an air gap is justified—and when it costs too much

An air gap should be decided through a risk analysis, not as a matter of principle. Cases where it is justified include classified data or data covered by a high-level trade secret, contractual or sector-specific requirements that explicitly mandate an isolated network, environments that already use isolation and where the LLM must be integrated, and workstations dedicated to exceptionally sensitive files (a lawyer, a researcher). For ordinary personal data, including health or financial data, regulations call for measures proportionate to the risk rather than total isolation: a local LLM on an encrypted workstation, without a cloud account, already meets most needs. The guide to local AI in the enterprise and the privacy checklist cover this middle ground.

!
The real cost
Every update, every model, and every document passes through a physical medium and a protocol. An air-gapped machine that is never updated accumulates vulnerabilities; a machine whose protocol is too burdensome eventually gets bypassed by its users. Plan who handles the transfers, how often they occur, and how they are verified.

Before you get started, ask three questions. Who will handle the transfers, and how often? Which components does the stack require us to update (Ollama, llama.cpp, the interface, the models)? And what happens when a newer model becomes essential: the process must remain practical without exceptions, because an exception made once becomes the rule. If you cannot answer these three questions, start with an offline workstation per use case and a strict firewall, and move up a level only when the risk justifies it.

#Air gap, near-air gap, and firewall: don't confuse them

The AI at Work Kit

Deploy local AI at work: privacy, compliance, multi-user architecture, costs, the one-page memo for leadership.

  • Lifetime online access
  • PDF + files
  • Lifetime updates
Three levels of isolation
TierWhat it isWhat remains possible
Machine kept offline by designNo active connection, but the network card is presentA mistaken or software-triggered reconnection; it all depends on discipline
Strict firewall (deny by default, including outbound traffic)Software configuration that blocks outbound trafficA rule added “just to try it,” a system flaw, a service that bypasses
Physical air gapNo active network interface: cable disconnected, Wi-Fi and Bluetooth disabled in firmware or removedLeaks through removable media; physical channels (outside this guide's scope)

This guide covers all three: the firewall is the minimum layer every sensitive workstation should have, and a physical air gap is the top layer. On a Mac, macOS-specific settings belong in the guide to optimizing Macs with Apple chips; under Windows, the principles are the same, but control over components that call out is less granular than with a minimal Linux system, hence the preference here for Linux.

#Prepare the machine

Minimum system
Debian or Ubuntu Server without a graphical interface for an inference server. No browser, no package manager connected to an app store.
Automatic update services
Disable update timers, for example sudo systemctl disable --now apt-daily.timer apt-daily-upgrade.timer, so that no connection attempt is made silently.
Accounts
An account dedicated to LLM use, with sudo restricted to the administrator.
Radios and interfaces
Wi-Fi and Bluetooth disabled in the BIOS or firmware; better yet, physically absent. No network cable connected.
No double startup
A connected partition alongside it creates indirect paths (swap file, shared files).
Time
Set the clock manually or from an internal source: synchronization with a public time server is outbound traffic.
Encrypted disk
An isolated workstation can be stolen or seized: encrypt the disk (see the dedicated guide).

#LLM stack software that makes outbound calls by default

For a physically isolated machine, these calls fail harmlessly; for a machine protected only by a firewall, or one awaiting disconnection, they are the real risk. A typical local stack contains several components that contact the Internet unless prevented from doing so. Here are the ones the official documentation allows you to disable.

Components that contact the outside world and their switch
ComponentWhat it can doDocumented setting
OllamaHosted models and web search (Ollama Cloud)OLLAMA_NO_CLOUD=1 or disable_ollama_cloud in ~/.ollama/server.json; the logs then show “Ollama cloud disabled: true”
Ollama (network exposure)Local HTTP serverListens on 127.0.0.1 by default; change OLLAMA_HOST only for an isolated internal network
Open WebUIUpdate checks, downloading embedding models from Hugging FaceOFFLINE_MODE=true (also disables ENABLE_VERSION_UPDATE_CHECK); download the embedding models first
Hugging Face libraries (transformers, sentence-transformers)Hub calls to verify or downloadHF_HUB_OFFLINE=1: no HTTP calls to the Hub; only cached files are used
Vector databasesPotential telemetryWeaviate: DISABLE_TELEMETRY=true; check the equivalent option for each component

The Ollama documentation specifies that when using Ollama locally, the vendor sees neither the requests nor the data; disabling cloud features removes access to hosted models and web search, which is exactly the point. Be careful with Open WebUI: the documentation warns that if you have not downloaded an embedding model before enabling OFFLINE_MODE, RAG, web search, and document analysis features may not work. Download everything the machine will need before taking it offline.

→
Tools, agents, and web research
A local LLM connected to tools (web search, URL readers, remote MCP servers) can itself send requests externally. On an isolated machine, disable or do not install these tools: it is not the model that goes out, but the tool you give it.

#Strict firewall: deny by default, inbound and outbound

The firewall is the second line of defense, after physical disconnection, and the only protection on a workstation that remains on an internal network. The principle is deny by default in both directions, with a few explicit permissions to the isolated internal network. Write the allow rules before enabling the firewall; otherwise, you'll cut yourself off from an SSH session.

ufw: deny by default, internal network allowed
sudo ufw default deny incoming
sudo ufw default deny outgoing

# Réseau interne isolé (exemple), y compris l'administration SSH depuis un poste connu
sudo ufw allow in from 192.168.50.0/24 to any port 22 proto tcp
sudo ufw allow out to 192.168.50.0/24

sudo ufw enable
sudo ufw status verbose

Traffic on the local interface (loopback) is required for Ollama and Open WebUI, which communicate over 127.0.0.1; check with ufw status verbose that your configuration does not block it. If the machine is on an internal LAN, add protection at the router as well: a VLAN with no route to the Internet.

#Check what Ollama is listening on

Listening ports
sudo ss -tlnp | grep ollama
# attendu : 127.0.0.1:11434 et non 0.0.0.0:11434
# si 0.0.0.0 : régler OLLAMA_HOST=127.0.0.1:11434

#Transfer models and updates by USB drive

An isolated machine receives models (from a few GB to several dozen), updates (Ollama, llama.cpp, Open WebUI), and sometimes documents. The critical point is the USB drive: it’s the only door, and therefore the only entry point for malware. Always use the same dedicated drive, format it regularly, and never use a drive that has been used elsewhere.

  1. 01
    Download on a connected machine
    Retrieve the model's GGUF file from Hugging Face or the update binary from the official website. Record the SHA-256 fingerprint displayed by the source when available.
  2. 02
    Calculate the fingerprint and analyze
    Run sha256sum on the file, then pass it to an antivirus (such as ClamAV) on this transit machine, which is not the isolated machine.
  3. 03
    Copy to the USB drive
    Copy the file and a text file containing its hash.
  4. 04
    Check on the isolated side before use
    On the isolated machine, recalculate the hash: it must be identical. A difference means a file was modified or corrupted: do not use it.
  5. 05
    Import into Ollama
    Create a Modelfile with FROM /chemin/vers/modele.gguf and then ollama create nom-du-modele -f Modelfile. Ollama does not quantize a GGUF during import: the file must already have the desired quantization.
Model fingerprint and import
# machine de transit
sha256sum modele-q4_k_m.gguf > modele.sha256

# machine isolée
sha256sum -c modele.sha256
printf 'FROM ./modele-q4_k_m.gguf\n' > Modelfile
ollama create mon-modele -f Modelfile
ollama run mon-modele

The alternative method is to copy the entire model directory from a connected machine (blobs and manifests) to the isolated machine. It works, but the directory is in a different location depending on the installation: the Ollama FAQ gives ~/.ollama/models on macOS, /usr/share/ollama/.ollama/models on Linux with the standard installer, and C:\Users\%username%\.ollama\models on Windows. Using an isolated GGUF file is easier to verify because there is only one fingerprint to compare. The guide on import GGUF provides details on the Modelfile.

#Harden the USB port

A USB key can masquerade as a keyboard or another device. On Linux, USBGuard can be described in one sentence as a USB device allowlisting tool: it defines which types of devices are authorized and how they can interact with the system. Also disable automatic media mounting so that nothing runs when connected. In highly sensitive contexts, a data diode (a device that allows data to pass in only one direction) replaces the USB key, at the cost of a more complex setup.

#Test isolation

A test proves airtightness only for the period it observed: repeat it after every update and let the capture run through a complete work session. The minimum protocol covers operation, no routing, no name resolution, and actual traffic.

Offline operation
Unplug the cable and turn off all radios, then run the full pipeline (model, RAG, interface). Everything should work; otherwise, a component depended on the Internet.
No route
ping -c 1 8.8.8.8 should fail (“Network is unreachable” or equivalent).
No DNS
host example.org must fail; check /etc/resolv.conf: no external server.
Established connections
sudo ss -tunp state established : aucune connexion vers une adresse hors du réseau interne.
Real-world traffic
A tcpdump capture on all interfaces, excluding the internal network, must remain empty throughout an entire usage session.
Control capture
# rien ne doit apparaître (hors loopback et réseau interne)
sudo tcpdump -i any -n 'not (host 127.0.0.1 or host ::1) and not (net 192.168.50.0/24)'

#Regular audit

Suggested check-in cadence
FrequencyControlObjective
Monthlyufw status verbose and list of rules; ss -tlnpIdentify a rule added “just to try it”
With every transferFingerprints before and after the key; antivirus scanningDetect a modified file
With every component updateRerun the leak-tightness tests and reread the offline variablesA new component can add an outbound call
Semiannual or annualClean reinstallation from verified images; threat reviewEliminate an accumulated compromise

#Frequently asked questions about air-gapping an LLM machine

FAQ
Is an outbound firewall enough to qualify as an air gap?+
No. A firewall is a software configuration: one forgotten rule, vulnerability, or service that bypasses it is enough to open an outbound path. An air gap assumes the physical absence of any network connection. A firewall remains a good second line of defense, and the only protection when the machine must remain on an internal network.
How do you update Ollama on a machine without Internet access?+
Download the program on a connected machine from the official source, calculate its hash, analyze it, copy it to a dedicated USB drive, recalculate the hash on the isolated machine before installation, and then install it manually. Next, rerun the containment tests and verify that cloud features remain disabled.
How do you transfer a model to the isolated machine?+
The simplest option is an already-quantized GGUF file: download it, calculate its SHA-256, copy it to the drive, recalculate the checksum on the isolated side, then create the model with a Modelfile and ollama create. Copying the model directory also works, but its location varies by system.
Does Ollama send my requests outside?+
According to the Ollama documentation, local operation sends neither queries nor data to the vendor. Cloud features (hosted models, web search) are optional and can be disabled with OLLAMA_NO_CLOUD=1 or a setting in server.json. On a sensitive machine, disable them explicitly and check the message in the logs.
Is the USB drive the weak link?+
It is the only entry point, so it receives the most scrutiny. Use a dedicated key, disable automatic mounting, compare SHA-256 fingerprints before and after the transfer, and consider USBGuard to allow only expected devices. A data diode is the superior solution if the constraints justify it.
Should you encrypt the disk of an already isolated machine?+
Yes. Network isolation does not protect against theft or seizure of the machine: an unencrypted disk can be read as soon as it is connected elsewhere. Encrypt the system disk, back up the recovery key off the machine, and follow the same discipline for backups.
Did this guide help you?

Feedback, an error, or a clarification? Let us know—it improves the guide for everyone.