TTL = Time To Live
Time to live (TTL) or hop limit is a mechanism which limits the lifespan or lifetime of data in a computer or network.
Under the Internet Protocol, TTL is an 8-bit field. In the IPv4 header, TTL is the 9th octet of 20.
在windows终端里ping IPv6看不到ttl, 在IPv6中不存在ttl → 对应的是 hop limit
比如:
ping -n 6 www.baidu.comPinging www.a.shifen.com [240e:e9:6002:1ac:0:ff:b07e:36c5] with 32 bytes of data:Reply from 240e:e9:6002:1ac:0:ff:b07e:36c5: time=332msReply from 240e:e9:6002:1ac:0:ff:b07e:36c5: time=141msReply from 240e:e9:6002:1ac:0:ff:b07e:36c5: time=65msReply from 240e:e9:6002:1ac:0:ff:b07e:36c5: time=94msReply from 240e:e9:6002:1ac:0:ff:b07e:36c5: time=160msReply from 240e:e9:6002:1ac:0:ff:b07e:36c5: time=69msPing statistics for 240e:e9:6002:1ac:0:ff:b07e:36c5: Packets: Sent = 6, Received = 6, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: Minimum = 65ms, Maximum = 332ms, Average = 143ms
另一个例子:
ping -6 -n 4 2607:8700:5501:9799::2Pinging 2607:8700:5501:9799::2 with 32 bytes of data:Request timed out.Reply from 2607:8700:5501:9799::2: time=229msReply from 2607:8700:5501:9799::2: time=213msRequest timed out.Ping statistics for 2607:8700:5501:9799::2: Packets: Sent = 4, Received = 2, Lost = 2 (50% loss),Approximate round trip times in milli-seconds: Minimum = 213ms, Maximum = 229ms, Average = 221ms
ipv4中就有
ping -4 -n 4 8.8.8.8Pinging 8.8.8.8 with 32 bytes of data:Reply from 8.8.8.8: bytes=32 time=215ms TTL=105Reply from 8.8.8.8: bytes=32 time=192ms TTL=105Reply from 8.8.8.8: bytes=32 time=181ms TTL=105Reply from 8.8.8.8: bytes=32 time=184ms TTL=105Ping statistics for 8.8.8.8: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: Minimum = 181ms, Maximum = 215ms, Average = 193ms