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. Because Ray does not support configuring the SSH port directly, use an SSH configuration file to configure a non-standard SSH port for each node.

Steps

  1. Create an SSH configuration file and add node configurations.

    mkdir -p ./ssh-config
    cat > ./ssh-config/config << 'EOF'
    Host <host_alias>
    HostName <host_ip>
    Port <ssh_port>
    User <user>
    Host <host_alias>
    HostName <host_ip>
    Port <ssh_port>
    User <user>
    EOF
    chmod 600 ./ssh-config/config

    Parameter description:

    ParameterDescription
    <host_alias>Node alias, used to identify the node in the SSH configuration and when adding the node to the cluster after configuration is complete.
    <host_ip>IP address of the node.
    <ssh_port>SSH port used by the node.
    <user>SSH username. Must be root or another user with root privileges.

    Example

    mkdir -p ./ssh-config
    cat > ./ssh-config/config << 'EOF'
    Host gpu-node-1
    HostName 192.168.1.100
    Port 2222
    User root
    EOF
    chmod 600 ./ssh-config/config

    The example above creates ./ssh-config/config with the following configuration: node alias gpu-node-1, IP 192.168.1.100, port 2222, username root.

  2. Mount the SSH configuration file to 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 the SSH connection to each node to verify that the SSH configuration file and node configuration are correct.

  4. Add nodes to the cluster in Neutree. Use the node alias (such as gpu-node-1 in the example above) instead of the IP address.

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