keepcalculator

06 Numbers and Powers

How to Run Ollama on Multiple Computers

Card No. 06·63582 · Updated · Standard formula, shown below

This guide shows you how to use Ollama to run local AI models across multiple computers on your network. You’ll learn how to share models between machines, offload heavy workloads to a more powerful PC, and access your AI from any device—without sending data to the cloud. We’ll cover the basic setup, a simple network configuration, and advanced options like using a dedicated server.

What You’ll Need

  • Two or more computers (Windows, macOS, or Linux) on the same local network.
  • Ollama installed on each machine. Download it from ollama.com.
  • Basic familiarity with the command line (Terminal on macOS/Linux, Command Prompt or PowerShell on Windows).
  • Sufficient disk space for the models you want to share (models range from ~4 GB to over 40 GB).
  • Optional: a router that allows device-to-device communication (most home routers do by default).

Step-by-Step

  1. Install Ollama on each computer. Download the installer from the official site and run it. On Linux, you can use the provided script. After installation, verify it works by running ollama --version in your terminal.
  2. Pull a model on the machine that will host it. Decide which computer will store the model files (the “server”). On that machine, run ollama pull llama3.2 (or any model name from the Ollama library). This downloads the model locally.
  3. Test the model locally. Run ollama run llama3.2 on the server to confirm it works. Type a simple prompt like “Hello” and press Enter. Exit with /bye.
  4. Make the server listen on the network. By default, Ollama only listens on localhost. To allow other computers to connect, you need to set the environment variable OLLAMA_HOST to 0.0.0.0 (or a specific IP).
    • Windows: Open System Properties > Environment Variables, add a new user variable named OLLAMA_HOST with value 0.0.0.0, then restart Ollama (or reboot).
    • macOS/Linux: In your terminal, run export OLLAMA_HOST=0.0.0.0 before starting Ollama. For a permanent setup, add that line to your shell profile (e.g., ~/.bashrc or ~/.zshrc).
  5. Restart Ollama. After changing the environment variable, you must restart the Ollama service. On Windows, right-click the Ollama tray icon and select “Quit”, then start it again. On macOS, click the menu bar icon and choose “Quit”, then reopen. On Linux, if running as a systemd service, use sudo systemctl restart ollama.
  6. Find the server’s IP address. On the server machine, run ipconfig (Windows) or ifconfig/ip addr (macOS/Linux). Look for the IPv4 address on your local network, e.g., 192.168.1.50.
  7. Connect from another computer. On a client machine, set the OLLAMA_HOST environment variable to point to the server’s IP and port (default 11434). For example, export OLLAMA_HOST=192.168.1.50:11434 (macOS/Linux) or set it in Windows environment variables.
  8. Run the model from the client. Now run ollama run llama3.2 on the client. Ollama will connect to the server and run the model there, but you interact with it locally. If the model isn’t already present on the client, it will use the server’s copy.
  9. Optional: Use a dedicated server. If you have a powerful PC, you can set it up as a headless server (no monitor). Install Ollama, set OLLAMA_HOST=0.0.0.0, and keep it running. All other computers can then connect to it. You can even create a systemd service on Linux to auto-start Ollama.
  10. Optional: Share models between peers. If you want to run a model on any machine without a central server, you can manually copy the model files. Models are stored in ~/.ollama/models (macOS/Linux) or C:\Users\\.ollama\models (Windows). Copy the entire models folder to the other machine, then run ollama pull to verify. This is useful for offline setups.

Common Mistakes

  • Forgetting to set OLLAMA_HOST on the server. If you don’t set it to 0.0.0.0, the server only listens on localhost, and clients will get a connection refused error.
  • Not restarting Ollama after changing environment variables. The change won’t take effect until the service restarts.
  • Using the wrong IP address. Make sure you use the server’s local network IP, not its public IP or localhost.
  • Firewall blocking port 11434. Windows Firewall or macOS/Linux firewalls may block incoming connections. You need to allow port 11434 for Ollama.
  • Assuming all models are compatible. Some models may require more memory than the server has, causing slow performance or crashes.

Tips

  • Use a wired connection for the server to reduce latency and improve stability.
  • Set a static IP for the server so clients don’t lose connection when DHCP reassigns addresses.
  • Monitor resource usage with ollama ps to see which models are loaded and how much memory they use.
  • Use the OLLAMA_MODELS environment variable to change where models are stored, useful if you have a large secondary drive.
  • For multi-user setups, consider using a reverse proxy like nginx to handle HTTPS and authentication, but this is advanced.

Troubleshooting

Connection refused – This usually means the server isn’t listening on the network. Check that OLLAMA_HOST is set correctly and that Ollama is running. On the server, run netstat -an | grep 11434 (or netstat -an | findstr 11434 on Windows) to see if it’s listening on 0.0.0.0:11434.

Timeout or slow response – The server may be overloaded or the network is slow. Check the server’s CPU/RAM usage. Reduce the number of concurrent requests. Also, ensure the client and server are on the same subnet.

Model not found on client – When you run ollama run modelname, the client will try to pull the model from the server. If it fails, you may need to manually copy the model files as described earlier.

Firewall issues – On Windows, you may see a prompt to allow Ollama through the firewall. Accept it. On macOS, go to System Settings > Network > Firewall and allow Ollama. On Linux, use sudo ufw allow 11434 if using UFW.

Environment variable not working – If you set OLLAMA_HOST in a terminal, it only applies to that terminal session. For a permanent change, set it in your system environment variables or shell profile.

Frequently Asked Questions

Can I use Ollama across computers on different networks (over the internet)? – Yes, but you’d need to expose the server to the internet, which is risky without proper security. It’s safer to use a VPN like Tailscale or WireGuard to create a private network.

Do all computers need to have the model downloaded? – No. If the server has the model, clients can run it remotely without downloading it. However, clients need the model if the server is offline.

Can I run different models on different computers and access them all from one machine? – Yes, you can set OLLAMA_HOST to different servers for different terminal sessions, or use a script to switch between them. Ollama doesn’t natively support multiple servers in one UI, but you can use the API directly.

What are the minimum specs for the server? – It depends on the model. For a 7B parameter model, you need at least 8 GB RAM and a decent CPU. For larger models like 70B, you’ll need 64 GB+ RAM or a powerful GPU.

Is it safe to expose Ollama to my local network? – Generally yes, but anyone on your network can access it. If you have untrusted devices, set up a firewall rule to only allow specific IPs.

Can I use Ollama with Docker to simplify multi-computer setup? – Yes, Ollama has an official Docker image. You can run it in a container with -p 11434:11434 and set the same environment variables. This can make deployment easier, especially on Linux servers.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →