DNS Examples
Practical recipes for common DNS tasks. Each one uses the zcp CLI against a zone with the slug
examplecom, then verifies the result with dig. Read your slug from zcp dns list. The same
records work from the console and the API.
Host a Website
Section titled “Host a Website”Point the root and www at your server.
zcp dns record-create --domain examplecom --name @ --type A --content 203.0.113.10zcp dns record-create --domain examplecom --name www --type A --content 203.0.113.10Verify from a public resolver:
dig A example.com +short # 203.0.113.10dig A www.example.com +short # 203.0.113.10Route Email
Section titled “Route Email”Add a mail server and an SPF policy. MX takes a priority in its own field.
zcp dns record-create --domain examplecom --name @ --type MX --content mail.example.com. --priority 10zcp dns record-create --domain examplecom --name @ --type TXT --content '"v=spf1 mx -all"'Verify:
dig MX example.com +short # 10 mail.example.com.dig TXT example.com +short # "v=spf1 mx -all"See MX records and TXT records.
Verify Domain Ownership
Section titled “Verify Domain Ownership”Many services ask you to publish a TXT record to prove you own the domain. Paste the value they
give you.
zcp dns record-create --domain examplecom --name @ --type TXT --content '"provider-verification=abc123"'dig TXT example.com +shortRestrict Certificate Issuance
Section titled “Restrict Certificate Issuance”Allow only your certificate authority to issue certificates.
zcp dns record-create --domain examplecom --name @ --type CAA --content '0 issue "letsencrypt.org"'dig CAA example.com +short # 0 issue "letsencrypt.org"Delegate a Subdomain
Section titled “Delegate a Subdomain”Hand subzone.example.com to another DNS provider.
zcp dns record-create --domain examplecom --name subzone --type NS --content ns1.other-dns.com.zcp dns record-create --domain examplecom --name subzone --type NS --content ns2.other-dns.com.dig NS subzone.example.com +shortChange a Record
Section titled “Change a Record”There is no update action. Delete the record, then create it with the new value.
zcp dns record-delete --domain examplecom --name www --type A --yeszcp dns record-create --domain examplecom --name www --type A --content 203.0.113.20Verify the new value, allowing for the record’s TTL to expire in resolver caches:
dig A www.example.com +short # 203.0.113.20Remove a Record
Section titled “Remove a Record”zcp dns record-delete --domain examplecom --name subzone --type NSAdd --yes to skip the confirmation prompt in scripts.
See also: Record types, Manage DNS with the CLI, Troubleshooting