# How the nameservers answer

Where the platform nameservers get your records, what they answer for each kind of query, how they sign, and the limits they apply to clients.

## Where the records come from

The platform nameservers are shared by every organization's hosted zones. Each one holds a copy of
every zone in memory, which it pulls from the platform every few seconds and also keeps on disk. A
change you make is answered from a nameserver's next pull. If a nameserver cannot reach the
platform, it keeps answering from the last copy it has.

What a record answers is worked out when the copy is made: the current address of an `ALIAS`
target, which uptime checks are down, and which routing variants are healthy.

## Answers

| Query                              | Answer                                                                                    |
| ---------------------------------- | ----------------------------------------------------------------------------------------- |
| Apex `SOA`                         | The zone's `SOA`; its serial increases with every change, TTL 3600                        |
| Apex `NS`                          | The platform nameservers, TTL 3600                                                        |
| A name with records of other types | `NOERROR` with no answer                                                                  |
| A name with no records             | `NXDOMAIN`, unless a wildcard covers it or names exist below it                           |
| A name in no hosted zone           | `REFUSED`; the nameservers never look names up elsewhere                                  |
| Any type at a `CNAME`              | The `CNAME`, plus the target's records of that type when the target is in the same zone   |
| `TXT` at `_acme-challenge.…`       | Your stored `TXT` values, plus any challenge answer the platform placed for a certificate |
| A name at or below an `NS` set     | A referral to that child's nameservers, with their addresses when they are in the zone    |

A negative answer (`NXDOMAIN` or no data) may be cached by resolvers for 60 seconds.

## DNSSEC

| What                 | How                                                                                                                                                                                                                   |
| -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Algorithm            | ECDSA P-256 with SHA-256 (13), for both keys                                                                                                                                                                          |
| Signing              | Each nameserver signs an answer as it sends it, so wildcard, `ALIAS`, routed and failover answers are signed as answered. The `DNSKEY` set comes pre-signed with the key-signing key in the copy the nameserver pulls |
| Signatures           | Valid from an hour before the start of the UTC day until 8 days after it, so a nameserver cut off from the platform serves valid signatures for a week                                                                |
| Denial of existence  | Compact (RFC 9824): a name that does not exist is `NOERROR` with one `NSEC` whose types include `NXNAME`; a resolver that sets the `CO` flag gets `NXDOMAIN`                                                          |
| Queries without `DO` | No signatures, and `NXDOMAIN` as usual                                                                                                                                                                                |
| Delegated children   | Unsigned: the zone has no `DS` records for them                                                                                                                                                                       |

## Limits per client

The nameservers answer over UDP and TCP.

- Each source address may send 50 queries a second, with bursts of 100. Over UDP a query above that
  is dropped without an answer; over TCP the connection is closed.
- Over UDP, the same response (same name, type and response code; for `NXDOMAIN` and no-data
  answers, the same zone) goes to one client network (a /24, or a /56 for IPv6) at most 10 times a
  second, with bursts of 50. Above that, every second such response is sent empty with the truncation flag set, so the
  resolver retries over TCP, and the others are dropped.
- A TCP connection is closed after 5 seconds without traffic. One address may hold 16 connections at
  once, and a nameserver accepts 512 in all. Every query on a connection counts against the
  address's rate.

A resolver retrying a truncated answer over TCP stays well inside these limits.

## What the platform records

Each nameserver counts the queries it answers for every zone, by response code, whether or not
query logging is on, and reports the counts every minute as the `EWS/DNS` `Queries` metric of the
zone's organization. With query logging on, it also sends one line per answered query, with the
client's network (a /24, or a /56 for IPv6), never its address. See
[Monitoring](monitoring.md) and [Log a zone's queries](log-queries.md).

## Related

- [Record sets](record-sets.md)
- [Sign a zone with DNSSEC](sign-a-zone-with-dnssec.md)
