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.
To configure record sets, you only need the domain name and the public IP address of the web server.
Process
Step |
Description |
---|---|
Before using Huawei Cloud DNS to resolve website domains, you need to sign up for a HUAWEI ID and enable Huawei Cloud services, complete real-name authentication, top up your account, set up website servers, register a domain name, and apply for an ICP license. |
|
If your domain name registered with Huawei Cloud, a public zone is automatically created for your domain name on the DNS console. If the domain name is not registered with Huawei Cloud, you need to create a public zone on the DNS console. |
|
If the domain name is not registered with Huawei Cloud, change the DNS server addresses for the domain name in the domain name registrar's system. |
|
Add an A record set for the domain name so that the website can be accessed through the domain name. |
|
Add an A record set for a subdomain so that the website can be accessed through this subdomain. |
|
Verify that the configuration takes effect. |
Preparations
Before configuring DNS settings for a website domain, you need to sign up for a HUAWEI ID, enable Huawei Cloud services, complete real-name authentication, and top up your account. Ensure that your account has sufficient balance.
- Sign up for a HUAWEI ID.
For details, see Sign up for a HUAWEI ID and enable Huawei Cloud services.
- Complete real-name authentication.
For details, see Real-Name Authentication.
If you have enabled Huawei Cloud services and completed real-name authentication, skip this step.
- Top up your account.
For details, see Topping up an Account.
- You have deployed a web server and obtained its public IP address, and registered a domain name.
Step 1: Create a Public Zone
- Go to the Public Zones page.
- In the upper right corner of the page, click Create Public Zone to host the domain name to the DNS service.
Table 1 Parameters for creating a public zone Parameter
Example Value
Description
Domain Name
example.com
Domain name you have registered.
The domain name can be a second-level domain name or one of its subdomains. The following are two examples:- Subdomain of example.com: abc.example.com
- Subdomain of example.com.cn: abc.example.com.cn
For details about the domain name format, see Domain Name Format and DNS Hierarchy.
Enterprise Project
default
The enterprise project by which public zones are centrally managed. Select an existing enterprise project for the public zone.
NOTE:This parameter is available and mandatory only when Account Type is set to Enterprise Account.
When setting this parameter, note the following:
- If you do not manage PTR records by enterprise project, select the default enterprise project.
- If you manage PTR records by enterprise project, select an existing enterprise project.
Tag
example_key1
example_value1
Tag that will be added to classify and identify the public zone.
Description
This is a zone example.
Supplementary information about the public zone.
The description can contain no more than 255 characters.
Step 2: Change DNS Server Addresses for the Domain Name
Huawei Cloud DNS 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 on the registrar's website.
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.
- Go to the Public Zones page.
- In the public zone list, locate the public zone you created and click the domain name.
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
- On the Public Zones page, locate the public zone you created and click the domain name (example.com).
The Record Sets tab is displayed.
- In the upper right corner of the page, click Add Record Set.
- Configure the parameters as follows:
- Name: Leave this parameter blank. This is a record set for the domain name, which is example.com.
- Type: Retain the default setting A – Map domains to IPv4 addresses.
- Value: Enter the EIP of your web server.
Retain the default values for other parameters. For details, see Adding an A Record Set.
Table 2 Parameters for adding a record set for a domain name Parameter
Example Value
Description
Name
Leave this parameter blank.
Prefix of the domain name to be resolved.
For example, if the domain name is example.com, the prefix can be as follows:
- www: The domain name is www.example.com, which is usually used for a website.
- Left blank: The domain name is example.com, which is usually used for a website.
To use an at sign (@) as the domain name prefix, just leave this parameter blank.
- abc: The domain name is abc.example.com, a subdomain of example.com.
- mail: The domain name is mail.example.com, which is usually used for email servers.
- *: The domain name is *.example.com, which is a wildcard domain name, indicating all subdomains of example.com.
Type
A – Map domains to IPv4 addresses
Type of the record set.
A message may be displayed, indicating that the record set you are trying to add conflicts with an existing record set of the zone.
For details, see Why Is a Message Indicating Conflict with an Existing Record Set Displayed When I Add a Record Set?
Line
Default
Resolution line. The DNS server will return the IP address of the specified line, depending on where end users come from.
The default value is Default.
This parameter is only configurable for public zone record sets.
- Default: returns the default resolution result irrespective of where the visitors come from.
- ISP: returns the resolution result based on visitors' carrier networks.
- Region: returns the resolution result based on visitors' geographical locations.
TTL (s)
300
Cache duration of the record set on a local DNS server, in seconds.
The default value is 300. The value ranges from 1 to 2147483647.
If your service address changes frequently, set TTL to a smaller value.
Learn more about TTL.
Value
192.168.12.2
192.168.12.3
IPv4 addresses mapped to the domain name.
You can enter up to 50 values, each on a separate line.
Weight
1
(Optional) Weight for the record set. The value ranges from 0 to 1000, and the default value is 1.
This parameter is only configurable for public zone record sets.
If a resolution line in a zone contains multiple record sets of the same type, you can set different weights to each record set.
Tag
example_key1
example_value1
(Optional) Identifier of the record set. Each tag contains a key and a value. You can add up to 20 tags to a record set.
Description
-
(Optional) Supplementary information about the record set.
The description can contain no more than 255 characters.
- 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.
- On the Public Zones page, click the domain name (example.com) of the public zone you created.
The Record Sets tab is displayed.
- In the upper right corner of the page, click Add Record Set.
- Configure the parameters as follows:
- Name: Set it to www, which means that this is a record set for the www.example.com subdomain.
- Type: Retain the default setting A – Map domains to IPv4 addresses.
- Value: Enter the EIP of your web server.
Retain the default values for other parameters. For details, see Adding an A Record Set.
Table 3 Parameters for adding a record set for a subdomain Parameter
Example Value
Description
Name
www
Prefix of the domain name to be resolved.
For example, if the domain name is example.com, the prefix can be as follows:
- www: The domain name is www.example.com, which is usually used for a website.
- Left blank: The domain name is example.com, which is usually used for a website.
To use an at sign (@) as the domain name prefix, just leave this parameter blank.
- abc: The domain name is abc.example.com, a subdomain of example.com.
- mail: The domain name is mail.example.com, which is usually used for email servers.
- *: The domain name is *.example.com, which is a wildcard domain name, indicating all subdomains of example.com.
Type
A – Map domains to IPv4 addresses
Type of the record set.
A message may be displayed, indicating that the record set you are trying to add conflicts with an existing record set of the zone.
For details, see Why Is a Message Indicating Conflict with an Existing Record Set Displayed When I Add a Record Set?
Line
Default
Resolution line. The DNS server will return the IP address of the specified line, depending on where end users come from.
The default value is Default.
This parameter is only configurable for public zone record sets.
- Default: returns the default resolution result irrespective of where the visitors come from.
- ISP: returns the resolution result based on visitors' carrier networks.
- Region: returns the resolution result based on visitors' geographical locations.
TTL (s)
300
Cache duration of the record set on a local DNS server, in seconds.
The default value is 300. The value ranges from 1 to 2147483647.
If your service address changes frequently, set TTL to a smaller value.
Learn more about TTL.
Value
192.168.12.2
192.168.12.3
IPv4 addresses mapped to the domain name.
You can enter up to 50 values, each on a separate line.
Weight
1
(Optional) Weight for the record set. The value ranges from 0 to 1000, and the default value is 1.
This parameter is only configurable for public zone record sets.
If a resolution line in a zone contains multiple record sets of the same type, you can set different weights to each record set.
Tag
example_key1
example_value1
(Optional) Identifier of the record set. Each tag contains a key and a value. You can add up to 20 tags to a record set.
Description
-
(Optional) Supplementary information about the record set.
The description can contain no more than 255 characters.
- 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: Verify the Configuration
For details, see How Do I Check Whether Record Sets Have Taken Effect?
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot