All Products
Search
Document Center

:In Linux ECS instances, the following error "fatal: Cannot bind any address" occurs when the SSH service is started

Last Updated:May 10, 2022

Disclaimer: This article may contain information about third-party products. Such information is for reference only. Alibaba Cloud does not make any guarantee, express or implied, with respect to the performance and reliability of third-party products, as well as potential impacts of operations on the products.

Problem description

When you start the SSH service Linux an ECS instance server, an error message similar to the following is displayed in the command line or Secure log.

FAILED.
fatal: Cannot bind any address.
address family must be specified before ListenAddress.

Cause

The AddressFamily parameter of the SSH service specifies the protocol family to be used at runtime. This issue may occur if only IPV6 is used in the configuration but IPV6 is not enabled in the system or the IPV6 protocol is not configured effectively.

User notification

In this document, as well as the system configuration and its description in CentOS 7.6 64 bit operating system test. The operating system configurations of other versions may be different. For more information, see the official documentation of the operating system.

Solution

Alibaba Cloud reminds you that:

  • Before you perform operations that may cause risks, such as modifying instance configurations or data, we recommend that you check the disaster recovery and fault tolerance capabilities of the instances to ensure data security.
  • If you modify the configurations and data of instances including but not limited to ECS and RDS instances, we recommend that you create snapshots or enable RDS log backup.
  • If you have authorized or submitted security information such as the logon account and password in the Alibaba Cloud Management console, we recommend that you modify such information in a timely manner.

The resolution steps are as follows.

  1. Enter the system through the management terminal.
  2. Run the cat command to check whether /etc/ssh/sshd_config contains a configuration similar to the following.
    AddressFamily inet6
    Note: common parameters are described as follows.
    • inet uses IPV4 protocol family, which is the default value.
    • inet6 uses the IPV6 protocol cluster.
    • any both IPV4 and IPV6 protocol clusters are enabled.
  3. Use an editor such as vi to set the parameter value to inet, or delete the entire object or comment out an annotation (adding # Number) configuration throughout the row, the operation is similar to the following.
    # AddressFamily inet
    Note: Make sure that the AddressFamily parameter is set before ListenAddress.

Application scope

  • ECS