All Products
Search
Document Center

:(Optional) Test domain name accessibility

Last Updated:Jun 21, 2026

After you add a domain name to Alibaba Cloud CDN, we recommend that you test whether the domain name is accessible before you update the CNAME record of the domain name. This ensures that DNS updates do not affect the services of the domain name. This topic describes how to use an on-premises machine to test whether a domain name is accessible before it is mapped to the CNAME assigned by Alibaba Cloud CDN.

Note

During the test, requests are sent to points of presence (POPs). You are charged for the basic services and value-added services of Alibaba Cloud CDN that you have used. The billing rules of Alibaba Cloud CDN apply in the test. For more information, see Billable items.

Prerequisites

  • A domain name is added to Alibaba Cloud CDN. If you have not added a domain name to Alibaba Cloud CDN, add one to Alibaba Cloud CDN by following instructions in Add a domain name.

  • The origin server configured on the Domain Names page must be accessible.

Procedure

  1. Obtain the CNAME assigned to the domain name.

    1. Log on to the CDN console.

    2. In the left navigation pane, click Domain Names.

    3. On the Domain Names page, find the domain name that you want to manage, and copy the CNAME.

      Note

      Copy the CNAME of a domain name that is in the Normal state.

  2. Find the IP address for the CNAME. In a command-line interface (such as CMD, PowerShell, or Terminal), run the nslookup command to query the CNAME and obtain its IP address.

    Note

    The IP address returned by the following nslookup command is for reference only. Use the IP address returned by nslookup for your actual CNAME.

    nslookup xxx.xxx.w.kunlunle.com
    Server:         100.100.2.136
    Address:        100.100.2.136#53
    
    Non-authoritative answer:
    Name:   xxx.p.kunlunle.com
    Address: 117.xxx.xxx.214
    Name:   flaskzx.zhang-xin.top.w.kunlunle.com
    Address: xxx:e:1:3::3fa
  3. Add the IP address and domain name to the hosts file of the on-premises machine.

    You must add the IP address obtained from Step 2 and the accelerated domain name to the hosts file of the on-premises machine. Make sure that you add the IP address before the accelerated domain name.

    For example, assume your accelerated domain name is example.aliyundoc.com, its CNAME is example.aliyundoc.com.w.kunlunle.com, and the IP address returned by nslookup example.aliyundoc.com.w.kunlunle.com is 192.168.0.1. The following steps show how to add this entry.

    Windows

    1. Navigate to C:\Windows\System32\drivers\etc and open the hosts file by using a text editor, such as Notepad, with administrator privileges.

    2. Edit the hosts file.

      The file content may be similar to the following text:

      # localhost name resolution is handled within DNS itself.
      # 127.0.0.1       localhost
      # ::1             localhost

      Add the obtained IP address and the domain name to the end of the file. Example:

      192.168.0.1   example.aliyundoc.com
    3. Save the changes.

      After you edit the file, choose File > Save or press Ctrl+S to save your changes.

    4. Optional. Refresh the DNS cache to ensure that the DNS resolution changes take effect immediately.

      Open Command Prompt as the administrator and run the following command:

      ipconfig /flushdns

    macOS

    1. Open the Terminal application and run the following command to open the hosts file with administrator privileges:

      sudo vim /etc/hosts

      You are prompted to enter the administrator password. Enter the password and press Enter.

    2. Edit the hosts file.

      The file content may be similar to the following text:

      ##
      # Host Database
      #
      # localhost is used to configure the loopback interface
      # when the system is booting.  Do not change this entry.
      ##
      127.0.0.1   localhost
      255.255.255.255 broadcasthost
      ::1         localhost

      Add the obtained IP address and the domain name to the end of the file. Example:

      192.168.0.1   example.aliyundoc.com
    3. Save the changes and exit.

      Press Esc to exit insert mode, enter :wq, and then press Enter to save the file and exit vim.

    4. Optional. Refresh the DNS cache to ensure that the DNS resolution changes take effect immediately.

      Run the following command in Terminal:

      sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
  4. Test whether the accelerated domain name is accessible.

    After you add the IP address and accelerated domain name to the hosts file, you can open the browser and enter the accelerated domain name in the address bar to test the connectivity. You can view the test result by using the developer tool of the browser.

    • In the developer tools, open the Network tab, select the request for your domain, and inspect the Headers information. If the Status Code is 200 OK, connectivity is normal. Also, check the IP address in the Remote Address field. If this IP address matches the one you added to the hosts file, your configuration is correct. You can now proceed to configure the CNAME with your DNS provider.

    • If the IP address in the Remote Address field does not match the one in your hosts file, your configuration is incorrect. Verify that you have entered the correct IP address in the hosts file and that you resolved this IP address from the correct CNAME.

    After you access the accelerated domain name, you can also test other features by using the on-premises machine.

What to do next

Add a CNAME record for a domain name: After you add a domain name to CDN, CDN assigns a CNAME to the domain name. You need to add the CNAME record for the domain name before CDN acceleration can take effect.