Configure DNS resolution for Cloud Assistant

Updated at:

Add Cloud Assistant endpoint IP addresses to the hosts file to restore DNS resolution when custom DNS settings break it.

Use cases

Cloud Assistant requires access to its service endpoints to run commands on ECS instances. The default DNS nameserver on ECS instances resolves these endpoints without additional configuration.

If you overwrite the default DNS nameserver settings, endpoint resolution may fail or slow down, making Cloud Assistant unavailable. In this case, manually configure DNS resolution to restore Cloud Assistant.

Run the following command for your OS to check the current DNS nameserver. If the output shows non-default settings, configure DNS resolution for Cloud Assistant.

Linux instance

Run the cat /etc/resolv.conf command to view the DNS nameserver settings.

[root@izxxx ~]# cat /etc/resolv.conf
options timeout:2 attempts:3 rotate single-request-reopen
; generated by /usr/sbin/dhclient-script
nameserver 100.100.xxx
nameserver 100.100.xxx

Windows instance

Run the nslookup command in Windows PowerShell to view the DNS nameserver settings.

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows

PS C:\Users\Administrator> nslookup
Default Server:  Unknown
Address:  100.100.

Procedure

Linux instance

  1. Connect to the Linux instance.

  2. Obtain the IP addresses that correspond to Cloud Assistant endpoints.

    Cloud Assistant uses the following endpoints:

    • Command execution: <region-id>.axt.aliyun.com

    • Plug-in and update packages: aliyun-client-assist-<region-id>.oss-<region-id>-internal.aliyuncs.com

      Note

      Replace <region-id> with your region ID. See Regions and zones.

    For example, to obtain the endpoint IP addresses for the China (Beijing) region, run the following commands:

    ping -c 4 cn-beijing.axt.aliyun.com
    ping -c 4 aliyun-client-assist-cn-beijing.oss-cn-beijing-internal.aliyuncs.com
    [ xxx@iz xxx ~]# ping -c 4  cn-beijing.axt.aliyun.com
    PING cn-beijing.axt.aliyun.com (100.100.xxx.xxx) 56(84) bytes of data.
    64 bytes from 100.100.xxx (100.100.xxx): icmp_seq=1 ttl=102 time=1.75 ms
    64 bytes from 100.100.xxx (100.100.xxx): icmp_seq=2 ttl=102 time=1.77 ms
    64 bytes from 100.100.xxx (100.100.xxx): icmp_seq=3 ttl=102 time=1.78 ms
    64 bytes from 100.100.xxx (100.100.xxx): icmp_seq=4 ttl=102 time=1.75 ms
    
    --- cn-beijing.axt.aliyun.com ping statistics ---
    4 packets transmitted, 4 received, 0% packet loss, time 3005ms
    rtt min/avg/max/mdev = 1.753/1.768/1.786/0.044 ms
    [ xxx@iz xxx ~]# ping -c 4 aliyun-client-assist-cn-beijing.oss-cn-beijing-internal.aliyuncs.com
    PING aliyun-client-assist-cn-beijing.oss-cn-beijing-internal.aliyuncs.com (100.118.xxx) 56(84) bytes of data.
    64 bytes from 100.118.xxx (100.118.xxx): icmp_seq=1 ttl=102 time=1.98 ms
    64 bytes from 100.118.xxx (100.118.xxx): icmp_seq=2 ttl=102 time=1.99 ms
    64 bytes from 100.118.xxx (100.118.xxx): icmp_seq=3 ttl=102 time=1.96 ms
    64 bytes from 100.118.xxx (100.118.xxx): icmp_seq=4 ttl=102 time=1.96 ms
    
    --- aliyun-client-assist-cn-beijing.oss-cn-beijing-internal.aliyuncs.com ping statistics ---
    4 packets transmitted, 4 received, 0% packet loss, time 3005ms
    rtt min/avg/max/mdev = 1.966/1.978/1.995/0.046 ms
  3. Modify the hosts file.

    echo "100.100.XX.XX cn-beijing.axt.aliyun.com" >> /etc/hosts && \
    echo "100.118.XX.XX aliyun-client-assist-cn-beijing.oss-cn-beijing-internal.aliyuncs.com" >> /etc/hosts
    Note

    Replace 100.100.XX.XX and 100.118.XX.XX with the IP addresses that you obtained in Step 2.

  4. Verify the hosts file update.

    cat /etc/hosts

    The output shows the updated hosts file entries.

    [xxxt@iZxxx          etc]# cat /etc/hosts
    ::1	localhost	localhost.localdomain	localhost6	localhost6.localdomain6
    127.0.xxx	localhost	localhost
    
    192.168.xxx	iZ2xxx	iZ2xxx
    100.100.xxx	cn-beijing.axt.aliyun.com
    100.118.xxx	aliyun-client-assist-cn-beijing.oss-cn-beijing-internal.aliyuncs.com

    The instance now resolves Cloud Assistant endpoints using the IP addresses in the hosts file.

Windows instance

  1. Connect to the Windows instance.

  2. Obtain the Cloud Assistant endpoint IP addresses.

    Cloud Assistant uses the following endpoints:

    • Command execution: <region-id>.axt.aliyun.com

    • Plug-in and update packages: aliyun-client-assist-<region-id>.oss-<region-id>-internal.aliyuncs.com

      Note

      Replace <region-id> with your region ID. See Regions and zones.

    For example, to obtain the endpoint IP addresses for the China (Beijing) region, run the following commands in Windows PowerShell:

    ping cn-beijing.axt.aliyun.com
    ping aliyun-client-assist-cn-beijing.oss-cn-beijing-internal.aliyuncs.com
    Windows PowerShell
    Copyright (C) Microsoft Corporation. All rights reserved.
    
    Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows
    
    PS C:\Users\Administrator> ping cn-beijing.axt.aliyun.com
    
    Pinging cn-beijing.axt.aliyun.com [100.100.xxx.xxx] with 32 bytes of data:
    Reply from 100.100.xxx.xxx: bytes=32 time<1ms TTL=102
    Reply from 100.100.xxx.xxx: bytes=32 time=1ms TTL=102
    Reply from 100.100.xxx.xxx: bytes=32 time<1ms TTL=102
    Reply from 100.100.xxx.xxx: bytes=32 time=1ms TTL=102
    
    Ping statistics for 100.100.xxx.xxx:
        Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
    Approximate round trip times in milli-seconds:
        Minimum = 1ms, Maximum = 1ms, Average = 1ms
    PS C:\Users\Administrator> ping aliyun-client-assist-cn-beijing.oss-cn-beijing-internal.aliyuncs.com
    
    Pinging aliyun-client-assist-cn-beijing.oss-cn-beijing-internal.aliyuncs.com [100.118.xxx.xxx] with 32 bytes of data:
    Reply from 100.118.xxx.xxx: bytes=32 time<1ms TTL=102
    Reply from 100.118.xxx.xxx: bytes=32 time<1ms TTL=102
    Reply from 100.118.xxx.xxx: bytes=32 time<1ms TTL=102
    Reply from 100.118.xxx.xxx: bytes=32 time<1ms TTL=102
    
    Ping statistics for 100.118.xxx.xxx:
        Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
    Approximate round trip times in milli-seconds:
        Minimum = 0ms, Maximum = 0ms, Average = 0ms
  3. Run the following commands in Windows PowerShell to modify the hosts file:

    "100.100.XX.XX cn-beijing.axt.aliyun.com" | Add-Content C:\Windows\System32\drivers\etc\hosts
    "100.118.XX.XX aliyun-client-assist-cn-beijing.oss-cn-beijing-internal.aliyuncs.com" | Add-Content C:\Windows\System32\drivers\etc\hosts
    Note

    Replace 100.100.XX.XX and 100.118.XX.XX with the IP addresses that you obtained in Step 2.

  4. Verify the hosts file update.

    cat C:\Windows\System32\drivers\etc\hosts

    The output shows the updated hosts file entries.

    PS C:\Users\Administrator> cat C:\Windows\System32\drivers\etc\hosts
    # Copyright (c) 1993-2009 Microsoft Corp.
    #
    # This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
    #
    # This file contains the mappings of IP addresses to host names. Each
    # entry should be kept on an individual line. The IP address should
    # be placed in the first column followed by the corresponding host name.
    # The IP address and the host name should be separated by at least one
    # space.
    #
    # Additionally, comments (such as these) may be inserted on individual
    # lines or following the machine name denoted by a '#' symbol.
    #
    # For example:
    #
    #      102.54.94.97     rhino.acme.com          # source server
    #       38.25.63.10     x.acme.com              # x client host
    #
    # localhost name resolution is handled within DNS itself.
    #	127.0.0.1       localhost
    #	::1             localhost
    
    100.100.xxx.xxx cn-beijing.axt.aliyun.com
    100.118.xxx.xx aliyun-client-assist-cn-beijing.oss-cn-beijing-internal.aliyuncs.com

    The instance now resolves Cloud Assistant endpoints using the IP addresses in the hosts file.