Let me tell you a funny story that will show you the importance of TTL when sending packages. 

Back in the day, in 1971, there was a programmer called Bob Thomas who was working on mainframe computers. He got bored and decided to play around. After a while, Bob created a small software called the Creeper and released it on the network. It was a tiny code with the message “I’m the creeper: catch me if you can”. Ray Tomlinson, a colleague of his, added the functionality and allowed the code to copy itself. This was the first computer virus. The virus was unstoppable because there was no antivirus at this time, and it had no TTL, so it could go around the network forever. The co-creator Ray needed to invent the first antivirus to stop it. Otherwise, it could still go around for a long time. 

So what is TTL in networking? 

TTL means time to live and refers to the value, the maximum amount of hops (moves from one network device to another) that a data packet has before it gets removed. It is a hard limiter that shows how many times the packet could go on the network. 

The data packets have their destinations, but there are millions of reasons why they could fail to reach them. They must be able to “find rest” and stop their eternal search if they have failed after a while. 

The idea is simple: millions of network devices are out there, and you don’t want the packets to travel forever. So when somebody sends a data packet, they add a value called TTL with the maximum amount of hops this data could travel. Each time it passes through a network device (router), the device will remove one from the previous value until it reaches the destination or gets discarded. 

If the router puts the TTL to 0 and removes the data packet, it will send a message about the failure to the original sender (the IP address that shows the source). 

What is TTL in DNS? 

TTL (time to live) in DNS (domain name system) indicates the amount of time (in seconds) that a DNS record is valid, and a nameserver (recursive or secondary DNS server) can keep this particular DNS record, such as A record or, ALIAS record in its cache memory. When the TTL gets to 0, the DNS record will be deleted. 

In the case of a recursive DNS server, the DNS client needs to ask the recursive DNS server again and wait for it to do a new DNS query to get the record. After that, it will be kept in the cache again based on the TTL. 

In the case of a secondary DNS server, it must check again with the primary DNS server and perform a zone transfer to update its DNS records. Otherwise, it won’t be able to respond to queries for the domain. 

Ping Command – Everything You Need To Know

Conclusion

The TTL value is a very important aspect of networking. It limits the hops of a data packet and does not allow packets that travel forever on the network. That way, it saves a lot of network resources. 

On the side of the DNS, it allows better DNS record management and serves to indicate if the DNS records inside a DNS server are still valid or have been there for too long. 

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *