Skip to content

Conversation

@Yicheng-Lu-llll
Copy link
Member

@Yicheng-Lu-llll Yicheng-Lu-llll commented Jan 5, 2026

Description

This PR adds IPv6 localhost support and improves server binding security by eliminating 0.0.0.0 bindings.

goal

  • Avoid hardcoding 127.0.0.1, which breaks IPv6 support.
  • Avoid proactively using 0.0.0.0, which is insecure.
Server side
  • For local-only servers, bind to localhost (resolved via GetLocalhostIP()/ get_localhost_ip(); IPv4/IPv6).
  • For servers that need cross-node communication, bind to the node IP instead of 0.0.0.0.
  • If the user explicitly configures a bind address, always respect the user setting.
Client side
  • Use localhost when connecting to local-only servers (resolved via get_localhost_ip()).
  • Use the node IP when connecting to servers that require cross-node communication.

Note:

0.0.0.0 → node_ip related changes this PR made:

  • GCS Server: 0.0.0.0 → node_ip
  • Raylet gRPC: 0.0.0.0 → node_ip
  • Core Worker gRPC: 0.0.0.0 → node_ip
  • Object Manager: 0.0.0.0 → node_ip
  • Remote Python Debugger: 0.0.0.0 → node_ip
  • Ray Client Server already passed the node IP before this PR, but its default --host was 0.0.0.0. This PR changed it to localhost.
  • Dashboard Server by default binds to localhost. This PR just updated the documentation to suggest using node IP instead of 0.0.0.0 for remote access.
  • Non-Ray-core components (e.g., Serve): This PR keeps them binding to all interfaces as before, but replaced hardcoded 0.0.0.0 with get_all_interfaces_ip() to handle IPv6 (returns :: for IPv6 environments).

Related issues

Link related issues: "Fixes #1234", "Closes #1234", or "Related to #1234".

Additional information

Optional: Add implementation details, API changes, usage examples, screenshots, etc.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request is a significant and well-executed step towards full IPv6 support in Ray. It systematically replaces hardcoded IPv4 localhost addresses with a dynamic get_localhost_ip() function and eliminates insecure 0.0.0.0 bindings in favor of specific IP address bindings for gRPC servers. The changes are extensive, touching many parts of the codebase in both Python and C++, and appear to be correct and consistent. I have one suggestion for src/ray/util/network_util.cc to improve performance and code consistency by caching the result of get_localhost_ip. Overall, this is a high-quality contribution that improves Ray's networking capabilities and security posture.

@Yicheng-Lu-llll Yicheng-Lu-llll force-pushed the ipv6-localhost branch 4 times, most recently from 89703b9 to 1d303e8 Compare January 6, 2026 03:08
rpc_server_(config.grpc_server_name,
config.grpc_server_port,
config.node_ip_address == "127.0.0.1",
config.node_ip_address,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously, this argument was listen_to_localhost_only. If it was true, we used 127.0.0.1; if not, we used 0.0.0.0.

After this PR, the argument is bind_address, so we now directly pass config.node_ip_address. If it is localhost, the behavior remains the same; if it is not, we change the binding from 0.0.0.0 to the node IP.

There are many similar changes in this PR following this pattern.

@Yicheng-Lu-llll Yicheng-Lu-llll marked this pull request as ready for review January 6, 2026 06:04
@Yicheng-Lu-llll Yicheng-Lu-llll requested review from a team, edoakes and jjyao as code owners January 6, 2026 06:04
@Yicheng-Lu-llll Yicheng-Lu-llll added the core Issues that should be addressed in Ray Core label Jan 6, 2026
@ray-gardener ray-gardener bot added the docs An issue or change related to documentation label Jan 6, 2026
@edoakes
Copy link
Collaborator

edoakes commented Jan 6, 2026

@sampan-s-nayak can you help review pls?

Copy link
Collaborator

@edoakes edoakes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly LGTM, just some minor nits

Comment on lines 7 to 8
get_all_interfaces_ip as _get_all_interfaces_ip,
get_localhost_ip as _get_localhost_ip,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm what is the point of this?

if you want to "alias" the imports, I believe you can simply do from ray._raylet import get_localhost_ip and others can do from network_utils import get_localhost_ip (it'll be in the global namespace of network_utils)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, thank you! Fixed here: c8b4bb8

RAY_DASHBOARD_STARTUP_TIMEOUT_S = env_integer("RAY_DASHBOARD_STARTUP_TIMEOUT_S", 60)

DEFAULT_DASHBOARD_IP = "127.0.0.1"
DEFAULT_DASHBOARD_IP = get_localhost_ip()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this file is currently constants & env vars, so adding a dynamic lookup that interacts with the OS/network interfaces doesn't sit well with me. can we replace instances of DEFAULT_DASHBOARD_IP with a call to the util function directly instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trade-off is losing a single point of change, especially since these are used as function parameter defaults. Same pattern exists for Serve's DEFAULT_HTTP_HOST. That said, fair point - replaced with direct calls:92799f1

@edoakes
Copy link
Collaborator

edoakes commented Jan 8, 2026

there are some merge conflicts

yicheng added 3 commits January 8, 2026 00:49
Signed-off-by: yicheng <yicheng@anyscale.com>
Signed-off-by: yicheng <yicheng@anyscale.com>
…ip()

Signed-off-by: yicheng <yicheng@anyscale.com>
@edoakes edoakes added the go add ONLY when ready to merge, run all tests label Jan 8, 2026
Copy link
Collaborator

@edoakes edoakes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Kicked off premerge, lmk when passing

yicheng added 2 commits January 8, 2026 02:22
Signed-off-by: yicheng <yicheng@anyscale.com>
….0.1 in test_reporter_dashboard_and_runtime_env_agent

Signed-off-by: yicheng <yicheng@anyscale.com>
@edoakes edoakes merged commit 60bb749 into ray-project:master Jan 8, 2026
6 checks passed
ZacAttack added a commit to ZacAttack/ray that referenced this pull request Jan 9, 2026
ZacAttack added a commit to ZacAttack/ray that referenced this pull request Jan 9, 2026
…0.0.0.0 server bindings (ray-project#59852)"

This reverts commit 60bb749.

Signed-off-by: zac <zac@anyscale.com>
ZacAttack added a commit to ZacAttack/ray that referenced this pull request Jan 9, 2026
…0.0.0.0 server bindings (ray-project#59852)"

This reverts commit 60bb749.

Signed-off-by: zac <zac@anyscale.com>
ZacAttack added a commit to ZacAttack/ray that referenced this pull request Jan 9, 2026
ZacAttack added a commit to ZacAttack/ray that referenced this pull request Jan 9, 2026
aslonnie pushed a commit that referenced this pull request Jan 9, 2026
#60012)

## Description
Reverting #59852 as it causes
release test infra to fail. We need to update the infra to jive with the
new port discovery settings properly.

## Related issues
> Link related issues: "Fixes #1234", "Closes #1234", or "Related to
#1234".

## Additional information
Example failing build:
https://buildkite.com/ray-project/release/builds/74681#
AYou0207 pushed a commit to AYou0207/ray that referenced this pull request Jan 13, 2026
…server bindings (ray-project#59852)

## Description
This PR adds IPv6 localhost support and improves server binding security
by eliminating 0.0.0.0 bindings.

### goal
- Avoid hardcoding 127.0.0.1, which breaks IPv6 support.
- Avoid proactively using 0.0.0.0, which is insecure.

##### Server side
- For local-only servers, bind to localhost (resolved via
GetLocalhostIP()/ get_localhost_ip(); IPv4/IPv6).
- For servers that need cross-node communication, bind to the node IP
instead of 0.0.0.0.
- If the user explicitly configures a bind address, always respect the
user setting.

##### Client side
- Use localhost when connecting to local-only servers (resolved via
get_localhost_ip()).
- Use the node IP when connecting to servers that require cross-node
communication.

#### Note:
`0.0.0.0 → node_ip` related changes this PR made:
- GCS Server:  `0.0.0.0 → node_ip`
- Raylet gRPC:  `0.0.0.0 → node_ip`
- Core Worker gRPC:  `0.0.0.0 → node_ip`
- Object Manager:  `0.0.0.0 → node_ip`
- Remote Python Debugger: `0.0.0.0 → node_ip`
- Ray Client Server already passed the node IP before this PR, but its
default `--host` was 0.0.0.0. This PR changed it to localhost.
- Dashboard Server by default binds to localhost. This PR just updated
the documentation to suggest using node IP instead of 0.0.0.0 for remote
access.
- Non-Ray-core components (e.g., Serve): This PR keeps them binding to
all interfaces as before, but replaced hardcoded 0.0.0.0 with
`get_all_interfaces_ip()` to handle IPv6 (returns :: for IPv6
environments).

## Related issues
> Link related issues: "Fixes ray-project#1234", "Closes ray-project#1234", or "Related to
ray-project#1234".

## Additional information
> Optional: Add implementation details, API changes, usage examples,
screenshots, etc.

---------

Signed-off-by: yicheng <yicheng@anyscale.com>
Co-authored-by: yicheng <yicheng@anyscale.com>
Signed-off-by: jasonwrwang <jasonwrwang@tencent.com>
AYou0207 pushed a commit to AYou0207/ray that referenced this pull request Jan 13, 2026
ray-project#60012)

## Description
Reverting ray-project#59852 as it causes
release test infra to fail. We need to update the infra to jive with the
new port discovery settings properly.

## Related issues
> Link related issues: "Fixes ray-project#1234", "Closes ray-project#1234", or "Related to
ray-project#1234".

## Additional information
Example failing build:
https://buildkite.com/ray-project/release/builds/74681#

Signed-off-by: jasonwrwang <jasonwrwang@tencent.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Issues that should be addressed in Ray Core docs An issue or change related to documentation go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ray fails to serialize self-reference objects

2 participants