Scenarios
Your application is deployed at two sites. Each site has a public IPv4 address and a public IPv6 address. When a site is running normally, clients can access it using either its IPv4 or IPv6 address. If an IPv4 or IPv6 address becomes unhealthy, traffic automatically fails over to a healthy address of the same IP version.
An unhealthy IPv4 address can fail over only to another healthy IPv4 address. The same rule applies to IPv6 addresses.
An unhealthy IPv4 or IPv6 address cannot fail over to an address of a different IP version. This is because the record type is already specified in the DNS query from the client.
Prerequisites
The domain name
cloud-example.comis managed by Alibaba Cloud DNS. The service domain name to be added to Global Traffic Manager (GTM) iswww.cloud-example.com.NoteIf your service domain name is not managed by Alibaba Cloud DNS, add a CNAME record with your current DNS provider. Point the record to the GTM access domain name.
You have purchased a GTM instance. If you have not purchased an instance, you must first purchase a subscription instance.
Expected outcome
Expected traffic rerouting result:
Source of DNS query | Application service address | Failover address |
Global default (A record request) | 1.1.XX.XX | 2.2.XX.XX |
Global default (AAAA record request) | 240e:f7:7000:c2:3::1XX | 240e:f7:7000:c2:3::2XX |
Procedure
Configure disaster recovery for IPv4 addresses
Go to the Alibaba Cloud DNS - Global Traffic Manager console.
On the Access Domain tab, click Create Access Domain.
In the Select Scenario dialog box, select Primary/Secondary Disaster Recovery.
On the Create Access Domain page, click the access domain name icon and select Basic Configuration.

After you configure the parameters on the Basic Configuration page, click Submit. For more information, see Configure an access domain name.
Access Domain: The domain name of the service, such as
www.cloud-example.com.For Record Type, select the A record.

On the current page, click the address pool icon and select Basic Configuration.

On the Access Domain page, click the address icon and select Basic Configuration. On the configuration page, add an address, configure a health check template, and then create the address. This example uses the TCP protocol to probe port 80 on the server. Use this method to add the address and associate it with a health check template.
NoteIf you have not created a health check template, click Add Health Check Template. For more information, see 4. Probe templates.
ImportantThis example demonstrates the configuration process. If you see red or orange alert metrics during configuration, check the health status of the address immediately.
You do not usually need to configure a load balancing policy because the application scenario template automatically generates one.
ImportantIf application data between your primary and standby addresses uses one-way synchronization, data generated on the standby site during a failover cannot be synchronized to the primary site. Set the load balancing policy between the addresses to Non-Preemptive Mode. For more information, see 2. Configure an address pool.
Configure disaster recovery for IPv6 addresses
Go to the Alibaba Cloud DNS - Global Traffic Manager console.
On the Access Domain tab, click Create Access Domain.
In the Select Scenario dialog box, select Primary/Secondary Disaster Recovery.
On the Create Access Domain page, click the access domain name icon and select Basic Configuration.

Complete the parameter settings on the page and then click Submit. For more information, see Access domain name configuration.
Access Domain: The domain name that is used for access, such as
www.cloud-example.com. The access domain name must match the domain name in the A record.Record Type: Select AAAA.
ImportantIf the access domain name already has an attached instance, the Bind Instance drop-down list displays the The current access domain name is bound to an instance, and the instance can be reused. option. You can select this option to reuse the instance.
For a single domain name, you can enable instances if you set the Record Type to both A and AAAA. However, setting the Record Type to A and CNAME or AAAA and CNAME causes a conflict and prevents the instances from being enabled.

Follow the procedure for configuring disaster recovery for IPv4 addresses to configure the IPv6 address pool, addresses, and health checks.
ImportantIf the monitored object is an IPv6 address, set Type to IPv6 when you create a monitoring template.

Configure monitoring and alerting for the instance. For more information, see Alert configuration.
On the Access Domain page, click the icon for the domain name, and select Enable.

After you confirm the operation in the dialog box, the Access Domain is enabled.
ImportantIf a DNS record with the same name and type exists in the Alibaba Cloud DNS authoritative zone, the system prioritizes GTM policies for intelligent scheduling and resolution. This allows GTM to handle queries for that record type and implement advanced features such as load balancing or failover.
If you disable or delete the GTM domain name instance, the domain name is resolved using the Public Zone.