# Routing Internet Traffic to a Website

#### Scenarios

After you register a domain name and set up a website using an IP address, configure the domain name so that visitors can access your website on the Internet.

For example, you can deploy a web server with an IPv4 EIP. To access the website 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.

#### Prerequisites

- You have registered domain name example.com.
- You have deployed a web server and obtained its IP address.

#### Process

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

Figure 1 Process for configuring a domain name

#### Step 1. Create a Public Zone

Create a public zone for your domain name and add record sets to it.

1. Log in to the management console.
2. In the service list, choose Network > 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

   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.

#### 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. In the service list, choose Network > 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.

Parent topic: Getting Started