DNS / Records
DNS records
The record types Pantech DNS serves, with an example of each, how to choose a TTL, the rules for CNAMEs, private records for split-horizon DNS, and importing and exporting BIND zone files.
A record set is one name and one type in a zone, with a TTL and one or more values. Two A addresses for www are one record set with two values, not two records.
Names
A record's name is relative to its zone:
| Name | In example.com it is |
|---|---|
@ | example.com itself, the apex |
www | www.example.com |
api.eu | api.eu.example.com |
*.dev | Any name under dev.example.com that has no record of its own |
_dmarc | _dmarc.example.com |
A full name ending in the zone, such as www.example.com., is accepted too and stored relative. * is allowed only as the left-most label. Each record answers with its full name in fqdn.
Record types
| Type | What it is for | Value | Example |
|---|---|---|---|
A | An IPv4 address | An address | <server-public-ip> |
AAAA | An IPv6 address | An address | <server-ipv6> |
CNAME | Another name for a host | A host name | shop.example.net. |
MX | Where mail for the domain goes | Priority, then host | 10 mail.example.com. |
TXT | Text: domain checks, SPF, DKIM, DMARC | Any printable text, up to 4,000 bytes | v=spf1 include:_spf.example.net -all |
SRV | Where a service runs | Priority, weight, port, target | 10 5 5060 sip.example.com. |
CAA | Which certificate authorities may issue for the domain | Flags, tag (issue, issuewild or iodef), value | 0 issue "ca.example.net" |
NS | Hand a subdomain to other name servers | A host name | ns1.other-dns.example. |
PTR | Reverse lookup of an address | A host name | web-1.example.com. |
Host names are returned with a trailing dot. You can leave it off when you write one.
A long TXT value, such as a DKIM key, is split into 255-byte strings for you. Values already in quotes are accepted as they are.
NS records are for subdomains only. The apex NS and SOA records are Pantech's: they are listed with managed: true and cannot be changed (DNS_RECORD_READ_ONLY).
Only one record set may have a given name and type. To add a value, change the existing one; creating a second is refused with DNS_RECORD_EXISTS.
Add a record
On the zone's page, press Add record. Or, with your servers' public addresses in place of <server-public-ip> and <second-server-public-ip>:
$ pantech dns records create example.com --name www --type A \ --value <server-public-ip> --value <second-server-public-ip> --ttl 300$ pantech dns records create example.com --name @ --type MX \ --value "10 mail.example.com" --value "20 mail2.example.com"$ pantech dns records create example.com --name @ --type TXT \ --value "v=spf1 include:_spf.example.net -all"Through the API, send an Idempotency-Key with each create. A retry with the same key returns the record set the first request made, as it is now; the same key with a different request returns 409 IDEMPOTENCY_CONFLICT. A key is remembered for 24 hours.
TTL
The TTL is how many seconds resolvers may keep an answer before they ask again. It is 60 to 86,400 seconds. The default is 300, five minutes.
| Use | TTL |
|---|---|
| Most records | 300 |
| A record you are about to move | 60, set a day before the move |
Records that rarely change: MX, CAA, verification TXT | 3,600 or more |
A lower TTL makes changes reach people sooner. A higher one means fewer lookups and fewer slow first visits.
CNAME rules
- A
CNAMEmust stand alone at its name. No other record, of any type, can share it (DNS_CNAME_CONFLICT). - A
CNAMEcannot be at the apex. Forexample.comitself, useAandAAAArecords. - A
CNAMEhas exactly one value.
So to point www at another host, give www a CNAME and nothing else. To point the bare domain at it, use its addresses.
Private records
Some names should answer with a private address, for servers reached over a VPN or a private network. This is split-horizon DNS.
Private addresses (the RFC 1918 ranges), carrier-grade NAT addresses (RFC 6598) and the like are refused by default, because they are usually a mistake in public DNS. Set allow_private on the record to keep one on purpose, here with the server's private address in place of <server-private-ip>:
$ pantech dns records create example.com --name db.internal --type A \ --value <server-private-ip> --allow-privateThe record is still public: anyone can look it up and see the address. It does not make the server reachable.
A new record is pending until it is served, usually within seconds. On a zone that is still awaiting_delegation, records stay pending until the zone is active: Pantech's name servers answer nothing for a zone until its delegation is proven. See Awaiting delegation.
Change and delete a record
Changing a record replaces its TTL, values, allow_private or comment. Its name and type are fixed: delete it and create another to rename it.
Each record has a version. Send it as If-Match (or version in a batch) and the change is refused with 412 VERSION_CONFLICT if someone else changed the record first. Terraform does this for you.
Deleting a record needs an owner or admin, and an API key with the write scope (an AI app's key also needs delete).
$ pantech dns records list example.com$ pantech dns records delete example.com <record id>Many changes at once
POST /dns/zones/{zone_id}/records/batch makes up to 1,000 creates, updates and deletes together (more is refused with 422 TOO_MANY_CHANGES). Either all of them are made or none are. An AI app's key needs the delete scope for a batch with any delete. A retry with the same Idempotency-Key returns the record sets the first request changed, as they are now (a record set since deleted and removed is left out). A key is remembered for 24 hours.
Import a zone file
Moving from another DNS host? Export the zone there as a BIND zone file, then import it. On the zone's page, press Import, or run the command below. The example file shows the shape; your own export has your real addresses where it shows <server-public-ip> and <mail-server-ip>:
$ pantech dns import example.com --file example.com.zone$ORIGIN example.com.
$TTL 3600
@ IN A <server-public-ip>
www IN CNAME example.com.
@ IN MX 10 mail.example.com.
mail IN A <mail-server-ip>
@ IN TXT "v=spf1 mx -all"$ORIGIN,$TTL, comments,@, relative and full names, a blank name (the previous line's), and records split over lines with( )are understood.$INCLUDEand$GENERATEare not.- The file's
SOAand apexNSlines are ignored: Pantech manages those. - Lines with the same name and type become one record set. If their TTLs differ, the lowest is used.
- A name and type already in the zone is updated. Anything new is created.
- Records not in the file are kept. Pass
--replace(replace: truein the API) to delete them instead, so the zone matches the file exactly. With an AI app's key, replacing needs thedeletescope. - At most 1,000 changes per import. A file that does not parse is refused with
INVALID_ZONE_FILEand nothing changes.
Export a zone file
$ pantech dns export example.com > example.com.zoneThe file is standard BIND format, text/dns, with every record set in the zone. Keep it as a backup, or load it into another DNS host.
From code
Put your server's public address in place of <server-public-ip>:
zone, err := c.DNS.CreateZone(ctx, pantech.CreateDNSZoneRequest{Name: "example.com"})
if err != nil {
return err
}
fmt.Println(zone.NameServers) // set these at your registrar
rec, err := c.DNS.CreateRecord(ctx, zone.ID, pantech.CreateDNSRecordRequest{
Name: "www",
Type: "A",
TTL: pantech.Ptr(300),
Values: []string{"<server-public-ip>"},
})const zone = await pantech.dns.zones.create({ name: "example.com" });
console.log(zone.name_servers); // set these at your registrar
const record = await pantech.dns.records.create(zone.id, {
name: "www",
type: "A",
ttl: 300,
values: ["<server-public-ip>"],
});zone = client.dns.zones.create(name="example.com")
print(zone["name_servers"]) # set these at your registrar
record = client.dns.records.create(
zone["id"],
name="www",
type="A",
ttl=300,
values=["<server-public-ip>"],
)Every endpoint is in the DNS API reference.