Skip to content
Neutree Documentation

Using a non-standard SSH port

Issue

Neutree connects to nodes via SSH to manage static node clusters. The default SSH port is 22. If your nodes use a different port, adding nodes may fail.

Solution

Neutree uses Ray as the underlying cluster management tool and does not support directly configuring the SSH port. In addition to being used for SSH connections, the head_ip and worker_ips values in the cluster configuration are also used as the Ray cluster GCS address (<head_ip>:6379) and Dashboard access address (http://<head_ip>:8265). Use an SSH configuration file to override the non-standard SSH port for node IP addresses.

Steps

  1. Create an SSH configuration file and add port configuration for each node IP address.

    Terminal window
    mkdir -p ./ssh-config
    cat > ./ssh-config/config << 'EOF'
    Host <host_ip>
    Port <ssh_port>
    EOF
    chmod 600 ./ssh-config/config

    Parameter descriptions:

    ParameterDescription
    Host <host_ip>Node IP address. It must be the same as the head_ip and worker_ips values in the cluster configuration. Wildcards are supported. If multiple nodes use the same port, you can use a simplified form such as Host 192.168.1.*.
    Port <ssh_port>SSH port used by the node.

    Information:

    • When Neutree connects to a node, it runs ssh <ssh_user>@<host_ip>. The Host entry in the SSH configuration must match the node IP address.
    • Neutree provides the username and key through the ssh_user and ssh_private_key values in the cluster configuration.

    Example

    mkdir -p ./ssh-config
    cat > ./ssh-config/config << 'EOF'
    Host 192.168.1.100
    Port 2222
    Host 192.168.1.101
    Port 2222
    EOF
    chmod 600 ./ssh-config/config

    This example creates ./ssh-config/config and adds the following configuration: nodes whose IP addresses are 192.168.1.100 and 192.168.1.101 use SSH port 2222.

  2. Mount the SSH configuration file to the Neutree’s neutree-core container.

    Choose the appropriate method based on your deployment mode.

    1. Update the docker-compose.yaml file to mount the SSH configuration file to the neutree-core container.

      services:
      neutree-core:
      # ... other configurations
      volumes:
      - ./ssh-config:/root/.ssh:ro
    2. Restart the service.

      docker-compose up -d

    Note:

    When upgrading the Neutree control plane using docker-compose.yaml in the future, your custom volume mounts may be overwritten. After each upgrade, be sure to remount the SSH configuration file to the neutree-core container.

  3. Test whether the SSH connection to the node is normal to verify that the SSH configuration file and node configuration are correct.

    You can run the following command on the host where Neutree is located to check whether the node port is reachable:

    nc -zv 192.168.1.100 2222

    Or, after adding the node to Neutree, check whether the cluster enters the Ready state.

  4. Add nodes to the cluster in Neutree. For head_ip and worker_ips, enter node IP addresses.

For Ray-related limitations, see Ray Discuss: Specify SSH port to cluster YAMLs.