[GH-ISSUE #3961] setting OLLAMA_HOST to 0.0.0.0 could make the API to listen on the port using IPv6 only #64489

Closed
opened 2026-05-03 17:50:03 -05:00 by GiteaMirror · 7 comments
Owner

Originally created by @TadayukiOkada on GitHub (Apr 26, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/3961

What is the issue?

Edit2: sorry, if you set BindIPv6Only, 0.0.0.0:11434 should use v4. so this shouldn't be a problem.

Edit: by default, it seems it'll listen on both v4 and v6. If you set BindIPv6Only in systemd.socket, or /proc/sys/net/ipv6/bindv6only is set to 1, it may not listen on v4.

Ollama is only listening on IPv6 with OLLAMA_HOST=0.0.0.0:

# netstat -anp | grep 11434
tcp6       0      0 :::11434                :::*                    LISTEN      5009/ollama

This seems to be the cause:
https://github.com/golang/go/issues/48723

OS

Linux

GPU

Nvidia

CPU

Other

Ollama version

0.1.32

Originally created by @TadayukiOkada on GitHub (Apr 26, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/3961 ### What is the issue? Edit2: sorry, if you set BindIPv6Only, 0.0.0.0:11434 should use v4. so this shouldn't be a problem. Edit: by default, it seems it'll listen on both v4 and v6. If you set BindIPv6Only in systemd.socket, or /proc/sys/net/ipv6/bindv6only is set to 1, it may not listen on v4. Ollama is only listening on IPv6 with OLLAMA_HOST=0.0.0.0: ``` # netstat -anp | grep 11434 tcp6 0 0 :::11434 :::* LISTEN 5009/ollama ``` This seems to be the cause: https://github.com/golang/go/issues/48723 ### OS Linux ### GPU Nvidia ### CPU Other ### Ollama version 0.1.32
GiteaMirror added the bug label 2026-05-03 17:50:03 -05:00
Author
Owner

@martindale commented on GitHub (May 6, 2024):

What's the fix?

<!-- gh-comment-id:2096158319 --> @martindale commented on GitHub (May 6, 2024): What's the fix?
Author
Owner

@nuaimat commented on GitHub (May 31, 2024):

i believe this might be the root of all problems related to open webui docker.

when i get into the docker container for open webui:
docker exec -it open-webui bash

then execute:
curl --ipv4 http://host.docker.internal:11434/api/tags
i get a response

but when i do:
curl --ipv6 http://host.docker.internal:11434/api/tags
i get no response
curl: (6) Could not resolve host: host.docker.internal
setting up ipv6 is a topic by itself: https://docs.docker.com/config/daemon/ipv6/

i believe the fix for this is to parse OLLAMA_HOST
if it was "0.0.0.0" then listen to ipv4 interface
if it was "::" then listen to ipv6 interface

or make it easier and listen to both ipv6 and ipv4 interfaces by default.

just like what openssh server is doing for example:

sudo netstat -nutlp  | grep 22
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      697/sshd: /usr/sbin
tcp6       0      0 :::22                   :::*                    LISTEN      697/sshd: /usr/sbin

<!-- gh-comment-id:2141322231 --> @nuaimat commented on GitHub (May 31, 2024): i believe this might be the root of all problems related to open webui docker. when i get into the docker container for open webui: `docker exec -it open-webui bash` then execute: `curl --ipv4 http://host.docker.internal:11434/api/tags` i get a response but when i do: `curl --ipv6 http://host.docker.internal:11434/api/tags` i get no response `curl: (6) Could not resolve host: host.docker.internal` setting up ipv6 is a topic by itself: https://docs.docker.com/config/daemon/ipv6/ i believe the fix for this is to parse OLLAMA_HOST if it was "0.0.0.0" then listen to ipv4 interface if it was "::" then listen to ipv6 interface or make it easier and listen to both ipv6 and ipv4 interfaces by default. just like what openssh server is doing for example: ``` sudo netstat -nutlp | grep 22 tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 697/sshd: /usr/sbin tcp6 0 0 :::22 :::* LISTEN 697/sshd: /usr/sbin ```
Author
Owner

@bojake commented on GitHub (Jan 29, 2025):

This bug still persists as of 1/29/2025.

Jan 29 09:43:20 ollama[410734]: time=2025-01-29T09:43:20.124-08:00 level=INFO source=routes.go:1238 msg="Listening on [::]:11434 (version 0.5.7)"

in the override.conf:

[Service]
Environment="OLLAMA_HOST=0.0.0.0"

netstat:
tcp 0 0 127.0.0.1:57406 127.0.0.1:11434 TIME_WAIT -
tcp6 0 0 :::11434 :::* LISTEN 410734/ollama

<!-- gh-comment-id:2622444240 --> @bojake commented on GitHub (Jan 29, 2025): This bug still persists as of 1/29/2025. Jan 29 09:43:20 ollama[410734]: time=2025-01-29T09:43:20.124-08:00 level=INFO source=routes.go:1238 msg="Listening on [::]:11434 (version 0.5.7)" in the override.conf: [Service] Environment="OLLAMA_HOST=0.0.0.0" netstat: tcp 0 0 127.0.0.1:57406 127.0.0.1:11434 TIME_WAIT - tcp6 0 0 :::11434 :::* LISTEN 410734/ollama
Author
Owner

@bojake commented on GitHub (Jan 29, 2025):

FYI. I had to follow guidance on this page: https://askubuntu.com/questions/309461/how-to-disable-ipv6-permanently to disable ipv6 via grub and then I was able to run ollama in ipv4 "relic" mode:

tcp 0 0 0.0.0.0:11434 0.0.0.0:* LISTEN

<!-- gh-comment-id:2622474364 --> @bojake commented on GitHub (Jan 29, 2025): FYI. I had to follow guidance on this page: https://askubuntu.com/questions/309461/how-to-disable-ipv6-permanently to disable ipv6 via grub and then I was able to run ollama in ipv4 "relic" mode: tcp 0 0 0.0.0.0:11434 0.0.0.0:* LISTEN
Author
Owner

@stratbasher commented on GitHub (Jan 30, 2025):

Experiencing this issue as well - only listening on ipv6 when setting OLLAMA_HOST to 0.0.0.0 via systemctl edit ollama.service

<!-- gh-comment-id:2623207455 --> @stratbasher commented on GitHub (Jan 30, 2025): Experiencing this issue as well - only listening on ipv6 when setting OLLAMA_HOST to 0.0.0.0 via systemctl edit ollama.service
Author
Owner

@Nejjer commented on GitHub (Jan 31, 2025):

I have the same problem

<!-- gh-comment-id:2627819161 --> @Nejjer commented on GitHub (Jan 31, 2025): I have the same problem
Author
Owner

@MDBrothers commented on GitHub (Feb 12, 2025):

Same problem in Ollama 0.3.13 installed via Ubuntu snaps

<!-- gh-comment-id:2654824844 --> @MDBrothers commented on GitHub (Feb 12, 2025): Same problem in Ollama 0.3.13 installed via Ubuntu snaps
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#64489