Help Center> Server Migration Service> FAQ> Migration Network> How Do I Resolve Error "Failed to establish an SSH connection with the target ECS"?

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

Symptom

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

Figure 1 SSH connection failure

Checking Whether the Target ECS 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 ECS and Whether 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 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 SSH Client Is Installed on the Source Server

  1. Log in to the source server as user root.
  2. Run the following command to check whether the SSH client is installed.

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

    Running command -v ssh

Checking Whether the VPC or IP Address of the Target Server 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 need to perform the migration again.

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.

Checking Whether Security Alarms Are Generated on the Source or Target Server or the EIP of the Source or Target Server Is Frozen

Check whether security alarms are generated on the source or target servers or the EIP of the source or target server is frozen.

  • If this problem is happened on the source server, contact the source cloud service provider for troubleshooting.
  • If this problem is happened on the target server, contact HUAWEI CLOUD for troubleshooting.

Checking Whether the Public Key on the Source and Target Server Are the Same?

Compare the target server IP address, key pair algorithm, and public key recorded in the /root/.ssh/known_hosts file on the source server with that recorded in the public key file in the /etc/ssh directory on the target server. If the information is inconsistent, delete the corresponding lines from the /root/.ssh/known_hosts file on the source server, delete the migration task, and perform the migration again.

Checking Whether the sshd Service on the Target Server Is Running Properly or Whether Its Listening Port Is 22

Log in to the target server and run the service sshd status command. If the service status is not active (running), restart the sshd service. If the listening port is not 22, change the listening port to 22.

If the original password cannot be used to log in to the target server, try to use 1the first eight characters of target SK! to log in.

Checking Whether the Migration Is Performed Over a Private Network that Is Not Connected to the Target ECS

Check whether a private network is used for the migration and whether the source and target servers are in different private networks. If yes, select the public network or connect the two private networks.