Thiết lập primary zone (Full setup) Change your nameservers (Full setup)
Hướng dẫn chi tiết đồng bộ từ docs Cloudflare — mỗi section có backlink tới đúng vị trí trên trang gốc. Detailed guide synced from Cloudflare docs — each section links to the matching anchor on the official page.
← Danh mục ← CatalogGiải thích nhanh Quick context
Thuộc nhóm Application Services — tập trung bảo vệ, tăng tốc và vận hành ứng dụng/web phía trước origin. Tutorial «Thiết lập primary zone (Full setup)» giúp bạn làm quen luồng triển khai thật — phù hợp đọc trước khi mở tài liệu gốc tiếng Anh. Docs gốc chia khoảng 4 bước chính; bản tóm tắt dưới đây giúp bạn nắm khung trước khi làm theo từng lệnh.
If you want to use Cloudflare as your primary DNS provider and manage your DNS records, your domain should be using a full setup.
Lưu ý trước khi làm Notes before you start
- Đây là bản tóm tắt trên Orange Cloud Learning Hub — không thay thế tài liệu chính thức. This is a summary on Orange Cloud Learning Hub — it does not replace the official documentation.
- Luôn mở liên kết «Tài liệu gốc» bên dưới khi cần lệnh CLI, snippet code và ảnh minh họa đầy đủ. Open the Official docs link below for CLI commands, code snippets, and full screenshots.
- Docs Cloudflare cập nhật thường xuyên — đối chiếu ngày «Rà soát lần cuối» trên trang gốc khi triển khai production. Cloudflare docs change frequently — verify the Last reviewed date on the official page before production use.
Tổng quan Overview
Phần «Tổng quan» — đọc hướng dẫn bên dưới, dùng liên kết docs gốc để xem ảnh minh họa và tab cấu hình đầy đủ.
Read the "Overview" section below — open the official docs link for full screenshots and configuration tabs.
Cloudflare DNS offers a few different setup options. A primary setup (also known as full) is the most common and the only one available for Free or Pro plans. For details, refer to About. For more introductory context, refer to Concepts.
Liên kết liên quan (docs Cloudflare) Related links (Cloudflare docs)
Before you begin Before you begin
Phần «Before you begin» — đọc hướng dẫn bên dưới, dùng liên kết docs gốc để xem ảnh minh họa và tab cấu hình đầy đủ.
Read the "Before you begin" section below — open the official docs link for full screenshots and configuration tabs.
Make sure that you:
- Create a Cloudflare account — If you have not already, sign up for a Cloudflare account.
- Own a domain name — You need a registered domain (for example,
example.com). If you do not have one, you can register a domain at-cost through Cloudflare Registrar ↗. Domains purchased through Cloudflare Registrar automatically use Cloudflare for authoritative DNS, so you can skip the rest of this tutorial.
Liên kết liên quan (docs Cloudflare) Related links (Cloudflare docs)
1. Thêm your domain to Cloudflare 1. Add your domain to Cloudflare
Phần «Thêm your domain to Cloudflare» — đọc hướng dẫn bên dưới, dùng liên kết docs gốc để xem ảnh minh họa và tab cấu hình đầy đủ.
Read the "1. Add your domain to Cloudflare" section below — open the official docs link for full screenshots and configuration tabs.
- Log in to the Cloudflare dashboard ↗.
- Select Onboard a domain.
- Enter your apex domain (for example,
example.com) and choose how you would like to add your DNS records. - Select Continue and choose a plan ↗.
Required API token permissions
At least one of the following token permissionsis required:
Zone Zone EditZone DNS Edit
Create Zone
curl "https://api.cloudflare.com/client/v4/zones" \
--request POST \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--json '{
"name": "<YOUR_DOMAIN>",
"account": {
"id": "<YOUR_ACCOUNT_ID>"
}
}' If Cloudflare is unable to identify your domain as a registered domain, make sure you are using an existing top-level domain ↗ (.com, .net, .biz, or others).
Cloudflare requires your apex domain to be one level below a valid TLD defined in the Public Suffix List (PSL) ↗. Enterprise customers can onboard lower-level subdomains using Subdomain setup.
DNS records quick scan
Cloudflare can automatically scan for your records and add them to the DNS zone for you, or you can add records manually. These records show up under your domain on the DNS Records ↗ page of the dashboard.
If you add a zone via the API, you can manually invoke the quick scan with the Trigger DNS Records Scan endpoint.
Liên kết liên quan (docs Cloudflare) Related links (Cloudflare docs)
2. Review your DNS records 2. Review your DNS records
Phần «Review your DNS records» — đọc hướng dẫn bên dưới, dùng liên kết docs gốc để xem ảnh minh họa và tab cấu hình đầy đủ.
Read the "2. Review your DNS records" section below — open the official docs link for full screenshots and configuration tabs.
Your DNS records must be accurate for your domain to work properly. If you don't know what DNS records are, consider the video below for a quick explanation.
If you activate your domain on Cloudflare without setting up the correct DNS records for your domain, your visitors may experience DNS\PROBE\FINISHED\_NXDOMAIN errors.
Common records Common records
Phần «Common records» — đọc hướng dẫn bên dưới, dùng liên kết docs gốc để xem ảnh minh họa và tab cấu hình đầy đủ.
Read the "Common records" section below — open the official docs link for full screenshots and configuration tabs.
Since the quick scan is not guaranteed to find all existing DNS records, you need to review your records, paying special attention to the following:
More about zone apex records Zone apex refers to the domain or subdomain that you are adding to Cloudflare. Usually, the zone apex record makes your domain accessible by visitors. In this case, the necessary record type (A, AAAA, or CNAME) and its content will depend on the provider that hosts your website or application. If you are using Cloudflare Workers, refer to Custom domains. If you are using other providers, look for their guidance on how to connect domains managed on external DNS services. Then, make sure you have the records required by your hosting provider on your DNS records table at Cloudflare.
More about subdomain records Most subdomains serve a specific purpose within the overall context of your website. For example, blog.example.com might be your blog, support.example.com could be your customer help portal, and store.example.com would be your e-commerce site. Even if you do not require specific subdomains, you might want to set up at least a subdomain record on www. It will usually point to the same content as what you have on the apex domain (example.com) or use a redirect. Having a subdomain DNS record on www helps guarantee that a visitor who types www. in front of your domain address can still find your website or application.
More about email records Depending on your business needs, you can configure DNS records so that you can use your domain to receive emails, receive and send emails from your domain, or prevent others from sending emails on your behalf (spoofing). Below are some examples of what those DNS records might look like. The exact values for your DNS mail records depend on your email provider. If you have issues, review the Troubleshooting and contact your email service provider to confirm your DNS records are correct. | Type | Name | Content | Proxy status | TTL | | ---- | -------------- | ----------------------------- | ------------ | ---- | | A | mail | 192.0.2.1 | DNS Only | Auto | | MX | example.com | 5 john.mx.example-server.test | DNS Only | Auto | | TXT | \dmarc | "v=DMARC1; p=reject; sp=... | DNS Only | Auto | | TXT | \*.\domainkey | "v=DKIM1; k=rsa; p=..." | DNS Only | Auto | | TXT | example.com | "v=spf1 ip4:..." | DNS Only | Auto |
Liên kết liên quan (docs Cloudflare) Related links (Cloudflare docs)
Proxy status Proxy status
Phần «Proxy status» — đọc hướng dẫn bên dưới, dùng liên kết docs gốc để xem ảnh minh họa và tab cấu hình đầy đủ.
Read the "Proxy status" section below — open the official docs link for full screenshots and configuration tabs.
Each A, AAAA, and CNAME record has a proxy status toggle:
- Proxied (orange cloud): web traffic goes through the Cloudflare network, which provides caching, DDoS protection, and other security features.
- DNS only (gray cloud): Cloudflare returns the DNS record value but does not proxy traffic. Use this for CNAME records that verify your domain for third-party services.
Liên kết liên quan (docs Cloudflare) Related links (Cloudflare docs)
3. Change your nameservers 3. Change your nameservers
Phần «Change your nameservers» — đọc hướng dẫn bên dưới, dùng liên kết docs gốc để xem ảnh minh họa và tab cấu hình đầy đủ.
Read the "3. Change your nameservers" section below — open the official docs link for full screenshots and configuration tabs.
Your domain will be assigned two authoritative Cloudflare nameservers. Nameservers are specialized servers that store your domain's DNS records and "answer" requests from browsers by providing the specific IP address needed to connect to your website.
Warning
If your domain is particularly sensitive to downtime, review our suggestions to minimize downtime.
Liên kết liên quan (docs Cloudflare) Related links (Cloudflare docs)
3. 1. Get nameserver names 3.1. Get nameserver names
Phần «1. Get nameserver names» — đọc hướng dẫn bên dưới, dùng liên kết docs gốc để xem ảnh minh họa và tab cấu hình đầy đủ.
Read the "3.1. Get nameserver names" section below — open the official docs link for full screenshots and configuration tabs.
Your assigned nameservers are displayed as part of the onboarding flow. If you need to find them once again, go the zone Overview page.
Required API token permissions
At least one of the following token permissionsis required:
Trust and Safety WriteTrust and Safety ReadZero Trust: PII ReadZaraz EditZaraz ReadZaraz AdminAccess: Apps and Policies RevokeAccess: Apps and Policies WriteAccess: Apps and Policies ReadAccess: Apps and Policies RevokeAccess: Mutual TLS Certificates WriteAccess: Organizations, Identity Providers, and Groups WriteZone Settings WriteZone Settings ReadZone ReadDNS ReadWorkers Scripts WriteWorkers Scripts ReadZone WriteWorkers Routes WriteWorkers Routes ReadStream WriteStream ReadSSL and Certificates WriteSSL and Certificates ReadLogs WriteLogs ReadCache PurgePage Rules WritePage Rules ReadLoad Balancers WriteLoad Balancers ReadFirewall Services WriteFirewall Services ReadDNS WriteApps WriteAnalytics ReadAccess: Apps and Policies WriteAccess: Apps and Policies Read
Zone Details
curl "https://api.cloudflare.com/client/v4/zones/$ZONE_ID" \
--request GET \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" Cloudflare automatically assigns nameservers to a domain and these assignments cannot be changed. For more details, refer to Nameserver assignments.
Liên kết liên quan (docs Cloudflare) Related links (Cloudflare docs)
3. 2. Log in vào registrar 3.2. Log in to your registrar
Phần «2. Log in vào registrar» — đọc hướng dẫn bên dưới, dùng liên kết docs gốc để xem ảnh minh họa và tab cấu hình đầy đủ.
Read the "3.2. Log in to your registrar" section below — open the official docs link for full screenshots and configuration tabs.
Log in to the admin account for your domain registrar. If you do not know your provider, use ICANN Lookup ↗.
Depending on your use case, you may have to perform this step on the DNS records management of your domain parent zone, or at a domain reseller, instead. Refer to Nameservers for details.
Liên kết liên quan (docs Cloudflare) Related links (Cloudflare docs)
3. 3. Turn off DNSSEC 3.3. Turn off DNSSEC
Phần «3. Turn off DNSSEC» — đọc hướng dẫn bên dưới, dùng liên kết docs gốc để xem ảnh minh họa và tab cấu hình đầy đủ.
Read the "3.3. Turn off DNSSEC" section below — open the official docs link for full screenshots and configuration tabs.
If your domain has DNSSEC1 active, you must turn it off at your registrar before replacing nameservers. Changing nameservers while DNSSEC is active can cause your domain to become unreachable. You can re-enable DNSSEC through Cloudflare after your domain is active.
Provider-specific DNSSEC instructions
This is not an exhaustive list, but the following links may be helpful:
- DNSimple ↗
- Domaindiscount24 ↗
- DreamHost ↗
- Dynadot ↗
- Enom ↗
- Gandi ↗
- GoDaddy ↗
- Hostinger ↗
- Hover ↗
- Infomaniak ↗
- InMotion Hosting ↗
- INWX ↗
- Joker.com ↗
- Name.com ↗
- Namecheap ↗
- NameISP ↗
- Namesilo ↗
- OVH ↗
- Squarespace ↗
- Registro.br ↗
- Porkbun ↗ (do not fill out keyData)
- TransIP ↗
If your previous provider allows you to add DNSKEY records on the zone apex and use these records in responses to DNS queries, refer to this migration tutorial to learn how to migrate a zone with DNSSEC enabled.
Liên kết liên quan (docs Cloudflare) Related links (Cloudflare docs)
3. 4. Update your registrar 3.4. Update your registrar
Phần «4. Cập nhật your registrar» — đọc hướng dẫn bên dưới, dùng liên kết docs gốc để xem ảnh minh họa và tab cấu hình đầy đủ.
Read the "3.4. Update your registrar" section below — open the official docs link for full screenshots and configuration tabs.
- Remove your existing authoritative nameservers.
- Add the nameservers provided by Cloudflare. If their names are not copied exactly, your DNS will not resolve correctly.
Provider-specific instructions
This is not an exhaustive list of provider-specific instructions, but the following links may be helpful:
- Ionos ↗
- 101Domain ↗
- Amazon ↗
- Blacknight ↗
- BlueHost ↗
- DirectNIC ↗
- DNSMadeEasy ↗
- Domain.com ↗
- Dotster ↗
- DreamHost ↗
- EasyDNS ↗
- Enom ↗
- Fast Domain ↗
- FlokiNET ↗
- Gandi ↗
- GoDaddy ↗
- HostGator ↗
- Hostico ↗
- HostMonster ↗
- Hover ↗
- Internetdbs ↗
- iPage ↗
- MelbourneIT ↗
- Moniker ↗
- Name.com ↗
- Namecheap ↗
- Network Solutions ↗
- OVH ↗
- Porkbun ↗
- Rackspace ↗
- Register ↗
- Squarespace ↗
- Site5 ↗
- Softlayer ↗
- Yola ↗
To avoid common issues, refer to our Nameserver replacement checklist.
Liên kết liên quan (docs Cloudflare) Related links (Cloudflare docs)
3. 5. Verify changes 3.5. Verify changes
Phần «5. Xác minh changes» — đọc hướng dẫn bên dưới, dùng liên kết docs gốc để xem ảnh minh họa và tab cấu hình đầy đủ.
Read the "3.5. Verify changes" section below — open the official docs link for full screenshots and configuration tabs.
Wait up to 24 hours while your registrar updates your nameservers.
When your domain is Active:
- You will receive an email from Cloudflare.
- Your domain will have a status of Active on the Domains page of your account.
- Online tools such as https://www.whatsmydns.net/ ↗ will show your Cloudflare-assigned nameservers (most of these tools use cached query results, so it may take longer for them to show the updated nameservers).
- CLI commands will show your Cloudflare-assigned nameservers
*macOS/Linux*
whois <DOMAIN_NAME>
dig ns <DOMAIN_NAME> @1.1.1.1
dig ns <DOMAIN_NAME> @8.8.8.8
dig <DOMAIN_NAME> +trace
*Windows*
nslookup -type=ns <DOMAIN_NAME> 1.1.1.1
nslookup -type=ns <DOMAIN_NAME> 8.8.8.8 If you see unexpected results, refer to our troubleshooting suggestions and check with your domain registrar.
Liên kết liên quan (docs Cloudflare) Related links (Cloudflare docs)
4. Re-enable DNSSEC 4. Re-enable DNSSEC
Phần «Re-enable DNSSEC» — đọc hướng dẫn bên dưới, dùng liên kết docs gốc để xem ảnh minh họa và tab cấu hình đầy đủ.
Read the "4. Re-enable DNSSEC" section below — open the official docs link for full screenshots and configuration tabs.
If you turned off DNSSEC before updating your nameservers, you can now re-enable DNSSEC through Cloudflare to protect your domain from spoofing.
Liên kết liên quan (docs Cloudflare) Related links (Cloudflare docs)
Footnotes Footnotes
Phần «Footnotes» — đọc hướng dẫn bên dưới, dùng liên kết docs gốc để xem ảnh minh họa và tab cấu hình đầy đủ.
Read the "Footnotes" section below — open the official docs link for full screenshots and configuration tabs.
- A security feature that protects DNS records from spoofing ↩
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"item":{"@id":"/directory/","name":"Directory"}},{"@type":"ListItem","position":2,"item":{"@id":"/dns/","name":"DNS"}},{"@type":"ListItem","position":3,"item":{"@id":"/dns/zone-setups/","name":"DNS setups"}},{"@type":"ListItem","position":4,"item":{"@id":"/dns/zone-setups/full-setup/","name":"Primary setup (Full)"}},{"@type":"ListItem","position":5,"item":{"@id":"/dns/zone-setups/full-setup/setup/","name":"Set up a primary zone (Full setup)"}}]} Xem bản đầy đủ trên developers.cloudflare.com (ảnh, tab cấu hình). View the full guide on developers.cloudflare.com (images, config tabs).
Tài liệu gốc ↗ Official docs ↗