From 07e9f5330e3da27faba3c65d2df2d6e9df122796 Mon Sep 17 00:00:00 2001 From: Dilum Aluthge Date: Tue, 10 Jun 2025 13:45:40 -0400 Subject: [PATCH] Distributed worker: Worker: Bind to the first non-link-local IPv4 address --- stdlib/Distributed/src/cluster.jl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/stdlib/Distributed/src/cluster.jl b/stdlib/Distributed/src/cluster.jl index 2444695f90afd..4971ea0fefbfa 100644 --- a/stdlib/Distributed/src/cluster.jl +++ b/stdlib/Distributed/src/cluster.jl @@ -1276,7 +1276,10 @@ function init_bind_addr() else bind_port = 0 try - bind_addr = string(getipaddr()) + # Use the first non-link-local IPv4 address + addrs = Sockets.getipaddrs(Sockets.IPv4) + filter!(!Sockets.islinklocaladdr, addrs) + bind_addr = string(first(addrs)) catch # All networking is unavailable, initialize bind_addr to the loopback address # Will cause an exception to be raised only when used.