#### Adding DNS Records (A, CNAME, MX, NS, SRV, TXT)

The most common types of DNS records are:

- SOA record described below.
- Address records (A) that map the name of a machine to its numeric IP address. In clearer terms, this record states the hostname and IP address of a certain machine. To "resolve" a hostname means to find its matching IP address.
- CNAME records allow a machine to be known by more than one hostname. There must always be an A record for the machine before aliases can be added. The host name of a machine that is stated in an A record is called the canonical, or official name of the machine. Other records should point to the canonical name
- MX (Mail eXchanger) resource record identifies the mail server that is responsible for handling e-mails for a given domain name. When more than one MX record is entered for any single domain name that is using more than one mail server, the MX record can be prioritized with a preference number that indicates the order in which the mail servers should be used. This enables the use of primary and backup mail servers, which makes mail delivery more reliable. Please, keep in mind the following rules about MX records:
  - MX record must point to hosts defined by A records, not CNAMEs.
  - MX record cannot point to IP addresses.
  - If you create a single MX record, the priority doesn't matter If you create multiple MX records, your primary mail server must have the lowest preference.
- Name Server records (NS) state the authoritative name servers for the given domain. There must be at least two NS records in every DNS zone.
- SRV-records are used to specify the location of a service. They are recently were used in connection with different directory servers such as LDAP (Lightweight Directory Access Protocol). In addition, SRV records can be used for advanced load balancing and to specify specific ports for services - for example that a web-server is running on port 8080 instead of the usual port 80 (theoretical example - this is not yet supported by any major browsers). The "service location" is specified through a target, priority, weight, and port:
  - Target is the domain name of the server (referencing an A-record).
  - Priority is a preference number used when more servers are providing the same service (lower numbers are tried first).
  - Weight is used for advanced load balancing.
  - Port is the TCP/UDP port number on the server that provides this service.
- TXT records - strictly informational, not functional. Used to provide up to 255 characters of free form text (quoted string). Provides the ability to associate some text with a host or other name.

The form for resource records input is organized as follows:

- Enter a record subject into the Name field.
- Enter a record time-to live in seconds into the TTL field.
- Select a record type from the Type drop-down menu.
- Enter priority (for MX or SRV record only) into the Priority field.
- Enter the rest of a record in one string, in the same way as a record is entered in zone file into the Value field.

To add a DNS record to a zone file:

1. Select Service Director - Domain Manager - Domains.
2. Select the domain by clicking on its name. As a domain details will be displayed, click the DNS Zone tab. The list of DNS records appears.
3. Click the New Record button.
4. Fill the form that appears:
   1. You can type the sub-domain name into the Name field. Since the form we are talking about is designed for adding different types of records, we can say that the Name field should contain the subject of the query, e.g., the address you want to use as your Internet e-mail address (for MX record), or the alias name (for CNAME record), etc. However, to avoid any mistakes, please remember that:

      - If you leave the Name field empty, the record will affect just the original domain name, not a sub-domain. In this case, after you save the record you will see the @ symbol in the record name column.

      - If you type the @ symbol into the Name field, this will mean the same as described above.

      - If you type the sub-domain with the trailing dot into the Name field (e.g., subdomain.domain.com.) the record will affect the sub-domain named subdomain.domain.com.

      - If you type the sub-domain without the trailing dot into the Name field, (e.g., subdomain.my), the domain name indicated in this record (i.e., the contents of the Host field for example, domain.com) will be automatically appended to the record name and, as a result the record will affect the sub-domain named subdomain.my.domain.com.

   2. Into the TTL field you can type in seconds how long other name servers should cache, or save, this record (TTL is short for time-to-live). For example, the 86400 value corresponds to one day.

      Note: The minimal default TTL for all the resource records containing in the zone file is indicated in the SOA record. And this default TTL can be re-defined for every record containing in the zone file. Thus, if you leave the TTL field empty, then the default minimal TTL will be applied to this record.

   3. Select the type of the resource record (A, CNAME, MX, or NS) from the Type drop-down menu. Please see the short description of the record types in the beginning of this section. For more information, please refer to the DNS documentation, for example, you can look at the Web.
   4. The Priority field is needed to add MX and SRV records, namely, to specify a mail server priority. Thus, this field becomes active only in case you have selected the MX record type from the Type drop-down menu. Mailers attempt to deliver to the mail exchanger with the lowest preference value (highest priority). This seems a little counterintuitive at first - the most preferred mail exchanger has the lowest preference value. But since the preference value is an unsigned quantity, this lets you specify a "best" mail exchanger at preference value 0. Generally, the mailer priority is the digit within the range from 0 to 65535. If delivery to the most preferred mail exchanger(s) fails, mailers should attempt delivery to less preferred mail exchangers (those with higher preference values), in order of increasing preference value. That is, mailers should try more preferred mail exchangers before they try less preferred mail exchangers. More than one mail exchanger may share the same preference value, too. This gives the mailer its choice of which to send to first. The mailer should try all the mail exchangers at a given preference value before proceeding to the next higher value, though.
   5. In the Value field you should indicate the answer to the query. Records are always read from left to right, with the subject to be queried about on the left and the answer to the query on the right. For example, for MX record you should indicate the mail server name, for CNAME record - the canonical name of the machine indicated before in the relevant A record, etc.
   6. You can add a free-form comment into the Comment field.
5. Click the Save button.

Examples:

- To add the A record looking like:

  `first.mydomain.com. IN A 192.168.40.34`

  which means that the `first.mydomain.com` domain is mapped into the `192.168.40.34` IP address you should indicate the following in the form fields:

  - `first.mydomain.com.` in the Name field (do not forget the trailing dot)
  - select `A` from the Type drop-down menu
  - type the IP address `192.168.40.34` into the Value field
- To add the CNAME record looking like:

  `mail.first.mydomain.com. IN CNAME first.mydomain.com.`

  which means that the `first.mydomain.com` machine is also can be called as `mail.first.mydomain.com` you should indicate the following in the form fields:

  - `mail.first.mydomain.com.` in the Name field (do not forget the trailing dot)
  - select `CNAME` from the Type drop-down menu
  - type the canonical name `first.mydomain.com.` into the Value field.

    Note: Remember that there must always be an A record for the machine before aliases can be added.

- To add the MX record looking like:

  `mydomain.com. IN MX 10 mail.first.mydomain.com.`

  which allows your e-mail address to be "user@mydomain.com" rather than "user@mail.first.mydomain.com", specify the following in the form fields:

  - `mydomain.com.` in the Name field (do not forget the trailing dot)
  - select `MX` from the Type drop-down menu
  - type `10` into the Priority field
  - type `mail.first.mydomain.com.` (your mail server name) into the Value field
- To add the NS record looking like:

  `first.mydomain.com. IN NS ns3.mydomain.com.`

  that declares the `ns3.mydomain.com` as the authoritative name server for the`first.mydomain.com` domain, specify the following in the form fields:

  - `first.mydomain.com.` in the Name field (do not forget the trailing dot)
  - select `NS` from the Type drop-down menu
  - type `ns3.mydomain.com` in the Value field.
- To add the SRV record looking like:

  `_``htt`p._tcp.example.com 86400 IN SRV 0 5 5060 httpserver.example.com.``

  that points to a server named httpserver.example.com listening on TCP port 80 for HTTP protocol connections. The priority given here is 0, and the weight is 5, specify the following in the form fields:

  - `_htt`p._tcp`` in the Name field.
  - `86400` in the TTL field
  - select `SRV` from the Type drop-down menu.
  - Type `0 5 5060` `http`server.example.com.`` into the Value field.
- To add a TXT record looking like:

  `example.com IN 86400 TXT "Hostname used for examples only"`

  that specifies the example.com hostname as an example hostname, enter the following values into the form fields:

  - `example.com` into the Name field.
  - `86400` in the TTL field
  - select `TXT` from the Type drop-down menu.
  - Type `"Hostname used for examples only"` into the Value field.

Note: There also must be an A record in your DNS for each machine you enter as a name server in your domain. There must be at least two NS records in every DNS entry.

Please send us your feedback on this help page