Documentation

esc
    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:

    NameIn example.com it is
    @example.com itself, the apex
    wwwwww.example.com
    api.euapi.eu.example.com
    *.devAny 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

    TypeWhat it is forValueExample
    AAn IPv4 addressAn address<server-public-ip>
    AAAAAn IPv6 addressAn address<server-ipv6>
    CNAMEAnother name for a hostA host nameshop.example.net.
    MXWhere mail for the domain goesPriority, then host10 mail.example.com.
    TXTText: domain checks, SPF, DKIM, DMARCAny printable text, up to 4,000 bytesv=spf1 include:_spf.example.net -all
    SRVWhere a service runsPriority, weight, port, target10 5 5060 sip.example.com.
    CAAWhich certificate authorities may issue for the domainFlags, tag (issue, issuewild or iodef), value0 issue "ca.example.net"
    NSHand a subdomain to other name serversA host namens1.other-dns.example.
    PTRReverse lookup of an addressA host nameweb-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>:

    Terminal
    $ 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.

    UseTTL
    Most records300
    A record you are about to move60, set a day before the move
    Records that rarely change: MX, CAA, verification TXT3,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 CNAME must stand alone at its name. No other record, of any type, can share it (DNS_CNAME_CONFLICT).
    • A CNAME cannot be at the apex. For example.com itself, use A and AAAA records.
    • A CNAME has 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>:

    Terminal
    $ pantech dns records create example.com --name db.internal --type A \    --value <server-private-ip> --allow-private

    The 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).

    Terminal
    $ 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>:

    Terminal
    $ pantech dns import example.com --file example.com.zone
    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. $INCLUDE and $GENERATE are not.
    • The file's SOA and apex NS lines 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: true in the API) to delete them instead, so the zone matches the file exactly. With an AI app's key, replacing needs the delete scope.
    • At most 1,000 changes per import. A file that does not parse is refused with INVALID_ZONE_FILE and nothing changes.

    Export a zone file

    Terminal
    $ pantech dns export example.com > example.com.zone

    The 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>:

    Go
    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>"},
    })

    Every endpoint is in the DNS API reference.

    Was this page helpful?

    Updated