After you add a domain name to Dynamic Content Delivery Network (DCDN), 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 test whether a domain name is accessible after it is mapped to the CNAME assigned by DCDN.
Prerequisites
- A domain name is added to DCDN. If you have not added a domain name to DCDN, add one to DCDN. For more information, see Add a domain name.
- The origin server that you configure can be accessed.
Procedure
- Obtain the CNAME of the domain name.
- Obtain the IP address of the CNAME. Note The following IP address is an example returned by running the ping command and is for reference only. To obtain the actual IP address of your CNAME, run the ping command to ping your CNAME.
- Windows: To obtain the IP address of your CNAME, open the command-line interface and run the ping CNAME command.
- macOS: To obtain the IP address of your CNAME, open the command-line interface and run the dig CNAME command.
- 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 domain name to the hosts file of the on-premises machine. Make sure that you add the IP address before the domain name.
In this example, the domain name is example.com, the CNAME is example.com.w.kunlunsl.com, and the IP address of the CNAME is 192.168.0.1.
- The path of the hosts file in Windows is C:\Windows\System32\drivers\etc\hosts. The following figure provides an example.
- The path of the hosts file in macOS is Finder > Go > Go to the folder > /etc/hosts. The following figure provides an example.
- Test whether the domain name is accessible. After you add the IP address and domain name to the hosts file, you can open the browser and enter the domain name in the address bar to test the connectivity. You can view the test result by using the developer tool of the browser.
- If the IP address in the Remote Address field is the same as the one that you add to the hosts file, the configuration is valid. You can configure the CNAME on the DNS service provider side.
- If the IP address in the Remote Address field is different from the one that you add to the hosts file, the configuration is invalid. Make sure that you add the IP address of the CNAME to the hosts file.
After you access the domain name, you can also test other features by using the on-premises machine.