Help Center> Domain Name Service> Getting Started> Routing Internet Traffic to a Website
Updated on 2022-09-13 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 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 have already built a website on a web server with an IPv4 EIP bound. To allow users to access your website using domain name example.com and its subdomain www.example.com, do as follows:

  • Add an A record set that maps domain name example.com to the EIP.
  • Add an A record set that maps 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 whether 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 Are the DNS Servers Provided by the Huawei Cloud DNS Service?

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 domain name (example.com) in 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 as 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 the 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 domain name (example.com) in 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 the 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 Server Addresses 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 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 server addresses of the domain name on the registrar's website.

Generally, the changes to DNS server addresses 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. 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 server addresses 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 server addresses 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 Check Whether Record Sets Have Taken Effect?