TTL – meaning
Time To Live (TTL) is the value that indicates how long the data should be stored in a particular device. A lot of data pieces hold their own TTL value.
If we speak about DNS TTL, it refers to the time the DNS resolvers have to store the DNS records in their cache memory. Every DNS record also has its own TTL value. Some of them have longer TTL because the chance is less for the value to change. Yet, others have shorter TTL values, where changes more often happen.
Here is a basic illustration of values as an orientation for your DNS records:
- A and AAAA records – 2 hours (7200 seconds)
- CNAME records – up to 12 hours (43200 seconds)
- TXT records – up to 12 hours (43200 seconds)
- MX records – 1 hour (3600 seconds)
How does it work?
The huge amounts of packets are going to travel around routers continuously if they are not controlled. To avoid such a thing, it is essential to set a limit or expiration for each data packet. That way, it is easier to track their route and know how long they have been around. To arrive at their destination, packets travel through network points. Therefore, inside each data packet, there is a TTL value. Routers get the packet and transfer it to the following network point only if time or hops are available. However, if the TTL indicates that there are no more spare hops/time, routers will not transfer it anymore.
Alternatively, routers are going to send an ICMP (Internet Control Message Protocol) message. It reports IP errors and points to the IP address source that issued the packet.
How to check TTL?
You can use the Nslookup command if you are a Windows user. With it, you can check a precise DNS record, such as SOA, A, AAAA, MX, and others. Just change the type of DNS record with the one you desire to view.
Open the Command Prompt as an administrator, and type the following:
nslookup –types=a domain.com
Linux or macOS
There are more options for users of Linux or macOS. You can choose which one of the commands to apply through the Terminal.
The Dig command is one of them that can give information about different DNS records, and you can view their TTL value. For instance, type the following to view the A record.
dig a domain.com
The Host command is another option, and you can use it in a very similar way:
host –a domain.com
This command will give you the information for all of the available DNS records with their TTL values.
Where can you find TTLs?
- In networking, TTL is in each data packet transferred to a recipient.
- DNS queries are data packets too, and they hold time-to-live.
- DNS recursive servers cache DNS records for the time determined in each record. After it expires, the DNS recursive server has to complete a new lookup to get a current copy of the record from the authoritative DNS server and store it again.
- Content delivery networks (CDN) utilize the TTL to establish for how long the servers to keep the content in their cache memory. Once the time-to-live expires, that content is dropped. Servers have to perform a query to the primary servers to refresh and receive a new copy. After that, they keep it in the cache memory till the TTL expires again.