Post

Configuration of DNS TTL (Time-To-Live)

TTL (Time-To-Live) on DNS (Domain Name System) is a value that indicates how long a DNS record will be stored in the cache. During this time, when a DNS query is made, DNS resolvers cache the response they receive and retain this response for the specified TTL period.

For example, when you make a DNS query for www.farukguler.com, the resolver learns the IP address of that domain and caches that information. If the TTL time is set to 3600 seconds (1 hour), the parser will use the same response without querying the same record again for one hour. To view the TTL assigned to the record on the DNS server, you need to find and use the authoritative DNS server for the record you are examining.
Found in this Statement of Authority (SOA) record:
Keep your DNS TTL minimum greater than 0, as setting it to 0 may cause your DNS information to be ignored or rejected.

What is the TTL time in Best practices?
1 hour (3600 seconds) for static recordings
20 minutes (1200 seconds) for dynamic recordings

The TTL setting for a DNS can be changed via the dns record.

The default TTL setting for a zone is changed via SOA.

***For these operations, you need to activate the View > Advanced setting.

> PS:
Get:
Get-DnsServerResourceRecord -ZoneName "guler.com"
Get-DnsServerResourceRecord -ZoneName "guler.com" -RRType "A"
Get-DnsServerResourceRecord -ZoneName "guler.com" -Name "mail"

Set:
Add-DnsServerResourceRecordA -Name "posta" -ZoneName "guler.com" -AllowUpdateAny -IPv4Address "10.5.11.24" -TimeToLive 05:00:00

Add-DnsServerResourceRecord -CName -Name "host14" -HostNameAlias "Host34.lab.contoso.com" -ZoneName "guler.com" -AllowUpdateAny -TimeToLive 01:00:00

Add-DnsServerResourceRecord -Name "." -MX -ZoneName "guler.com" -MailExchange "mail.guler.com" -Preference 10
SET Windows DNS Server:
-Explained above

SET Linux DNS Server:
RedHat / CentOS:
sudo nano /var/named/guler.com.db
$TTL 86400 #in seconds
sudo named-checkconf
sudo systemctl restart named

Debian:
sudo nano /etc/bind/guler.com.db
$TTL 86400 #in seconds
sudo named-checkconf
sudo systemctl restart named

Windows TTL Check: (spesific: MX, CNAME, TXT, A, NS)
nslookup -type=A -debug farukguler.com
nslookup -type=cname -debug farukguler.com
Resolve-DnsName -Name farukguler.com

Linux TTL Check:
dig www.farukguler.com
dig A www.farukguler.com
dig +nocmd +noall +answer +ttlunits A www.farukguler.com

Check the Google Web Toool:
https://toolbox.googleapps.com/apps/dig/

How to change Lifetime in cPanel.

Stay hungry to learn.

This post is licensed under CC BY 4.0 by the author.