Exposing Ollama on a network: what changes when OLLAMA_HOST moves off localhost
Changing OLLAMA_HOST changes who can send requests to your model server, not only where the server listens. By default Ollama binds to 127.0.0.1 on port 11434, so only processes on the same machine can reach it. The local API at localhost:11434 does not require authentication, which means any client that can open a connection to that address can generate text, pull models and read what is installed. When a team needs a shared Ollama server for internal applications, a group of workstations or a pilot for several departments, the bind address has to move. The question for this section is how to make that move without handing unauthenticated access to everyone on the network.
Before you change the setting, decide who the legitimate clients are and where they sit. List each application, workstation subnet and admin host that needs access, and note whether any of them run outside your office network, in a VPN segment or in a separate cloud account. Then pick a private interface address for the server, not 0.0.0.0, so the service is reachable only on the network segment you intend. Confirm the exact variable syntax and any default port behavior against the Ollama FAQ for the release you deploy, and test the new binding from a machine outside the allowed list to confirm it is refused.
Binding to a private address is a reachability control, not an access control. Any allowed client still gets full API access, so the host firewall should admit port 11434 only from the specific source addresses or subnets you listed, with all other inbound traffic dropped. The stronger pattern is to keep Ollama bound to localhost and place a reverse proxy or gateway in front of it that enforces authentication, TLS and request logging before any remote client connects. Ollama's own documentation describes proxy-based exposure, and the Ollama API authentication docs confirm that the local API itself carries no login. Plan the proxy and firewall together, and verify both with a test from an unauthorized host before go-live.
Bind address options for OLLAMA_HOST and when each fits
This table compares four ways to set the bind address for Ollama's API on port 11434. Ollama's documented default is 127.0.0.1 on port 11434, and OLLAMA_HOST changes that bind address. Read each row for who can connect, what authentication Ollama itself applies, and the main risk, because the local API does not require authentication.
| Bind option | Who can connect | Ollama-layer authentication and main risk | Typical use |
|---|---|---|---|
| Keep the default 127.0.0.1 | Only processes on the same host | None required by the local API. Risk is low, but no other machine can use the server. | Single-user workstation or a tool running on the same host |
| Specific private interface address | Hosts on the network segment that reaches that interface | None at the Ollama layer. Any client on that segment can send requests, so segment membership becomes the access control. | Shared server for a known internal subnet with tight network boundaries |
| All interfaces with firewall restriction | Any host that can reach the server's addresses, limited by firewall rules | None at the Ollama layer. A single misconfigured rule or a routed network path exposes the unauthenticated API. | Lab or internal server where the host firewall is managed and tested |
| All interfaces behind a reverse proxy or gateway | Only clients the proxy or gateway admits, after its own checks | Authentication is enforced by the proxy or gateway. Confirm Ollama is not reachable directly from other hosts. | Shared multi-user service that needs login, TLS and access logging |
How client requests reach Ollama through a proxy and firewall
The diagram starts with internal clients and outside users, who both pass through the firewall first. Requests from outside the host are accepted only at the reverse proxy or gateway, which enforces authentication before forwarding anything. The Ollama API listens on a private interface and accepts connections only from the proxy and the host itself, so the trust boundary sits in front of the API, not inside it. Check that no path to port 11434 exists from the outside network.
Only the proxy or gateway reaches the Ollama API, behind the firewall.
What an unauthenticated Ollama API exposes when it leaves localhost
Ollama's local API at port 11434 has no authentication of its own, so anything that reaches the port inherits full use of the server. The cards below separate the risks that follow from that gap: inference access, model management, capacity exhaustion, data in transit, browser access and cloud-linked settings.
Anyone reaching the port can run inference
The local API at port 11434 does not require authentication. Any client that can reach the listening address can send prompts and receive completions, which means every user of the network segment shares the server's GPU, memory and model budget. Before changing the bind address, list which subnets, VPN pools and jump hosts can open a connection to the port, and confirm that none of them are broader than the intended user group.
Ollama API authenticationRemote clients can manage models
The API is not limited to generating text. Clients that reach it can also work with the models held on the server, so an open endpoint can change what the server holds and runs, not just how it is used. Treat the model store as a controlled asset: restrict who can reach the management paths, and check the API reference for your installed version to confirm exactly which operations are exposed before you rely on network controls alone.
Requests can exhaust shared capacity
Ollama queues requests and runs a limited number in parallel. The defaults are one parallel request per model and 512 queued requests, so a single heavy client can hold the server for everyone else, and a flood of requests can fill the queue. Set OLLAMA_NUM_PARALLEL, OLLAMA_MAX_LOADED_MODELS and OLLAMA_MAX_QUEUE deliberately for the expected load, and decide what your gateway does with requests that arrive while the queue is full.
Prompts and outputs cross the network
Once the API is reachable from other hosts, every prompt and every completion travels over the network between the client and the server. Plain HTTP exposes that content to anyone able to observe the traffic on the path. Decide which segments carry this traffic, keep them inside controlled networks, and place TLS termination at a proxy or gateway if traffic leaves a trusted segment. Confirm this with your network team, since the Ollama port itself does not provide it.
Browser origins depend on OLLAMA_ORIGINS
Browsers block cross-origin requests to the API unless the server allows the requesting origin. Opening the server to the network does not by itself make it reachable from web pages, but loosening OLLAMA_ORIGINS does, and a wildcard value lets any site a user visits send requests to the server from that user's browser. Set the variable to the exact origins you need, and test cross-origin behavior after each change.
Check cloud-linked settings before exposure
Ollama offers cloud features, and direct cloud inference uses an API key sent as a Bearer token. A server opened to a network should be checked for cloud features that are enabled, since they send requests beyond your hardware. Set OLLAMA_NO_CLOUD=1 or the server configuration file if local-only operation is required, then confirm the setting in the server logs and verify that no API key is stored where other users can read it.
Setup sequence for binding Ollama to a private interface
This sequence moves a local-only Ollama service onto a private network address and limits port 11434 to the proxy or approved subnets, with a check at each stage. The result is a server that answers only on the intended path and can be audited before any user connects.
Inventory the clients and their networks
Before changing anything, the platform owner lists every client that must reach Ollama, such as application servers, a reverse proxy, developer workstations or a gateway, along with the subnet or host each one sits on. Anything not on this list should be treated as unapproved. Write the list down and have the network team confirm the subnets. Done when each client has a named source, a reason for access and a network range, and the owner can state which single path (direct or via proxy) each one will use.
Choose the private interface address
Identify the host interface on the internal network that the approved clients will use, and record its IPv4 address. Avoid public addresses and any interface that faces untrusted segments. If the host has several interfaces, confirm with the network team which one routes to the approved subnets. Check the result with the ip address command on Linux or the equivalent on your operating system, and confirm that the address responds to ping from one approved client. Done when the address is written in the change record and reachable from the intended source.
Set OLLAMA_HOST in the service configuration
Set the OLLAMA_HOST environment variable in the service definition, not in a user shell, so it survives reboots. On Linux with systemd this is usually a drop-in file created with systemctl edit ollama, which adds an Environment line containing the chosen private address and port 11434. Confirm the exact syntax against the Ollama FAQ for your installation method. Restart the service with systemctl restart ollama. Done when the service starts without errors in its logs and the configuration file shows the expected value.
Confirm the listening address on the host
Run ss -ltnp or netstat -ltnp on the host and check the local address for port 11434. It should show the private interface address, not 127.0.0.1 alone and not 0.0.0.0 unless you have decided that is intended. If it still shows the loopback address, the environment variable was not read, so check the service drop-in and the restart. Also confirm that the Ollama process is the one listening. Done when the listener matches the address recorded in step two and the service responds to a request from the host itself.
Add host firewall rules for approved sources only
Create firewall rules that allow TCP port 11434 only from the reverse proxy address or the approved subnets listed in step one, and drop everything else to that port. Apply rules with the tool your team already uses, such as nftables, firewalld or a cloud security group, and keep the default policy for inbound traffic restrictive. Also check whether any container runtime publishes the port separately, since that can bypass host rules you wrote. Done when the rule set is saved, survives a reboot and lists only the approved sources.
Verify the service is reachable only through the approved path
Test from an approved client, which should receive a response from the API, for example a request to the version or tags endpoint. Then test from a client outside the approved list and from any network segment that should not reach the host. Those requests should time out or be refused. Repeat the test through the reverse proxy to confirm the proxy path works. Record the results with timestamps. Done when approved requests succeed, unapproved requests fail, and the test evidence is stored with the change record.
Record the configuration and schedule a recheck
Save the final environment setting, firewall rules, listening address and test results in the server's configuration record, and note which owner is responsible for changes. Ask your team to confirm how often the listener and firewall rules will be reviewed, and whether configuration management will enforce them. Any new client should go through the inventory in step one before a rule is added. Done when the record is complete, the owner has signed off, and the next review is scheduled.
Exposing Ollama on a network behind a proxy, gateway or firewall only
When one Ollama host serves a single subnet, the simplest safe pattern is to bind the service to a private interface and let the host firewall decide who connects. Ollama binds to 127.0.0.1 on port 11434 by default, so moving it off localhost is an explicit change made with OLLAMA_HOST. The local API does not require authentication, which means anyone who can open a TCP connection to the port can run inference and list models. The firewall is therefore the only access control in this design.
- Bind to one private address: Set
OLLAMA_HOSTto the internal interface address rather than all interfaces, and confirm with a port scan from another subnet that the port is closed. - Restrict the source subnet: Allow TCP 11434 only from the client subnet or specific application hosts, and deny everything else by default.
- Keep administrative access separate: Use SSH or a management network for host administration, not the Ollama port.
- Check the listener after every restart: Confirm the bind address in the service configuration survived upgrades, since a package update can reset environment settings.
- Document the allowed clients: Keep a short list of permitted hosts with an owner for each, so new consumers are added deliberately.
What the firewall cannot do is tell one user from another or record who sent a prompt. Confirm with the network team whether host firewall rules are managed in configuration or by hand, and who approves changes to the allowed list.
The Ollama FAQ describes exposing the server through a proxy such as Nginx, and this is the common pattern when an organization already runs a reverse proxy with TLS, logging and access rules. Ollama keeps listening on a private address while the proxy accepts connections from users and forwards them. The proxy must enforce TLS for traffic that crosses the network, limit which paths and methods are forwarded, and log each request. It cannot add user identity to the Ollama API by itself unless it is configured to check credentials, because the upstream service accepts any request that reaches it.
- Terminate TLS at the proxy: Serve HTTPS to clients and keep the proxy-to-Ollama hop on a segment only the proxy can reach.
- Enforce authentication at the proxy: Use SSO or client certificates for interactive users and reject requests without valid credentials before they reach port 11434.
- Limit forwarded routes: Forward only the API paths your applications need, and block administrative or unused endpoints where the proxy can match them.
- Set request size and timeout limits: Model responses can be long, so set timeouts and body limits deliberately rather than copying defaults from another service.
- Log requests with a user identifier: Ensure proxy logs carry the authenticated identity, since the Ollama server logs will not show it.
Confirm with the proxy owner which authentication method they will enforce, whether streaming responses pass through unbuffered, and how long logs are retained.
An API gateway with its own identity controls adds per-consumer authentication, quotas and policy on top of network placement. The gateway authenticates the caller, applies routing and rate rules, and forwards only approved requests to the Ollama backend. The gateway is the only party that should hold a route to the Ollama port. Its identity controls govern access, but the gateway configuration must still be reviewed, because a permissive route can expose the unauthenticated backend to everyone who can reach the gateway.
- Make the gateway the sole route: Block direct client access to the Ollama host so every request passes through the gateway policy.
- Map identities to routes: Tie consumer identities or API keys to specific models or endpoints where the gateway supports that mapping.
- Apply rate and size limits: Use gateway quotas to protect shared compute, since Ollama queues requests by default and its concurrency settings are per server.
- Review gateway-side logging: Confirm which fields are logged, including the caller identity and model requested, and where logs are stored.
- Test the bypass path: Attempt to reach the backend directly from user subnets after every change to routes or network rules.
Confirm with the gateway team which Ollama endpoints their policy engine can match, whether it can forward streaming responses, and how credentials are rotated. Confirm also who owns the decision to add a new route.
In an air-gapped or tightly restricted network, the concern shifts from who can reach the API to whether the host can reach anything it should not. Exposure is still limited to the internal segment, but the surrounding controls, such as blocked outbound traffic and approved model transfer, carry more weight. Ollama's cloud features reach external services, so the restricted environment must confirm that they are turned off or blocked at the network edge, and that model files arrive through an approved path rather than a live pull.
- Confirm cloud features are disabled: Check that
OLLAMA_NO_CLOUD=1or the server configuration file is applied, and verify it in the service logs. - Block outbound connections at the edge: Deny egress from the serving host so a misconfigured client or tool cannot send data out.
- Carry the front door inside the enclave: Use the same proxy or gateway pattern for the internal network, with the same authentication and logging requirements.
- Keep the allowed client list small: Restricted networks usually have fewer consumers, so each permitted host should have a named owner.
- Plan model and patch transfers: Define how release packages and model files cross into the enclave, and who signs off on them.
Confirm with the security team whether any exception for egress is allowed, how logs leave the enclave, and whether the chosen Ollama release has passed their internal review before it is deployed.
How to verify the exposure from outside the host
Verify the design from both sides of the network before anyone relies on it. Start on the Ollama host itself. Confirm that the listener is bound to the private interface you chose and not to 127.0.0.1 or 0.0.0.0 by accident, using the host's socket listing tool, and check that the OLLAMA_HOST value in the service definition matches what the running process reports. Then test port 11434 from a machine in each network that should be blocked, such as a guest VLAN or an internet-facing segment, and confirm that the connection fails at the firewall or the bind address. Repeat from an approved client network and confirm that only the proxy or gateway port answers, not the raw Ollama port. Keep the exact commands and their output with the date and the host name.
Test the proxy with and without credentials. An unauthenticated request to the proxy should be refused, and a request carrying the approved credential should succeed. Send both against the same model endpoint, record the HTTP status codes, and confirm that the proxy does not forward the request when the credential is missing. Check that the proxy also rejects a credential from an expired or revoked identity, because that is the case most often left untested. Confirm which requests the proxy logs, and whether the log records the caller, the path and the model name without storing prompt content you are not permitted to keep. Ask the team that owns the gateway to confirm this behavior in writing, since the Ollama API itself does not check credentials on the local port.
Check that inference stays on your hardware. A design that is correct on paper can still send requests to Ollama's cloud if a client uses a cloud model name or the server has cloud features enabled. Confirm that OLLAMA_NO_CLOUD is set to 1 or that the server configuration file disables cloud features, then request a cloud-tagged model from a test client and confirm it is refused. Scan the server logs for outbound requests to the cloud service during those tests. Keep the environment file, the service definition, the firewall rule set, the listener output, the proxy test results and the log excerpts together as one dated evidence pack for the reviewer, and rerun the full set after any change to the bind address, proxy, Ollama version or firewall.
Security and operational considerations for a networked Ollama server
Once OLLAMA_HOST moves off localhost, the server's security depends on the controls around it as much as on Ollama itself. The cards below cover the controls that need an owner, a record and a review: the authenticating proxy, transport encryption, patching, monitoring, change control and team boundaries.
Authenticating proxy and its logs
The local Ollama API does not require authentication, so the proxy or gateway in front of it is the only identity check most deployments will have. Confirm that every request reaches Ollama through the proxy, that the proxy rejects unauthenticated calls, and that it records the caller identity, path, model name and timestamp. Those logs are what you will use to answer who ran which model and when, so test that they are written and retained before go-live.
Ollama FAQTLS between clients and the proxy
Requests that cross the network carry prompts, responses and any credentials in the clear unless the proxy terminates TLS. Ask your security team which certificate authority issues the server certificate, how clients are configured to trust it, and how renewal is handled. Keep Ollama itself on a loopback or private address behind the proxy so the TLS endpoint is the only listener that clients reach.
Patching on a frequent release cadence
Ollama ships releases often, and the GitHub releases page shows that v0.40.5 was released on 14 October 2026 and v0.40.6 was published as a pre-release on 16 October 2026. Treat pre-releases as test candidates only. Set a written patch window, pin the version in your deployment, test the new build against your proxy rules and model list in a staging host, and keep the previous version available for rollback.
Ollama releasesMonitoring for unexpected sources
Because the API has no built-in access list, any host that can reach the port can send inference requests. Review proxy and firewall logs for connections from addresses outside the approved client ranges, for requests to models nobody approved, and for spikes in request volume. Alert on these patterns and assign someone to review them, so an unexpected caller is noticed within a set period rather than after an incident.
Change control for OLLAMA_HOST and firewall rules
The bind address and firewall rules define who can reach the server, so changes to them need the same review as other production access changes. Record the current value of OLLAMA_HOST, the allowed source ranges and the proxy listener in version control or a change ticket. Each change should name a reviewer, a rollback step and a test that confirms localhost-only and proxy-only reachability afterward.
Ollama FAQSeparate network and model ownership
The network team owns the firewall, proxy, certificates and logging, while the model team owns which models load, their versions and their configuration. Write down which team approves each kind of change and who can override it in an emergency. Clear boundaries stop a model update from opening a port, and stop a firewall change from breaking an approved model without the model team knowing.
Limits to confirm before exposing Ollama on a network
Before you change OLLAMA_HOST on a production server, confirm three things in your own environment: the Ollama version you run, what that version documents for the bind address you chose, and whether your proxy or gateway passes streaming responses through intact. The supplied documentation states that Ollama binds to 127.0.0.1 on port 11434 by default and that the bind address changes through OLLAMA_HOST, and it describes exposing the server through proxies such as Nginx. It does not give a complete guarantee of how every version and proxy setting behaves, so test the exact binary, service file and proxy configuration you will deploy. Pin the version you tested and record it, since Ollama ships frequent releases, including v0.40.5 on 14 October 2026 and a pre-release v0.40.6 on 16 October 2026. Check the Ollama FAQ and the release notes for your version before each upgrade.
Next, list every client that runs in a browser. Browser web apps and extensions are blocked by default, so each one that must reach the server needs an explicit entry in OLLAMA_ORIGINS. Keep that list narrow and confirm it with CORS tests after any change, because a wildcard origin on a networked server widens who can call the API from a user's browser. Also confirm that the streaming responses your applications depend on arrive token by token through the proxy. A proxy that buffers the response will look healthy in a status check but will break chat interfaces and other streaming clients.
Finally, decide whether a gateway is enough. The local API at localhost:11434 has no authentication, and the supplied documentation describes API key authentication only for direct calls to ollama.com. Ollama's Enterprise plan lists model access controls and cost budgets per user or API key, but the supplied material does not describe how those controls apply to a self-hosted server, so confirm that with Ollama before you rely on them. If you need per-user keys and budgets, a gateway such as LiteLLM may be the better fit, and that choice must be made before go-live. Have your security team sign off on the chosen design, the firewall scope and the owner of each control.
Questions teams ask before exposing Ollama on a network
How much work does a safe Ollama network exposure take?
The work is usually modest for one host behind an existing proxy and considerably larger when several client networks, new identity integration and formal testing are involved. The main drivers are the number of networks that need to reach the server, whether a reverse proxy or API gateway already exists, how users will authenticate, and how much testing the organization requires before go-live. A single private interface with one firewall rule set is a different job from a shared service with browser clients, several subnets and an audit expectation. Ask any provider to break its quote into those drivers so you can see which ones apply to your environment.
How long does it take to expose Ollama safely?
Duration depends on the same drivers as effort, plus how quickly your network, security and identity owners can review designs and approve changes. Most of the elapsed time often sits in change approval and firewall windows rather than in configuration. A team with a working reverse proxy and clear network ownership will move faster than one that must first agree on an authentication model. Ask for a timeline tied to named milestones, such as design review, staging tests, a retest after fixes and the production change window, rather than a single number.
What does our team need to provide before work starts?
Provide the inputs that let a designer make decisions without guessing:
- Network diagrams showing where the Ollama host sits, which subnets and VPNs need access, and where the firewalls and proxies are
- A named owner for each firewall, load balancer or proxy, and for the identity system that users sign in through
- A list of clients that will call the API, including web apps, IDE plugins, scripts and any browser-based tools
- The current Ollama version, operating system, and whether the host runs in a container or on a virtual machine
- Your security requirements for logging, retention and testing, so the scope reflects them
Missing owners are the most common cause of delay, because no one can approve the firewall or proxy change.
Can our internal team expose Ollama without outside help?
Yes, a capable internal team can do it, provided it has someone who understands Linux service configuration, firewall rules and reverse proxies, and who can test the result from outside the host. The core technical steps are small: set OLLAMA_HOST deliberately, keep the service on a private interface, restrict access at the firewall, and place an authenticating proxy in front. The harder parts are the decisions around them, such as how users authenticate, which origins browsers may use and how the setup is documented for auditors. Teams without that experience often find that the testing and evidence work takes longer than the configuration.
How does DeployOpen scope and price this work?
DeployOpen works on a fixed-scope basis. Before work starts, scope, deliverables and timelines are agreed in writing, and the quote follows from that written scope. In practice, the scope covers the networks and clients in play, the proxy or gateway to be built or reused, the identity integration, the testing to be performed and the documentation delivered. Ask for the scope document to list each item, so that changes after signature are handled as explicit scope changes. DeployOpen does not publish a price list.
Does a proxy alone make an Ollama server safe to expose?
No, a proxy reduces exposure but does not complete the design by itself. Ollama's local API at localhost:11434 does not require authentication, so anything that reaches the port without passing through the proxy can use it. The proxy must be the only path in, the Ollama port must be closed to other sources at the firewall, and the proxy must enforce authentication before any request reaches the server. Confirm these three points with a test from outside the network, because a configuration that looks correct on paper can still leave a bypass route.
What should we test before and after Ollama goes on the network?
Test from the position of an attacker and from the position of a legitimate client. Confirm that the Ollama port answers only on the intended interface, that unauthenticated requests are rejected at the proxy, that browser origins are limited to approved sites, and that model pulls and other administrative actions are restricted to the right users. Repeat the checks after every upgrade or proxy change, because configuration drift is common on shared servers. Ask whether the provider will perform the testing itself, how findings are reported and whether a retest after fixes is included in the written scope.
How DeployOpen works on this
DeployOpen plans and builds the network path to a self-hosted Ollama server inside infrastructure you control, starting from a written scope that names every client, subnet and proxy involved. We test the exposed endpoint before anyone outside the host connects, then hand over the configuration, firewall rules and runbook your team needs to operate it.
How we scope
- Inventory every application, user group and network segment that needs to reach the Ollama API
- Confirm which interface OLLAMA_HOST should bind to and which ports must stay closed
- Agree in writing whether a reverse proxy, gateway or SSO layer sits in front of the server
- Record which cloud features are in use or must stay off, based on your data rules
How we build
- Set OLLAMA_HOST and firewall rules so only approved source addresses reach port 11434
- Place a reverse proxy or gateway with authentication in front of any non-local access
- Narrow browser access with OLLAMA_ORIGINS and check CORS behavior after each change
- Test the exposed endpoint from inside and outside the approved network before go-live
How we hand over
- Deliver configuration files, firewall rule sets and proxy settings as documented, version-controlled artifacts
- Provide a test record showing which requests were allowed, denied and logged
- Document the runbook for changing bind addresses, adding clients and rotating credentials
- Walk your operations and security staff through the design and the rollback steps
How we support
- Engagements are fixed-scope, with scope, deliverables and timelines agreed in writing first
- Ongoing support, upgrades and continuous testing are available as a retainer
- Retest the exposure after Ollama version upgrades, proxy changes or new client onboarding
- Confirm with your own environment and vendor documentation before relying on any default setting

