How does DNS work? Types and operating modes

As part of the anatomy of a URL, as we explained here, there are one important item with lot’s of ramifications: the Domain Name.

The Domain Name in a URL is part of DNS (Domain Name System) which is a name management system for network connected resources. It basically translates human-readable domain names into numerical IP Addresses needed for the purpose of locating and identifying clients and servers throughout a network.

DNS allows data to be stored in the entry, allowing different types of records to be created, all with different purposes, let’s go through them:

Standard Records:

A

The A record maps a name to one or more IP addresses, when the IP are known and stable,
ex: viewlike.us. IN A 8.8.8.8

AAAA

Maps a IPv6 address record to a hostname
ex: www IN AAAA 2001:db8::3

CNAME

Makes one domain name an alias of another. The aliased domain gets all the subdomains and DNS records of the original. Ideal if you want to associate a subdomain to an already existing A record.
ex: www.viewlike.us to viewlike.us – knowing that “viewlike.us” has a A record pointing to the server IP.

MX

An email-associated record, maps a domain name to the email server for that domain.
ex: viewlike.us. 300 IN MX 10 viewlike.us.

The record says all emails going to @viewlike.us should go to the IP behind the record viewlike.us with priority 10.

PTR

Implements a IPv4 Reverse Lookup for the IP address of the domain and it’s basically the opposite of a A record. One maps a name to a IP and the other a IP to a name. When you have the PTR record setup, you can get the associated domain/hostname. An A record should exist for every PTR record.

Ex: if an A Record points viewlike.us to 1.2.3.4, a PTR record would look like:

4.3.2.1.in-addr.arpa. 3600 IN PTR viewlike.us.

TXT

Allows an administrator to add text to the DNS record, and it’s commonly used to implement a SPF (Sender policy framework) as a method to fight spam. In the TXT record, we can declare a list of authorized hostnames and IP’s from where email can originate from.
Ex: v=spf1 a mx ip4:1.2.3.4 -all

Use a DNS service provider

Services like Cloudflare make all of this easier: Clean and easy interface plenty of helpful resources, improvements in the website performance, caching, security and it’s free.

You’ll see it’s much easier to manage your DNS settings using a service like this – you can tank me later.