Help Center> Domain Name Service> Getting Started> Routing Internet Traffic to a Website
Updated at: 2022-01-25 GMT+08:00

Routing Internet Traffic to a Website

Scenarios

After you register a domain name and set up a website, create a public zone and configure records to point the domain name to the IP address of the web server where the website is deployed so that visitors can use the domain name to access your website over the Internet.

For example, you can deploy a web server that has an IPv4 EIP. To access the website deployed on the web server through domain name example.com and its subdomain www.example.com, do as follows:

  • Add an A record set that maps the domain name example.com to the EIP.
  • Add an A record set that maps the subdomain www.example.com to the EIP.

Configuring DNS records for a website is irrelevant to the registrar of the domain name, and the account and location of the web server. You only need to obtain the domain name and the EIP of the web server.

No matter the web server is on the same cloud as the domain name, you can create a public zone and configure records for the domain name.

  • You register a domain name with a third-party registrar and deploy the web server on HUAWEI CLOUD.
  • You register a domain name with a third-party registrar and deploy the web server on a cloud where the domain name is hosted, other than HUAWEI CLOUD.
  • You register a domain name with a third-party registrar, and deploy the web server on a cloud that is not the one where the domain name is hosted.

Prerequisites

  • You have registered a domain name example.com with a third-party registrar.
  • You have deployed a web server and obtained its IP address.

Procedure

Figure 1 shows the process for configuring a domain name for your website.

Figure 1 Process for configuring a domain name

Step 1. Create a Public Zone

Create a public zone for your domain name on the DNS console.

  1. Log in to the management console.
  2. Hover the cursor over in the upper left corner. In the service list, choose Networking > Domain Name Service.

    The DNS console is displayed.

  3. In the navigation pane, choose Public Zones.

    The Public Zones page is displayed.

  4. Click Create Public Zone.
  5. Set Name to example.com.

    Set other parameters by referring to Creating a Public Zone.

    Figure 2 Creating a public zone
  6. Click OK.

    View the created public zone on the Public Zones page.

    Figure 3 Public zone list

    If the system prompts that the public zone has been created by another user, see Regaining a Domain Name.

    Click the zone name to view zone details. You can view SOA and NS record sets automatically generated by the system.

    • The SOA record set defines the DNS server that is the authoritative information source for a particular domain name.
    • The NS record set defines authoritative DNS servers for a domain name.

      You can modify the NS record set based on the region of the domain name. For more information about DNS servers, see What Addresses Does HUAWEI CLOUD DNS Use for Domain Name Resolution?

Step 2. Add an A Record Set for the Domain Name

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

  1. On the Public Zones page, click the name (example.com) of the public zone you created.

    The Record Sets page is displayed.

  2. Click Add Record Set.
  3. Set the parameters as follows:
    • Name: Leave this parameter blank. The system automatically considers example.com to be the name, and requests are routed to example.com.
    • Type: Set it to A – Map domains to IPv4 addresses.
    • Value: Enter the EIP of the web server.

    Retain default settings for other parameters. For detailed descriptions of the parameters, see Adding an A Record Set.

    Figure 4 Adding an A record set
  4. Click OK.

    View the added record set in the record set list and ensure that the status of the record set is Normal.

Step 3. Add an A Record Set for the Subdomain

Add another record set to allow access to your website using www.example.com.

  1. On the Public Zones page, click the name (example.com) of the public zone you created.

    The Record Sets page is displayed.

  2. Click Add Record Set.
  3. Set the parameters as follows:
    • Name: Set the value to www, indicating that the subdomain to be resolved is www.example.com.
    • Type: Set it to A – Map domains to IPv4 addresses.
    • Value: Enter the EIP of the web server.

    Retain default settings for other parameters. For detailed descriptions of the parameters, see Adding an A Record Set.

    Figure 5 Adding an A record set
  4. Click OK.

    View the added record set in the list and ensure that the status of the record set is Normal.

Step 4. Change 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 servers of the public domain name are not the same as those in the NS record set, the DNS service will not be able to resolve the domain name. You must change the DNS servers of the domain name on the registrar's website.

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

Query the DNS servers provided by the DNS service

  1. Log in to the management console.
  2. Hover the cursor over in the upper left corner. In the service list, choose Networking > Domain Name Service.

    The DNS console is displayed.

  3. In the navigation pane, choose Public Zones.

    The Public Zones page is displayed.

  4. Click the name of the public zone you created.

    Locate the NS record set. The DNS servers provided by the DNS service are displayed under Value.

    Figure 6 NS record set

Change the DNS servers

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

Checking Whether the Record Sets Have Taken Effect

For details, see How Do I Test Whether a Record Set Has Taken Effect?

close