Help Center/ Domain Name Service/ Getting Started/ Routing Internet Traffic to a Website
Updated on 2025-08-18 GMT+08:00

Routing Internet Traffic to a Website

Scenarios

After you register a domain name and set up a website, you can configure record sets to map the domain name to the public IP address of the web server so that end users can use the domain name to access your website over the Internet.

For example, you have already set up a website on a web server with a public IPv4 address bound. To allow end users to access your website using domain name example.com and its subdomain www.example.com, you need to:

  • Add an A record set that maps domain name example.com to the public IP address of the web server.
  • Add an A record set that maps subdomain www.example.com to the public IP address of the web server.

You only need to obtain the domain name and the public IP address of the web server. Configuring record sets for the domain name is irrelevant to the account and location of the domain name registrar and of the web server.

Preparations

  • Obtain the public IP address of the website server.
    • If your website server is an ECS, log in to the ECS console to obtain the public IP address of the ECS.
    • If your website server is not an ECS, contact your server provider to obtain the public IP address.
  • Ensure that the domain name is normal.

    You have queried the domain name status from the domain name registrar or a third-party platform and confirmed that the domain name is in a normal status.

Step 1: Create a Public Zone

  1. Go to the Public Zones page.
  2. In the upper right corner of the page, click Create Public Zone to host the domain name to the DNS service.

Step 2: Confirm and Change the DNS Servers of the Domain Name

The DNS service provides authoritative DNS servers for domain resolution.

After you create a public zone, an NS record set is generated, which specifies the DNS servers provided by the DNS service.

If DNS server addresses of the domain name are not those in the NS record set, the DNS service will not be able to resolve the domain name. You must change the DNS server addresses of the domain name in the registrar's system.

Generally, the changes to DNS servers will take effect within 48 hours, but the time may vary depending on the domain name registrar's cache duration.

Query the DNS server addresses provided by the DNS service.

  1. Go to the Public Zones page.
  2. In the public zone list, locate the public zone you created and click Manage Record Sets in the Operation column.

    Locate the NS record set and view the DNS server addresses in the Value column.

Change the DNS server addresses.

Log in to the domain name registrar's website and change the DNS server addresses to those provided by the DNS service. Refer to the domain name registrar's documentation for detailed operations.

Step 3: Add an A Record Set for the Domain Name

Add an A record set to the created public zone to allow access to your website using example.com.
  1. On the Public Zones page, locate the public zone you created and click the domain name (example.com).
  2. In the upper right corner of the page, click Add Record Set.
  3. Configure the parameters as follows:
    • Type: Retain the default setting A – Map domains to IPv4 addresses.
    • Name: Leave this parameter blank. This is a record set for the domain name, which is example.com.
    • Value: Enter the EIP of your web server.

    Retain the default values for other parameters.

  4. Click OK.

    View the added record set in the list. If the status of the record set is Normal, the record set has been added.

Step 4: Add an A Record Set for a Subdomain

Add another A record set to the created public zone to allow access to your website using www.example.com.

  1. On the Public Zones page, locate the public zone you created and click the domain name (example.com).
  2. In the upper right corner of the page, click Add Record Set.
  3. Configure the parameters as follows:
    • Type: Retain the default setting A – Map domains to IPv4 addresses.
    • Name: Set it to www, which means that this is a record set for the www.example.com subdomain.
    • Value: Enter the EIP of your web server.

    Retain the default values for other parameters.

  4. Click OK.

    View the added record set in the list. If the status of the record set is Normal, the record set has been added.

Step 5: Check Whether the Record Sets Are Active

  1. On the Public Zones page, locate the target public zone and click Check Domain Name in the Operation column.

  2. On the Check Domain Name page, locate the domain name and click Start Check in the Operation column.

  3. View the results and rectify the fault (if any) following the provided suggestion.

  1. On your local host, click the search icon and enter cmd to open the CLI.
  2. Run the nslookup -qt=a Domain name command to check whether the record set takes effect.

    Example: nslookup -qt=a example.com

    If the displayed IP address is the same as that configured in the record set, the record set taken effect.