# DNS Troubleshooting

Use these checks to confirm a DNS change and resolve common problems.

## Check a Record Before Propagation

A ZSoftly name server answers for your zone as soon as you save a record, even before the world sees it. Query it directly to confirm the record is correct:

```bash
dig A www.example.com @ns1.zsoftly.ca +short
dig A www.example.com @ns2.zsoftly.ca +short
```

Both name servers should return the same answer. If the direct query is right but public resolvers are wrong, the record is fine and you are waiting on propagation or a cached old value.

## Confirm Delegation

Public resolvers reach your ZCP records after you delegate the domain to ZSoftly. Confirm the public response lists the ZSoftly name servers:

```bash
dig NS example.com +short
# ns1.zsoftly.ca.
# ns2.zsoftly.ca.
```

If this still shows the old name servers, the delegation has not propagated or was not saved at the registrar. See [Domains](https://docs.zcp.zsoftly.ca/public-cloud/dns/domains).

## Check Worldwide Propagation

Query several public resolvers in different regions. They should all agree:

```bash
for r in 1.1.1.1 8.8.8.8 9.9.9.9 208.67.222.222; do
  echo "$r:"; dig A www.example.com @$r +short
done
```

For a visual world map, use an online checker such as [whatsmydns.net](https://www.whatsmydns.net/) and pick the record type.

## Common Problems

### The Change Has Not Shown Up

Resolvers cache records for the TTL. With the default `14400` (4 hours), a resolver holding the old value waits up to four hours before refreshing it. Lower the TTL to `300` a day or two before a planned change, then raise it again afterward.

### CNAME at the Root Does Not Work

A `CNAME` cannot sit at the apex (`@`) and cannot share a name with any other record. Use an `A` or `AAAA` record for the root. See [CNAME records](https://docs.zcp.zsoftly.ca/public-cloud/dns/records/cname).

### Fix MX Record Rejection

An `MX` record needs a priority in its own field. From the CLI, pass `--priority`. From the API, send `priority` as a separate field. See [MX records](https://docs.zcp.zsoftly.ca/public-cloud/dns/records/mx).

### A CNAME Is Refused

Creating a `CNAME` at a name with other records fails with an error like `RRset www IN CNAME: Conflicts with pre-existing RRset`. A `CNAME` cannot share a name with any other record. Delete the other records at that name first, or use a different name. See [Known limitations](https://docs.zcp.zsoftly.ca/public-cloud/dns/records#known-limitations).

### A New Record Was Added Instead of Replacing One

A name and type hold several values. Creating a record at a name and type with existing values adds the new value to the set. To remove a value you no longer want, delete it in the console, which removes only that value. `zcp dns record-delete` attempts to delete each value it reads initially, while values added concurrently remain. It is not suitable for removing one selected value. Use the console or the API with the exact record content instead. See [Several values per name and type](https://docs.zcp.zsoftly.ca/public-cloud/dns/records#several-values-per-name-and-type).

### A TXT Value Appears With Quotes

The platform stores a `TXT` value quoted and returns it quoted, whether or not you typed the quotes. `dig` shows the quotes. See [TXT records](https://docs.zcp.zsoftly.ca/public-cloud/dns/records/txt).

### NXDOMAIN Versus No Answer

`NXDOMAIN` means the name does not exist in the zone. An empty answer with `NOERROR` means the name exists but has no record of the requested type. Check the requested name and type.

## Read the Zone as the Platform Sees It

`zcp dns show <slug>` prints the domain and every record it holds, including the `SOA` and `NS` records ZCP manages. Compare it against what `dig` returns to find a missing or mistyped record.

```bash
zcp dns show examplecom
```

See also: [DNS Overview](https://docs.zcp.zsoftly.ca/public-cloud/dns/overview), [Domains](https://docs.zcp.zsoftly.ca/public-cloud/dns/domains), [Worked examples](https://docs.zcp.zsoftly.ca/public-cloud/dns/examples)
