Skip to content

Conversation

@pmenzel
Copy link
Contributor

@pmenzel Paul Menzel (pmenzel) commented Oct 21, 2026 •

AI disclaimer: This merge/pull request was generated by claude-opus-5 (Claude Code).

With net.ipv6.conf.all.disable_ipv6 = 1, lo has no ::1. But because of net.ipv6.ip_nonlocal_bind = 1 (commit 915614d (sysctl.conf: Allow inet free binds)), binding to ::1 still succeeds, while connecting to it fails:

bind ::1 ok
connect ::1 failed: [Errno 99] Cannot assign requested address

Servers trying ::1 first, and falling back to 127.0.0.1 only if the bind fails, therefore listen on an address no client can reach. Bazel does exactly that (GrpcServerImpl binds [::1] via Netty’s epoll transport), so on MarIuX the Bazel client never connects to its own server:

Starting local Bazel server and connecting to it...
... still trying to connect to local Bazel server (154781) after 10 seconds ...
[...]
FATAL: couldn't connect to server (154781) after 120 seconds.

Re-enable IPv6 on lo only. All other interfaces stay without IPv6, as all and default keep disable_ipv6 = 1.

Tested in a network namespace (unshare -rn): applying the changed file with sysctl -p gives lo ::1/128, and connecting to a server bound to ::1 succeeds.

Two related notes (not changed here):

  1. ip6.service’s ExecStop writes all.disable_ipv6 = 1, which would remove ::1 from lo again.
  2. /etc/hosts has no ::1 localhost entry, so getent hosts localhost returns ::1 from unbound’s built-in localhost zone, while getent ahosts localhost returns 127.0.0.1 from /etc/hosts.

With IPv6 disabled on all interfaces, lo has no ::1. But since commit
915614d (sysctl.conf: Allow inet free binds) also sets
net.ipv6.ip_nonlocal_bind = 1, binding to ::1 still succeeds, while
connecting to it fails:

    bind ::1 ok
    connect ::1 failed: [Errno 99] Cannot assign requested address

Servers that try ::1 first and fall back to 127.0.0.1 only when the bind
fails therefore listen on an address no client can reach. Bazel does
exactly that (GrpcServerImpl binds [::1] via Netty's epoll transport), so
on MXQ nodes its client never connects to its own server:

    Starting local Bazel server and connecting to it...
    ... still trying to connect to local Bazel server (154781) after 10 seconds ...
    [...]
    FATAL: couldn't connect to server (154781) after 120 seconds.

Re-enable IPv6 on lo only, so ::1 exists. Other interfaces stay without
IPv6, as `all` and `default` keep disable_ipv6 = 1. Applying the changed
file with `sysctl -p` in a network namespace gives lo ::1/128, and
connecting to a server bound to ::1 succeeds.

Assisted-by: claude-opus-5 (Claude Code)
Sign in to join this conversation on GitHub.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant