All Products
Search
Document Center

Alibaba Cloud DNS:Wildcard DNS

Last Updated:Feb 13, 2026

Wildcard DNS uses a * as the host record to point all subdomains to a single IP address, which is the record value. For example, if you configure a wildcard record for *.example.com for the example.com domain name, all subdomains, such as a.example.com and b.example.com, will resolve to the same IP address as *.example.com.

Scenarios

You can configure wildcard DNS to redirect an entire domain, specify a single entry point for subdomains, or resolve to a fallback service page.

Supported record types for wildcard domain names

A, AAAA, CNAME, NS, MX, TXT, CAA, explicit URL/implicit URL, SVCB, and HTTPS records.

Procedure

  1. On the Alibaba Cloud DNS – Public Network Authoritative Resolution page, click the target domain name to open the Resolution Settings page.

  2. On the Settings page, click the Add Record button.

    image

  3. Effectiveness validation.

    Run the dig a.example.net command. Verify that the returned DNS record matches the value you added.

Wildcard DNS query rules

  • A DNS query first attempts to match a line, then attempts to match a domain name.

  • Within the same line, an exact-match domain name query takes precedence over a wildcard query. A wildcard record is used only if no other records match the query.

  • If a wildcard query matches a smart line and an exact-match query matches the default line, the exact-match record on the default line is used.

Example 1

Host Record

Record Type

Line

Record Value

www.example.com

A

Default

1.1.1.1

api.example.com

A

Default

2.2.2.2

*.example.com

A

Default

3.3.3.3

  • A query for www.example.com resolves to 1.1.1.1. This is because it matches the exact-match A record, rather than the wildcard record.

  • A query for api.example.com resolves to 2.2.2.2. This is because it matches the exact-match A record, rather than the wildcard record.

  • A query for test.example.com resolves to 3.3.3.3. This is because no exact-match record is found. Therefore, the wildcard record is used.

  • A query for abc.def.example.com (a second-level subdomain) resolves to 3.3.3.3. This is because no exact-match record is found. Therefore, the wildcard record is used.

Example 2

Wildcard DNS records are configured for example.com for the China Unicom, China Telecom, and China Mobile lines:

Host Record

Record Type

Line

Record Value

*

A

China Unicom

1.1.x.x

*

A

Telecommunications

1.1.x.x

*

A

shift

1.1.x.x

www

A

Default

4.4.x.x

When users on the China Unicom, China Telecom, and China Mobile lines access www.example.com, the domain name resolves to 4.4.x.x. Although the query matches a line with a wildcard configuration, an exact-match record exists on the default line. Therefore, the record from the default line is returned.

If you want www.example.com to resolve to 1.1.XX.XX for users on the China Unicom, China Telecom, and China Mobile lines, you must add a DNS record for example.com with the host record www for each of the three lines that use wildcard domain names, as shown below.

Host Record

Record Type

Line

Record Value

*

A

China Unicom

1.1.x.x

www

A

China Unicom

1.1.x.x

*

A

Telecommunications

1.1.x.x

www

A

Telecom

1.1.x.x

*

A

shift

1.1.x.x

www

A

China Mobile

1.1.x.x

www

A

Default

4.4.x.x

Now, when users on the China Unicom, China Telecom, and China Mobile lines access www.example.com, the domain name resolves to 1.1.x.x.