Private DNS allows you to set weights for IP addresses or domain names when you configure multiple IP addresses or domain names for the same hostname and request line on a DNS server. When Private DNS responds to DNS requests, it returns different DNS records based on the preset weights of IP addresses or domain names. This way, service requests are allocated to different servers to implement load balancing.
Prerequisites
You can set weights only for the domain names in built-in authoritative acceleration zones. You cannot set weights for the domain names in built-in authoritative regular zones.
Multiple DNS records of a domain name are of the same type and have the same hostname and request line. The supported DNS record types are A, AAAA, and CNAME.
Limits
Item | Supported | Not supported |
Built-in authoritative zones | Acceleration zones | Regular zones |
Record type | A, AAAA, and CNAME | Other record types |
Number of DNS records supported | 100 | N/A |
Weight | The weight for a DNS record can be set to a value in the range of 0 to 100. By default, DNS records have the same weight. If the weight for a DNS record is set to 0, the built-in authoritative module does not return this DNS record. If the weights for all DNS records are set to 0, the built-in authoritative module returns all DNS records. | N/A |
Request line | The default, Alibaba Cloud, and user-defined request lines are supported. Note The weights for different request lines are independent of each other. | DNS records of different request lines |
For the same hostname and request line, a domain name in a built-in authoritative acceleration zone can have multiple DNS records of the CNAME type, and the weight switch cannot be turned off. For the same hostname and request line, a domain name in a built-in authoritative regular zone can have only one DNS record of the CNAME type.
Procedure
The following steps describe how to set weights for multiple DNS records of the A type.
Log on to the Alibaba Cloud DNS console.
In the left-side navigation pane, click Private DNS (PrivateZone). In the upper-right corner of the page, click Configuration Mode. On the page that appears, click the Built-in Authoritative Module tab. On this tab, click User Defined Zones.
On the User Defined Zones tab, find the desired zone and click Resource Records Settings in the Actions column.
On the Resource Records Settings tab, click Add Record. In the Add Record panel, select Form Editor Mode or Visual Editor Mode. In this example, Form Editor Mode is selected.
In the Add Record panel, set the Record Type, Hostname, Request Line, and TTL parameters, turn on the Enable Weight Policy switch, configure multiple DNS records based on your business requirements, and set weights for these DNS records. Click OK.
NoteIf the weight-based DNS resolution feature is not enabled, the built-in authoritative module returns all DNS records by default. If multiple DNS records of the CNAME type are found, only one DNS record is returned at a time.