Add DNS Records in VergeCloud

Adding DNS Records on VergeCloud: A Guide to Managing Your Website’s DNS Settings"

Add DNS Records

To activate DNS services for your domain on VergeCloud, you need to change your domain’s NS records to those provided by VergeCloud. Once updated, all DNS records must be correctly configured in your VergeCloud account to ensure proper DNS resolution and smooth functionality of your subdomains.

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.

A and AAAA Records

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.

A-Record Adding DNS A record


Field Descriptions

  • Name: The domain or subdomain for which the A or AAAA record is being created. Use @ for the root domain.
  • IP Address: The IPv4 address for A records or the IPv6 address for AAAA records.
  • TTL (Time to Live): The time, in seconds, that this record is cached by DNS servers before refreshing. Default is 120 seconds.

Example API Request (A Record)

  1. 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}'

Testing

Once you have created or updated an A or AAAA record, you can verify it using the dig command:

  1. dig A example.com
  2. dig AAAA example.com

Sample Test Output

  1. ; <<>> 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

ANAME and CNAME Records

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.

CNAME recordAdding DNS Cname record

Field Descriptions

  • Name: The domain or subdomain to be redirected.
  • Canonical Name: The destination domain to which traffic will be forwarded.
  • Host Header: Optionally, you can set a host header that will be forwarded to the destination server.
  • TTL: Time-to-live in seconds for the record. Default is 3600 seconds.

Example API Request (CNAME Record)

  1. 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}'

Testing

Use the dig command to verify the CNAME record:

  1. dig CNAME example.com

Sample Test Output

  1. ; <<>> 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 Record

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.

Example API Request (ANAME Record)

  1. 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}'

Testing

Use the following command to check ANAME resolution:

  1. dig ANAME example.com

NS Record

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.

Example API Request

  1. 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}'

Testing

To verify NS records, use:

  1. dig NS example.com

Sample Test Output

  1. ; <<>> 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