Types of DNS Records
An A record or address record. Address Record, assigns an IP address to a domain or subdomain name.Suppose we have xyz.com domain and want to assign 10.10.0.1 IP address to your web server, then weshould create an A record with xyz.com as Fully Qualified Domain Name and “10.10.0.1” in the value field.
A CNAME record or canonical name record makes one domain name an alias of another. e.g.
mail.xyz.com IN CNAME mail.xyz.net
An MX record or mail exchange record maps a domain name to a list of mail exchange servers
xyz.com. 3600 IN MX 0 xyz.com.
The first entry 3600 is the TTL (Time to Live). This record tells other DNS-servers (and clients) that it is OK to cache the above record for up to 3600 seconds (or one hour). The second numerical value is ‘0’ and is the MX-record priority. In this example, it doesn’t matter, as we only have one record, but if we were to have multiple records, it would determine the priority order of the servers. If the first one fails, the second one will be used, and so on.
It is important that there be a dot(“.”) after the domain name in the MX record. If the dot is absent, it routes to “xyz.com.xyz.com”. The number 0, indicates Preferance number. Mail is always routed to the server which has the lowest Preferance number. If there is only one mail server, it is safe to mark it 0.
Example – Multiple mail servers
xyz.com. 14400 IN MX 0 xyz.com.
xyz.com. 14400 IN MX 30 server2.xyz.com
A PTR record is reverse DNS lookup for an address. e.g. xyz.com has the IP address 188.8.131.52, a PTR record would be
184.108.40.206.in-addr.arpa. IN PTR xyz.com
Many email servers do a reverse DNS lookup to check if the host is actually coming from where it claims to come from. It is always advisable to have a proper reverse PTR record when you are running a mail / smtp server.
An NS record or name server record maps a domain name to a list of DNS servers authoritative for that domain. Delegations depend on NS records.
Example of NS Record With syntax
xyz.com. IN NS ns1.xyz.com.
IN indicates the Internet
NS indicates the type of record which Name Server record
The above indicates that the ns1.xyz.com is the authoritative server for the domain xyz.com
An SOA record or start of authority record specifies the DNS server providing authoritative information about an Internet domain, the email of the domain administrator, the domain serial number, and several timers relating to refreshing the zone.
A TXT record allows an administrator to insert arbitrary text into a DNS record. For example, this record is used to implement the Sender Policy Framework specification.
SPF domains have to publish at least two directives: a version identifier and a default mechanism.
xyz.com. TXT “v=spf1 -all”
This is the simplest possible SPF record: it means your domain xyz.com never sends mail. It makes sense to do this when a domain is only used for web services and doesn’t do email. If MX servers send mail, designate them.
xyz.com. TXT “v=spf1 mx -all”
Let’s pretend xyz.com has two MX servers, mx1 and mx2. They would both be allowed to send mail from wyz.com.
xyz.com. TXT “v=spf1 mx ptr -all”