Skip to content
Open console

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.

Point the root and www at your server.

zcp dns record-create --domain examplecom --name @ --type A --content 203.0.113.10
zcp dns record-create --domain examplecom --name www --type A --content 203.0.113.10

Verify from a public resolver:

dig A example.com +short # 203.0.113.10
dig A www.example.com +short # 203.0.113.10

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 10
zcp 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.

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 +short

A name holds several TXT values, so this record sits next to an SPF record already at @. See Several values per name and type.

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"

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 +short

A 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.

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 --yes
zcp dns record-create --domain examplecom --name www --type A --content 203.0.113.20

Verify the new value, allowing for the record’s TTL to expire in resolver caches:

dig A www.example.com +short # 203.0.113.20
zcp dns record-delete --domain examplecom --name subzone --type NS

Add --yes to skip the confirmation prompt in scripts.

See also: Record types, Manage DNS with the CLI, Troubleshooting

Ask the ZCP docs

Type a question and pick an assistant. The assistant opens in a new tab and reads this page and the full ZCP documentation, so its answer comes from our docs.

Example questions

Ask with

Your question goes to the assistant you pick, under its own terms.