This guide explains the various DNS record types, how to configure them in the VergeCloud Dashboard, and how to add them programmatically via the VergeCloud API.
The A and AAAA records point your domain or subdomain to an IP address. The A record is used for IPv4 addresses, while the AAAA record is used for IPv6 addresses. These records ensure that traffic to your domain is routed to the correct server.
@
for the root domain.
curl --location 'https://api.vergecloud.com/domains/example.com/dns-records' \ --header 'Authorization: Bearer API_KEY' \ --header 'Content-Type: application/json' \ --data '{"type":"A","name":"www","value":"8.8.8.8","ttl":120}'
Once you have created or updated an A or AAAA record, you can verify it using the dig
command:
dig A example.com
dig AAAA example.com
; <<>> DiG 9.16.1-Ubuntu <<>> A example.com ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 12345 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1 ;; QUESTION SECTION: ;example.com. IN A ;; ANSWER SECTION: example.com. 3600 IN A 8.8.8.8 ;; Query time: 45 msec ;; SERVER: 8.8.8.8#53(8.8.8.8) ;; WHEN: Thu Sep 26 13:01:23 UTC 2024 ;; MSG SIZE rcvd: 94
CNAME records are used to redirect one domain to another. For example, a CNAME record can map example.com
to alias.com
, meaning visitors to example.com
are redirected to alias.com
without revealing the underlying IP.
curl --location 'https://api.vergecloud.com/domains/example.com/dns-records' \ --header 'Authorization: Bearer API_KEY' \ --header 'Content-Type: application/json' \ --data '{"type":"CNAME","name":"www","value":{"host_header":"source.example.com","host":"alias.example.com"},"ttl":120}'
Use the dig
command to verify the CNAME record:
dig CNAME example.com
; <<>> DiG 9.16.1-Ubuntu <<>> CNAME example.com ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 54321 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1 ;; QUESTION SECTION: ;example.com. IN CNAME ;; ANSWER SECTION: example.com. 3600 IN CNAME alias.example.com. ;; Query time: 25 msec ;; SERVER: 8.8.8.8#53(8.8.8.8) ;; WHEN: Thu Sep 26 13:05:42 UTC 2024 ;; MSG SIZE rcvd: 101
ANAME records act like a combination of A and CNAME records. An ANAME record points to another domain’s IP address and functions at the root level like an A record, but also works similarly to a CNAME.
curl --location 'https://api.vergecloud.com/domains/example.com/dns-records' \ --header 'Authorization: Bearer API_KEY' \ --header 'Content-Type: application/json' \ --data '{"type":"ANAME","name":"@","value":{"host_header":"source.example.com","location":"alias.example.com"},"ttl":120}'
Use the following command to check ANAME resolution:
dig ANAME example.com
NS (Name Server) records define which DNS servers are responsible for your domain’s DNS resolution. Multiple NS records can be added for redundancy and load distribution.
curl --location 'https://api.vergecloud.com/domains/example.com/dns-records' \ --header 'Authorization: Bearer API_KEY' \ --header 'Content-Type: application/json' \ --data '{"type":"NS","name":"@","value":"ns1.vergecloud.com","ttl":86400}'
To verify NS records, use:
dig NS example.com
; <<>> DiG 9.16.1-Ubuntu <<>> NS example.com ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 98765 ;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 1, ADDITIONAL: 1 ;; QUESTION SECTION: ;example.com. IN NS ;; ANSWER SECTION: example.com. 3600 IN NS ns1.vergecloud.com. example.com. 3600 IN NS ns2.vergecloud.com. ;; Query time: 40 msec ;; SERVER: 8.8.8.8#53(8.8.8.8) ;; WHEN: Thu Sep 26 13:07:12 UTC 2024 ;; MSG SIZE rcvd: 121