--> Whenever you try to access any website over the internet, The first thing happens on your machine is DNS Query/Response.
--> The main purpose of the DNS Query/Response is to find out the IP address of the webserver which is hosting the Website.
--> Whenever the DNS Client(For example PC) queries the DNS Server to find out the IP address of the Website, The DNS Server returns the TTL Value in addition to the IP address.
--> TTL (Time To Live) is a value configured on the DNS Server which informs the client how long it should store the DNS record details before sending the query to get the updated information.
--> In the above screenshot you can see that the DNS Server returned the TTL Value of 599 in addition to the IP address.
--> This means that that the client PC stores the IP address of kareemccie.com in the DNS cache for the 599 Seconds.
--> If the user tries to access the kareemccie.com again within the timespan of 599 seconds, The DNS Query is not sent to the DNS Server. However, If the user tries to access the website after 600 seconds then the DNS Query is sent again to the DNS Server.
--> The TTL value for any DNS record can only be configured/changed on the Primary DNS server/Authorative DNS Server for a particular domain.
--> If you want to change the TTL value of a DNS Record ( FQDN) then you will have to go into the Authorative DNS Server and then change the value accordingly.
--> DNS TTL values can be configured from 0 seconds to 248555 days
--> Now you might be having a question, What should be the value of the TTL( Set to Long TTL or Short TTL) configured for a DNS record.
--> Following things need to be taken into consideration before setting up the TTL Value for the DNS Record.
1) Where the DNS Server is Hosted
--> If the DNS Server is hosted in the ISP then they will charge you based upon number queries per second
--> The more number of Queries Per Second the more you would be charged by the ISP.
--> Longer TTL Value is recommended in this case.
2) Do you have a Disaster Recovery Site or not
--> If you have two web servers for the FQDN, One is in Primary Data Center and the other one is Disaster Recovery Site
--> Shorter TTL Value is recommended in this case.
3) How Critical the Application/FQDN for the Business
--> What is the Business loss if the DNS record is still pointing towards the IP address of the webserver on the user's DNS cache
--> Shorter TTL Value is recommended in this case.
4) Are you changing/Migrating the IP address of the Web Server which is hosting the FQDN
--> If the TTL value of the DNS record is higher then the users still try to access the FQDN/Application using old IP address.
--> Before changing the IP address of the Web Server which hosts the FQDN, Make the TTL Value of the DNS record around 60 seconds.
--> Update the DNS record with the new IP address of the Web Server and Change the TTL value of the DNS record to a higher value after one week.
5) What type of DNS Record the user is requesting ( Is it CNAME or MX or A Record)
--> Records such as CNAME or MX record does not change a lot compared to A records.
--> Longer TTL Value is recommended in the case of CNAME or MX or TXT Records.
Note: Most of the time, the client uses the ISP DNS server for finding out the IP address of the FQDN/Application which does not follow the TTL values provided by the Authorative DNS Server of the FQDN.
Excellent explanation
ReplyDeleteGood sharing.
ReplyDeleteGood explanation.. Thank you so much
ReplyDelete