This topic guides you through the basic configuration of DNS records to correctly point your domain name to a web server or email service. Once configured, users can access your website via the domain name or send and receive emails using an email address with your custom domain.
Why configure DNS resolution?
DNS resolution translates human-readable domain names, such as www.example.com, into computer-readable IP addresses, such as 192.168.1.1. When you enter a domain name in a browser, the Domain Name System (DNS) looks up the corresponding IP address and directs the browser to the correct server. By configuring DNS records, you can link your domain name to your website.
Prerequisites
-
Obtain your web server's public IP address (in IPv4 format, for example:
192.0.2.0).-
Alibaba Cloud ECS users: View the public IP address in the ECS console.
-
If you use another service provider, contact them to obtain the public IP address.
-
-
Check your domain name status: Use a WHOIS tool to query the domain name status and verify that its status is normal. If the domain name has an abnormal status (such as
ClientHoldorServerHold), you must unlock the domain name before configuring its DNS records. -
Check ICP filing: If your web server is located in the Chinese mainland, you must complete an ICP filing for your domain name. Access to websites will be blocked if their domain names resolve to servers in the Chinese mainland without a valid ICP filing.
This topic uses Alibaba Cloud DNS as an example. If you use a different DNS service, follow the instructions provided by your DNS provider.
Check for existing records
Before configuring DNS records, check the existing records to determine if the domain name already points to a server.
-
Go to the Alibaba Cloud DNS console.
-
On the Public Authoritative DNS page, find the target domain name and click its name to go to the Settings page.
-
In the DNS record list, check for the following record types:
-
A record: The record value is an IPv4 address, such as
192.0.2.1. This indicates that the domain name points directly to the server. -
CNAME record: The record value is another domain name, such as
example.alb.aliyuncsslb.com. This indicates that the domain name points to the target service through an alias.
-
-
If an A record or CNAME record exists, the domain name already points to a server. If the list is empty or does not contain these record types, the domain name does not yet point to a server. Use the following scenarios to configure the DNS records.
Scenario quick links: Configure website DNS | Configure email DNS | Configure subdomain DNS | Bind a domain name to a third-party site builder
Scenario 1: Configure website DNS
This scenario shows you how to point a domain name, such as example.com, to your web server's IP address.
-
Go to the Domain Names console.
-
In the domain name list, select the domain name that you want to configure, and click Resolve in the Actions column.
-
On the Settings page, click ..., and then click Quick Add Website DNS.
ImportantConfirm that the message The DNS settings of the domain name are correct. is displayed at the top of the page. If an error is displayed, expand the details to run a self-diagnosis. If you encounter an error, you must first resolve the DNS server issue. Otherwise, any DNS records that you add will not take effect.
-
Configure the settings based on your needs.
-
The
@hostname represents the root domain (a domain name without any prefix, such asexample.com). -
To configure a subdomain, enter the subdomain prefix in the Hostname field and select its checkbox.
In the What is your business need? section, select Resolve website domain to server IPv4 address. In the Please select website domain section, select the hostname for the domain you want to resolve. In the Please enter website IP section, enter the server's IPv4 address, for example,
192.0.2.1. -
-
Enter your web server's public IP address and click OK to save the records.
A message confirms that the quick setup is complete and that the system has added two A records. The hostnames are @ and www, the Resolution Line for both is set to Default, the record value for both is
192.0.2.1, and the TTL is 10 minutes.
The preceding operations cover several commonly used DNS records (A, AAAA, and CNAME records). To add other types of records, click Add Record on the DNS settings page. For detailed instructions, see Add a DNS record.
Scenario 2: Configure email DNS
This scenario shows you how to configure an MX record for a business email service.
If you plan to use Alibaba Mail, we recommend that you first go to the Alibaba Mail console to activate the service and bind your domain name. After activation, the system guides you through the configuration of required DNS records, such as MX and TXT records. This eliminates the need for manual configuration in the DNS console. The following steps apply to scenarios where you need to manually configure DNS records for an existing email service.
-
Go to the Domain Names console.
-
In the domain name list, select the domain name that you want to configure, and in the Actions column, click Resolve.
-
On the Settings page, click ···, and then click Quick Add Mailbox DNS.
-
Select your email provider.
In the dialog box that appears, you can select Alibaba Mail (qiye.aliyun.com), DingTalk Mail, NetEase Free Enterprise Mail (ym.163.com), NetEase Enterprise Mail (qiye.163.com), Tencent Exmail (EXMAIL.QQ.COM), or Sina Enterprise Mail. Select one and click OK.
-
Click OK. The system automatically adds the required email DNS records.
Email DNS resolution can take up to 2 hours to stabilize. We recommend waiting this long before testing the service.
This is the quick method for configuring email DNS. If your email provider is not listed in the options, you must add the records manually.
Scenario 3: Configure subdomain DNS
A subdomain, such as blog.example.com or api.example.com, is a second-level domain that allows you to point different parts of your domain to different services.
Configuration examples:
|
Target destination |
Hostname |
Record type |
Record value |
|
Point blog.example.com to a server IP address |
blog |
A |
192.0.2.10 |
|
Point api.example.com to another service |
api |
CNAME |
cname.otherservice.com |
Procedure:
If you have already registered a domain name, you do not need to register its subdomains separately. You only need to configure dedicated DNS records for each subdomain. The process is the same as the website DNS configuration. The key difference is what you enter for the hostname.
-
Go to the Domain Names console.
-
In the domain name list, select the domain name to configure, then in the Actions column, click Resolve.
-
On the Settings page, click Add Record.
-
Enter the parameters:
-
Record Type: Select
AorCNAMEas required. -
hostname: Enter the subdomain prefix (such as
blog,shop, orapi). -
record value: Enter the destination IP address or domain name.
-
-
Click OK to save.
Scenario 4: Bind to a third-party site builder
If you use a third-party site builder such as Shopify, you need to add a CNAME record in the Alibaba Cloud DNS console to point your domain name to the address provided by the platform.
Prerequisites
-
You have registered a domain name with Alibaba Cloud, and it has a normal status.
-
You have created an online store in Shopify and obtained the required DNS record information from your Shopify admin panel. Shopify typically requires you to add a CNAME record with the record value
shops.myshopify.com.
Procedure
-
Go to the Domain Names console.
-
In the domain name list, find your target domain name, and click Resolve in the Actions column.
-
On the Settings page, click Add Record.
-
Enter the following parameters:
-
Record Type: Select
CNAME. -
hostname: Enter
www. To bind the root domain (the domain name without the www prefix), enter@for the hostname. However, some site builders do not support CNAME records for root domains. -
record value: Enter
shops.myshopify.com. (This is an example for Shopify. For other platforms, enter the CNAME target they provide.)
-
-
Click OK to add the DNS record.
After the record is added, wait for the DNS change to propagate, which usually takes a few minutes. Then, visit your domain name in a browser to confirm that it redirects to your Shopify site.
An A record and a CNAME record cannot exist for the same hostname. If the target hostname already has an A record, you must delete it before adding the CNAME record.
Verifying DNS resolution
Understand DNS propagation time
-
New DNS records: Usually take effect immediately.
-
Modified DNS records: The time they take to propagate depends on the Time To Live (TTL) setting. For example, a record with a TTL of 10 minutes should theoretically propagate globally in 10 minutes.
However, some carriers' local DNS servers may enforce longer cache times, which can delay the propagation of changes or deletions. Full propagation can take up to 48 hours. Therefore, when you make changes, ensure that the service is available at both the old and new IP addresses to avoid service disruption for your users.
Recommendations:
-
Before modifying a DNS record, lower its TTL value and wait for one old TTL cycle to pass before making the change.
-
After the modification is complete, ensure that services at both the old and new IP addresses or endpoints are available for at least one TTL cycle to ensure a smooth transition.
Check the resolution result
-
Browser access: Visit the configured domain name (for example,
http://your-domain.com) directly in your browser to confirm that the website content loads. -
Use online tools: Go to Alibaba Cloud DNS and click Probing next to the target domain name.
NoteAlibaba Cloud also provides a network diagnostic tool and a DNS probing tool that you can use to check if resolution is working correctly or to view results from various locations. For more information, see How to test DNS record propagation.
-
Command-line tool: Use the dig or nslookup command in your local terminal to query the record and verify the result.
-
If the query result matches the record value you configured, the DNS record has taken effect.
-
If they do not match, wait for the DNS cache to update. For troubleshooting, see Troubleshoot an inaccessible domain name or website.
-
Troubleshooting
DNS records are not taking effect
Symptom: DNS records have been added, but the website or service is inaccessible via the domain name.
Troubleshooting steps:
-
Check DNS server status:
Go to your domain's DNS settings page and confirm that the message at the top indicates "The domain's DNS information is configured correctly." If an error is shown, follow the instructions in Handle abnormal DNS server status.
-
Check domain name status:
Use a WHOIS lookup tool to check your domain name and confirm its status is not
ClientHoldorServerHold. If the domain is locked, see Unlock a domain name. -
Check record configuration:
-
Is the hostname correct? (@ represents the root domain, and www represents the www subdomain).
-
Is the record value correct? (Check the IP address format and the spelling of the target domain name).
-
Are there any record conflicts? (The same hostname cannot have both an A record and a CNAME record).
-
-
Check the server:
-
Is the server running? Try accessing it directly via its IP address (for example,
http://192.0.2.1). -
Are the required ports open? Check if your security group or firewall allows traffic on ports 80 (HTTP) and 443 (HTTPS).
-
Is ICP filing completed? Servers in the Chinese mainland must have a completed ICP filing. Otherwise, access is blocked.
-
-
Wait for DNS propagation:
-
New records: Wait 10 minutes and try again.
-
Modified records: Wait up to 48 hours and try again.
-
For more troubleshooting steps, see How do I troubleshoot an inaccessible domain name or website?
Record conflicts
Symptom: A conflict error appears when you add a DNS record, or the resolution result is unexpected.
Conflict rules and solutions:
|
Conflict type |
Description |
Solution |
|
A + CNAME |
The same hostname cannot have both an A record and a CNAME record. |
Delete one of the conflicting records and keep the one you need. |
|
Multiple SPF |
A domain name can have only one SPF record. |
Merge them into a single record. |
For more DNS record rules, see DNS record conflict rules.
Core concepts: Record types
|
Record type |
Description |
Value format |
Scenarios |
|
A |
Points a domain name to an IPv4 address. |
IPv4 address, such as 192.0.2.1 |
Pointing a domain to a website server |
|
AAAA |
Points a domain name to an IPv6 address. |
IPv6 address, such as 2001:db8::1 |
Providing IPv6 access for a website |
|
CNAME |
Points a domain name to another domain name (alias), enabling indirect resolution. |
Another valid domain name |
Pointing a domain name to a CDN or SaaS service |
|
MX |
Specifies the mail server that handles emails for the domain name. |
Priority (number) + Mail server domain |
Business email configuration |
|
TXT |
Provides text information, often used to verify domain ownership or configure security policies. |
Free-form text string |
Various verifications (such as SSL, SPF, email, and DNS verification) |