Help Center> Server Migration Service> User Guide (Kuala Lumpur Region)> FAQs> Migration Network> How Do I Resolve the Error "Failed to establish an SSH connection with the target ECS"?
Updated on 2024-03-15 GMT+08:00

How Do I Resolve the Error "Failed to establish an SSH connection with the target ECS"?

Symptom

The migration task failed, and you received the error message "sms.3802 Failed to establish an SSH connection with the target ECS."

Problem Analysis

During a Linux file-level migration, an SSH connection is established between the source server and target server for data transmission. If the SSH connection is not set up, the preceding error message is displayed. You are advised to review the following parts to locate the cause of the SSH connection failure.

Checking Whether the Target Server Is Stopped

  1. Log in to the management console.
  2. Under Compute, click Elastic Cloud Server. Locate the target ECS and view its status. If the ECS is stopped, choose More > Start in the Operation column.

Checking Whether Port 22 Is Allowed in the Security Group of the Target Server and the Source IP Address Is Configured Correctly

  1. Log in to the management console.
  2. Under Compute, click Elastic Cloud Server. In the ECS list, click the name of the target ECS.
  3. On the ECS details page, click the Security Groups tab. Check whether port 22 is allowed and whether the source IP address is specified correctly.

    If port 22 is not allowed in the inbound direction, add an inbound rule for port 22. If such an inbound rule exists but the source IP address is not 0.0.0.0/0 or the IP address of the source server, change the source IP address to 0.0.0.0/0.

    For details, see How Do I Configure Security Group Rules for Target Servers?

Checking Whether the Source Server Can Connect to the Target Server

  1. Log in to the source server.
  2. Run telnet Target server IP address Port in the error message. If the port is not reachable, check the configurations of the DNS servers, firewalls, security groups, and local networks of the source and target servers.

Checking Whether the SSH Client Is Installed on the Source Server

  1. Log in to the source server as user root.
  2. Check whether the SSH client is installed.

    If the SSH path shown in the following figure is not returned, install the SSH client.

    command -v ssh

Checking Whether the VPC or IP Address of the Target ECS Is Changed During the Migration

If the VPC or IP address of the target server is changed during the migration, change it back to the original VPC or IP address. Otherwise, you will need to repeat the migration.

Checking the Firewall Settings of the Source Server

Check whether the outbound traffic is blocked by the source server firewall. If yes, permit the traffic and continue the migration.