Linux 101 : A short overview of the Domain Name Server - MX records, A records, CNAME records, ... -
The DNS resolves FQDN - Fully Qualified Domain Name - to an IP address.
We have different DNS records types, below are some of the most used ones:
- NS record : indicates which nameserver is the "authority" for a zone. A zone is a section of the Domain name system.
- A record : is the host record, it holds the IP address of a hostname.
- MX record : refers to the Mail Exchange record, it holds the server names that are manage email for a domain name: It is usually under the name "mail.domain.name", but it could have other names.
- PTR record : We use Pointer Records in reverse lookup zones, it gives us the domain name related to an IP address. It does the opposite of what the A record does.
- CNAME record : refers to the Canonical Name Records, they are used for aliases for A records.
- TXT record : refers to Text records, it could contain human-readable information that could be used for different purposes - notes, ownership of domain name, ... -.
Below are some examples of how to get those DNS records.
The below example uses the A record by retrieving the IP address of a host:
The A record is the default if we don't mention any DNS record.
To get the TXT record of a domain name, we use the below command:
To get the MX record of a domain name, we use the below command: