## ttl-field-in-ipv4 > TTL被设计为IP数据包在Internet中最长的存活时间。但是实际上,每个转发了IP数据包的设备,都需要将TTL减1,也就是说TTL等于IP数据包能经历的最大跳(hop)数,而不是时间(秒数)。所以,为了避免误解,在IPv6中,将TTL改名为hop limit。 > 虽然TTL从字面上翻译,是可以存活的时间,但实际上TTL是IP数据包在计算机网络中可以转发的最大跳数。TTL字段由IP数据包的发送者设置,在IP数据包从源到目的的整个转发路径上,每经过一个路由器,路由器都会修改这个TTL字段值,具体的做法是把该TTL的值减1,然后再将IP包转发出去。 ```bash ping -t 1 -c 1 baidu.com PING baidu.com (39.156.69.79) 56(84) bytes of data. From 192.168.1.1 (192.168.1.1) icmp_seq=1 Time to live exceeded ``` ```bash sysctl net.ipv4.ip_default_ttl ``` ## ttl-value-in-dns-records > In the context of a DNS record, TTL is a numerical value that determines how long a DNS cache server can serve a DNS record before reaching out to the authoritative DNS server and getting a new copy of the record. ## ref * * * * * * * *