How to manage DNS Records Right way
So Why DNS..?
The Answer is very simple. i can mention 5 points here.
1. everyone easy to remember your website name like facebook.com, google.com etc. 2. you can establish your identity in cyberspace. so it is unique. 3. domain name defines your business, profession, content type details like redbus.com, github.io, pybloggers.com etc. 4. domain name is portable and you can easily generate your emails with domain name. 5. domain name gives awesome engagements to get more customers/clients in search engine platforms.
So, At this moment, we want to manage the DNS records. I give simple Example Here Like Mobile Contacts Lists (DNS look like same). In your Mobile Contacts Lists you will see 3 combinations. Check once now.
1. Person `A` has Single Mobile number with contact name `X`. 2. Person `B` has Three mobile numbers with Contact name `Y`. 3. Person `C` has Single Mobile number with Contact names `X`, `Y`, `Z``.
Now, In Above Example Combinations replace mobile no with IP / IP's and replace Contact names with Domain Name / Sub Domains. it is the general rule of maintain the DNS Address Book. Here we can Explain the Each Combination with Rightful Records.
NOTE: In this combinations you will see multiple domains in Single Table, But Actually Every Domain have separate record sets in DNS Registry. if You want a complete domain table check the Final Records Table.
In Combination 1:
You Can Connect only one domain to One External Ip Address. this mean you can connect main domain to one IP and sub domain to one IP, So the DNS Records Look Like This in Your DNS Register.
Combination 1 Records Set
| Type | Name | Value | TTL | |------|-----------------|-----------|------| | A | example.com | 127.0.0.1 | Auto | | A | example-one.com | 127.0.0.1 | Auto |
In Above DNS Record Table Each Domain Connected to Separate IP Address. So You can Easily Identify the Domain Resources and You know where is it from working.
In Combination 2:
You can Connect Three Different IP Address with Single Domain Name and It's Sub Domains. It is Popular way to Handle the DNS Records.
Combination 2 Records Set
| Type | Name | Value | TTL | |-------|------------------|---------------------|------| | A | example.com | 127.0.0.1 | Auto | | A | blog.example.com | 127.0.0.2 | Auto | | A | api.example.com | 127.0.0.3 | Auto | | CNAME | ex.example.com | https://netlify.com | 600 |
In Above DNS Record Table Each Domain and It's Sub Domain Connected To Different Ip Address and "ex.example.com" is Pointed to Another DNS Registry. So You Can Maintain This Structure When You Develop Multiple Applications with Single Domain and Its Sub Domain Names.
In Combination 3:
In this combination, you can connect multiple domain records to Single Ip Address. This is really suitable to when you have single hosting server and multiple applications. so DNS records look like this.
Combination 3 Records Set
| Type | Name | Value | TTL | |-------|-----------------|-----------|------| | A | example.com | 127.0.0.1 | Auto | | CNAME | blog | @ | 600 | | CNAME | api | @ | 600 | | A | example-one.com | 127.0.0.1 | Auto |
In Above DNS records Table main domain connected to Single IP and All Sub Domains parked to Main Domain IP. This is Really Suitable when you Place the DNS Records.
But Here all in above combination we used different domain names. but in domain registry each domain has separate DNS Table set. See this Final DNS Records Table (we have example.com domain here).
Final Records Set
| Type | Name | Value | TTL | |-------|-------------|------------------------------|------| | A | example.com | 127.0.0.1 | Auto | | CNAME | blog | @ | 600 | | CNAME | api | @ | 600 | | CNAME | profile | xnsnsdss.netlify.com | Auto | | A | media | 127.0.0.2 | Auto | | MX | @ | mx.zoho.com | 10 | | MX | @ | mx1.zoho.com | 30 | | MX | @ | mx2.zoho.com | 50 | | TXT | @ | v=spd1 include:zoho.com ~all | 600 | | DS | @ | 186260A28445 | 600 | | CAA | @ | cloudflare.com | 300 |
See Above example.com most popular records in above table. it is completely parked to different sources but it handle all over one application. so each record maintain each content type. now we will discuss how to maintain each record content.
So Why This Records..?
the answer simple, imagine you have 6 more girl friends. each girl friend have own address and maintain some kind of information. so you can maintain their address in your mind and call them to personal date, right..! same like this, a DNS Record Holds Some Type of Information and Handle Your Domain to the users. now lets see each type record here.
this record handle your domain parked Ip Address. A record map a Domain to IP Address. ** A type record handle IPv4 addresses only ** and mostly each main domain has one Common External IP address. you can also connect your domain sub domain to other IP Address.
this record look like same A record. ** but it can handle IPv6 Addresses only**. it is most Advance, Secure, Efficient way to handle your domains.
as said before in combinations it can handle your alias names. CNAME means Canonical Name. so you park your domains to other sources. ** @ can handle your domain park to main domain IP**. suppose you have ** multi tenant application structure** of your domain just replace your sub domain with * and parked Content is @. so it can automatically accept all your Tenant Domains.
MX or mail exchange record handle your mailing information to end users. like [email protected], [email protected]. See Above in Final Table i placed example.com domain to zoho servers. so you can better to give Priority in the DNS Registry. DKIM (Domain Keys Identified mail) and SPF (Sender Policy Framework) Protects your domain from others. if you have DKIM and SPF records then place it in TXT Records.
It can maintain some information. it can handle your identity and Other Providers verify your trusted owner of domain. Especially it can very helpful when you have multiple Services.
A Certification Authority Authorization (CAA) record is used to specify which certificate authorities (CAs) are allowed to issue certificates for a domain. The purpose of the CAA record is to allow domain owners to declare which certificate authorities are allowed to issue a certificate for a domain. in Final Table You will see some information, i provided it is cloudflare (i trusted from 4 years).
DS (Delegation Signer) record stand as DNSSEC. it can protect your domain name from fraudsters. DNSSEC uses a similar public / private key cryptographic system to HTTPS, except that DNSSEC only uses the keys to sign records, not to encrypt them.
Some Other Kind of Records not mentioned here, because it is very advanced type like CERT, TLSA etc. now finally you understand how DNS Records works. but you can raise a doubt, how we transfer DNS registry one to another Registry when we have Special Cases like in AWS Route53, Google Cloud DNS Registry, Cloudflare or a Shared Server (like bigrock). the answer is here. it is NS Record.
it is most important record because it can handle all other DNS records. when you move NS records to another registry then All other Records Also move automatically. suppose example.com have this records.
sample in godaddy dns NS ns1.domaincontrol.com NS ns2.domaincontrol.com
After Domain Moved to Cloudflare
NS rita.ns.cloudflare.com NS apollo.ns.cloudflare.com
So I just replace the NS record with Cloudflare Records, when it is complete example.com is moved into Cloudflare.
Now you Understand Everything in DNS Management. But Make Sure you have patience in Updated Time. TTL handle update records time and it is dirty in some domain name providers. it can update in 12-24 hours when you place some records. Hopefully this article useful when your a developer or system.servver admin.