All Products
Search
Document Center

Alibaba Cloud DNS:Wildcard DNS

Last Updated:Nov 26, 2025

Wildcard DNS uses an asterisk (*) as the host record to resolve all subdomains to the same IP address (record value). For example, if you configure wildcard DNS for *.example.com, all subdomains of example.com, such as a.example.com and b.example.com, are resolved to the same IP address as *.example.com.

Scenarios

You can configure wildcard DNS to resolve all subdomains of a domain name to a single entry point or a fallback service page.

Supported record types for wildcard domain names

A, AAAA, CNAME, NS, MX, TXT, CAA, Explicit/Implicit URL, SVCB, and HTTPS records.

Method

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

  2. On the Settings page, click Add Record.

    image

  3. Verify the configuration.

    Run the dig a.example.net command to verify that the returned DNS record matches the value you configured.

Wildcard DNS query rules

  • A DNS query first matches the line, and then the domain name.

  • For a specific line, an exact-match domain name takes precedence over a wildcard domain name. The wildcard record is used only if no exact-match record is found for the query.

  • If a query matches a wildcard record on a smart line and an exact-match record on the default line, the exact-match record from 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 returns 1.1.1.1 (The query matches the exact A record).

  • A query for api.example.com returns 2.2.2.2 (The query matches the exact A record).

  • A query for test.example.com returns 3.3.3.3 (The wildcard record is used because no exact match is found).

  • A query for abc.def.example.com (a second-level subdomain) returns 3.3.3.3 (The wildcard record is used because no exact match is found).

Example 2

Wildcard DNS records are configured for example.com on 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

China Mobile

1.1.x.x

www

A

Default

4.4.x.x

When users from China Unicom, China Telecom, or China Mobile access www.example.com, the domain name resolves to 4.4.x.x. This occurs because the exact-match record on the default line takes precedence over the wildcard record on the smart lines.

To resolve www.example.com to 1.1.x.x for users from China Unicom, China Telecom, and China Mobile, add a specific DNS record for the www host on each of these lines for example.com. The following table shows the configuration.

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

China Telecom

1.1.x.x

*

A

shift

1.1.x.x

www

A

Shift

1.1.x.x

www

A

Default

4.4.x.x

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