Help Center/ Domain Name Service/ User Guide/ Public DNS Resolution/ Record Sets/ Configuring a Wildcard DNS Record Set
Updated on 2026-07-01 GMT+08:00

Configuring a Wildcard DNS Record Set

Scenarios

A wildcard record set with its name set to an asterisk (*) can map all subdomains of the domain name to the same value. During domain name resolution, fuzzy match is used.

This section describes how to create a wildcard DNS record set.

Constraints

  • Wildcard DNS resolution does not support NS and SOA record sets.
  • Exact match has a higher priority than fuzzy match for the same domain name.

Procedure

  1. Go to the Public Zones page.
  2. Click the name of the zone to which you want to add a wildcard DNS record set.
  3. Click Add Record Set.
  4. Configure the parameters based on Table 1.
    Table 1 Parameters for adding a wildcard DNS record set

    Parameter

    Description

    Example

    Type

    Record set type

    Wildcard DNS resolution does not support NS and SOA record sets.

    A – Map domains to IPv4 addresses

    Name

    Public or private domain name

    Enter an asterisk (*) as the leftmost label of the domain name, for example, *.example.com.

    NOTE:

    Only the leftmost asterisk is considered as a wildcard character. Other asterisks in the domain name are common text characters.

    *

    Line

    A specific route or path that the DNS server uses to determine which IP address to return based on the user's location, ISP, or other attributes.

    The default value is Default.

    • Default: returns the default resolution result irrespective of where the visitors come from.
    • ISP: returns the resolution result based on end users' carrier networks. For details, see Configuring ISP Lines.
    • Region: returns the resolution result based on end users' geographical locations. For details, see Configuring Region Lines.
    • Custom Lines: returns the resolution result based on specified IP address ranges. For details, see Configuring Custom Lines.

    Default

    TTL (s)

    How long a local DNS server caches a DNS record. It is measured in seconds.

    Default value: 300

    Value range: 1 to 2147483647

    If your service address changes frequently, set TTL to a smaller value. Otherwise, set TTL to a larger value.

    300

    Value

    Returned result of domain name resolution.

    For details about how to configure the value for each type of record set, see Table 1.

    The following uses an A record set as an example:

    192.168.xx.2

    192.168.xx.3

    Alias Target

    Cloud resource to be associated with the alias record set, which includes the cloud resource name and alias target.

    Enterprise Web Portal and example.com

    Weight

    Weight for the record set.

    Default value: 1

    The value ranges from 0 to 1000.

    If a resolution line in a zone contains multiple record sets of the same type, you can set different weights to each record set. For details, see Configuring Weighted Routing.

    1

    Tag

    Identifier of the record set. Each tag contains a key and a value.

    You can add up to 20 tags for a record set.

    The tag key:

    • Cannot be left blank.
    • Must be unique for each resource.
    • Can contain a maximum of 128 characters.
    • Cannot start or end with a space, or cannot start with _sys_. Only letters, digits, spaces, and the following special characters are allowed: _.:=+-@

    The tag value:

    • Can be left blank.
    • Can contain a maximum of 255 characters.
    • Can contain letters, digits, spaces, and special characters _.:/=+-@
    NOTE:

    If your organization has configured tag policies for the DNS service, you need to add tags to your record sets based on the tag policies. If you add a tag that does not comply with the tag policies, record sets may fail to be created. Contact the administrator to learn more about tag policies.

    example_key1

    example_value1

    Description

    Supplementary information about the record set.

    You can enter a maximum of 255 characters.

    This is a wildcard DNS record set.

  5. Click OK.
  6. Switch back to the Record Sets tab.

    The wildcard DNS record set is in the Normal state.

    For details, see How Do I Check Whether a Record Set Has Been Applied?

Wildcard Resolution Rules

DNS allows you to add a record set with the record set name set to an asterisk (*), for example, *.example.com. This can map all subdomains to the same value.

If you have added a wildcard record set for a domain name and added multiple record sets of the same type but different line for a specific subdomain, the DNS resolution complies with the following rules:

  • Priority: Line match has a higher priority than domain name match. During a DNS query, the system first checks whether a query matches a specific line (such as China Unicom, China Telecom, or China Mobile). If no result is found, the system matches the domain name.
  • Priority of queries in the same line: If the line type is the same, exact match has a higher priority than fuzzy match.
  • Priority for interaction between intelligent resolution and default lines: Wildcard domain name query matches the intelligent line, and exact domain name query matches the default line. If both of them are matched, the exact domain name query result is used.

Take example.com as an example.

  1. Configure wildcard records and a record for the subdomain starting with www.
    The following table lists the parameter settings.

    Subdomain

    Line

    Record Set Type

    Value

    www.example.com

    Default

    A

    4.4.xx.xx

    *.example.com

    Default line for China Telecom

    A

    1.1.xx.xx

    *.example.com

    Default line for China Unicom

    A

    2.2.xx.xx

    *.example.com

    Default line for China Mobile

    A

    3.3.xx.xx

    When a visitor is a China Telecom, China Unicom, or China Mobile user, 4.4.xx.xx is returned.

    Rule: If both wildcard and exact domain name queries are matched, the exact domain name query result is used.

  2. Configure intelligent resolution for the subdomain www.example.com.

    Subdomain

    Line

    Record Set Type

    Value

    www.example.com

    Default

    A

    4.4.xx.xx

    *.example.com

    Default line for China Telecom

    A

    1.1.xx.xx

    www.example.com

    Default line for China Telecom

    A

    1.1.xx.xx

    *.example.com

    Default line for China Unicom

    A

    2.2.xx.xx

    www.example.com

    Default line for China Unicom

    A

    2.2.xx.xx

    *.example.com

    Default line for China Mobile

    A

    3.3.xx.xx

    www.example.com

    Default line for China Mobile

    A

    3.3.xx.xx

    When visitors are China Telecom, China Unicom, or China Mobile users and they are accessing www.example.com, 1.1.xx.xx is returned for the China Telecom user, 2.2.xx.xx is returned for the China Unicom user, and 3.3.xx.xx is returned for the China Mobile user.

    Rule: Line match has a higher priority than domain name match. If the line type is the same, exact match has a higher priority than fuzzy match.