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. See
DNS records for console availability and
Manage DNS with the API for API examples.
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 +shortA name holds several TXT values, so this record sits next to an SPF record already at @. See
Several values per name and type.
Restrict Certificate Issuance
Section titled “Restrict Certificate Issuance”The ZCP DNS console does not offer CAA as a record type. Create the record with the CLI or API.
zcp dns record-create --domain examplecom --name @ --type CAA --content '0 issue "letsencrypt.org"'dig CAA example.com +short # 0 issue "letsencrypt.org"See CAA records.
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.dig NS subzone.example.com +shortA name and type hold several values, so a second NS record at the same name adds a second name
server. See
Several values per name and type.
Change 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