Basic Facts of DNS configuration for any domain hosting or DNS Service
Previously, I answered an question on superuser to create a subdomain. So I want to share my knowledge on DNS to everyone who would like to configure their DNS on purchased domain.
DNS means domain naming server, system or service. The most basic server that is used worldwide is BIND (Berkeley Internet Naming Domain). Now basic purpose of DNS server (port 53) is conversion of name to IP. This conversion is important to make computer understand in its own language. Each domain normally has a zone file which is edited by DNS manager system of any registrar or hosting website. The main records in DNS are
HOST AThis record enables to provide name for IP address. new subdomains can be created using this record.
SUBDOMAIN CLASS RECORD TYPE PROIRITY IP ADDRESS www IN A 10 192.168.1.1 @ IN A 10 192.168.1.1
MX (mail exchanger)It is a mail record required to notify query of mail server of domain. It is not necessary for an sender to only go to an IP of the domain listed in HOST A record for delivery. Therefore mail server of different domains (hosting domain) are possible to use. The priorities and multiple MX record can be set for redundancy. The record with least priority number is the primary mail server
SUBDOMAIN CLASS RECORD TYPE PROIRITY SERVER NAME mail IN MX 10 mail.another.com. @ IN MX 10 mail.another.com.
TXT (Text)record is additional record, mostly used for domain verification purposes. Example: Google domain verification, SPF, DKIM, DMARC
SUBDOMAIN CLASS TTL RECORD TYPE VALUE @ IN 86400 TXT "v=spf1 a:mail.example.com -all"
CNAME (Canonical Name)This record is used for redirection purposes. The redirection is possible on any domain. Example: redirect to main site or hosting subdomain.
SUBDOMAIN CLASS RECORD TYPE DOMAIN NAME www IN CNAME first.mydomain.com.
Note that a fully qualified domain name (FQDN) ends with full stop and sub-domain are without full stop. Some DNS hosting services imply this rule and some don't. So always be careful that full stop(.) is used only after FQDN.
If you dont like to read here is a video to make you understand DNS