All Products
Search
Document Center

Alibaba Cloud DNS:Weight configuration

Last Updated:Dec 17, 2025

Weight configuration in Alibaba Cloud DNS lets you set multiple record values, such as IP addresses or CNAMEs, for the same host record and same DNS line. When responding to a query, the DNS server returns record values based on their configured weights. This feature distributes DNS traffic across different servers to achieve load balancing.

Prerequisites

To enable weight configuration, multiple A, CNAME, or AAAA records must exist for the same host record and DNS line of a domain name.

Note

When weight configuration is disabled:

  • For A, AAAA, NS, MX, and TXT records: Alibaba Cloud DNS returns all records for the specified line. The local DNS server then determines which record to return to the client. If the local DNS server returns all the addresses, the client randomly selects one to use.

  • For CNAME records: Alibaba Cloud DNS returns only one of the records.

Limits

Limit

Supported

Not supported

Record type

A, CNAME, and AAAA records.

Other record types.

Record status

Enabled records.

Paused or locked records, and wildcard DNS records.

DNS record limit

For a single domain name on a single DNS line, you can configure weights for a maximum of 10 DNS records in the Free Edition or 90 DNS records in paid editions.

Not applicable.

Weight value rules

You can set a weight from 0 to 100. The default weight ratio is 1:1. If you set the weight to 0, Alibaba Cloud DNS does not return the DNS record.

Not applicable.

Parsing a line

You can configure weighted A records for the default line or for specific lines.

Note

The weights for different lines are independent of each other.

You can enable or disable load balancing on a per-line basis.

Procedures

Add a DNS record for the first time

  1. On the Alibaba Cloud DNS - Authoritative Zone page, click the domain name to open the Settings page.

  2. On the Settings page, click Add Record.

    By default, when you add multiple records for the same host and line, weight configuration is enabled with a ratio of 1:1:1. In DNS responses, Alibaba Cloud DNS returns IP addresses based on this 1:1:1 weight policy.

    image

Modify a weight configuration

  1. On the Alibaba Cloud DNS - Authoritative Zone page, click the target domain name to open the Settings page.

  2. On the Settings page, click the drop-down button image next to Edit and then click Edit Record Set.image

  3. In the Edit Record Set dialog box, modify the record values and weights.

    image

Result

Effect without weight configuration

Assume that you have three servers with the IP addresses 1.1.XX.XX, 2.2.XX.XX, and 3.3.XX.XX. These servers provide the same service for a single domain name and are configured with the following three A records:

Record Type

Host Record

Line parsing

Record Value

A

www

Default

1.1.XX.XX

A

www

Default

2.2.XX.XX

A

www

Default

3.3.XX.XX

When a local DNS server queries Alibaba Cloud DNS, Alibaba Cloud DNS returns all three DNS records to the local DNS server. If the local DNS server returns all IP addresses, the visitor's browser randomly accesses one of them.

For an authoritative DNS server without load balancing, this method can reduce the load on a single server. However, it cannot differentiate between servers or reflect their current operational status.

Effect with default weights

When weight configuration is enabled with the default 1:1:1 ratio, Alibaba Cloud DNS uses round-robin to return the three IP addresses in sequence in response to queries. The DNS query results are as follows:

Access from Region1, returns 1.1.XX.XX
Access from Region2, returns 2.2.XX.XX
Access from Region3, returns 3.3.XX.XX
Access from Region4, returns 1.1.XX.XX
Access from Region5, returns 2.2.XX.XX
Access from Region6, returns 3.3.XX.XX
...

Effect with custom weights

After you enable and configure weights, IP addresses are returned in DNS responses based on the preset weights. This lets you distribute DNS traffic according to the specified ratios. For example, if you set the weight ratio of the three DNS records to 2:1:1, the DNS query results are as follows:

Access from Region1, returns 1.1.XX.XX
Access from Region2, returns 2.2.XX.XX
Access from Region3, returns 3.3.XX.XX
Access from Region4, returns 1.1.XX.XX
Access from Region5, returns 1.1.XX.XX
Access from Region6, returns 2.2.XX.XX
...
Note

During testing, you may find that DNS query results occasionally do not match the weight configuration. This is normal. Weighted round-robin is a coarse-grained traffic scheduling method that targets local DNS server requests. A local DNS server queries the authoritative DNS server (Alibaba Cloud DNS) only once within the Time to Live (TTL) period.

For example, your domain name is accessed by users in Shanghai and Beijing. Assume that users in Shanghai use localdnsA and users in Beijing use localdnsB. When localdnsA and localdnsB send query requests to Alibaba Cloud DNS, Alibaba Cloud DNS responds based on the configured weight policy. However, within the TTL period, all users who use the same local DNS server receive the same query result.