1.往返时间(RTT) :
数据包被发送到目的地所用的时间长度,包括在原始位置接收到对该数据包的确认所花费的时间。
2. 生存时间(TTL):
正在发送的数据的生命周期或生命周期。一旦在指定的时间结束或过去后,数据将被丢弃。
或者也可以表示该数据包被设置为存在于网络中的跳数,之后该数据包将被丢弃。 TTL 字段的目的是避免出现无法传递的数据报在网络中不断循环的情况。
往返时间和生存时间的区别:
S.No |
Round trip time |
Time to live |
1 | Also known as ping time. | Also known as hop limit. |
2 | Gives the total time taken to send data packet and to get an acknowledgment back from the destination. | Gives the hop limit to travel in the network path. after that limit the packet will be discarded. |
3 | It is an important for determining the connection on a local network or the larger Internet network, and used to diagnose the speed and reliability of network connections. | Helps us to prevent the data packet from circulating indefinitely in the routers path. |
4 | The round trip time is not stored anywhere, it will be calculated when the acknowledgement comes from destination. | It is an 8-bit field stored in IP header. |
5 | It can be any value, because it depends on many factors. | Maximum value that can be set to TTL is 255 since its the maximum value that we can produce with 8-bits. |
6 | It depends on many factors like distance, no. of hops, server response time etc. | It depends on system, It is set initially by the system which is sending the packet. |
7 | RTT is measured in milliseconds. | TTL is measured in seconds. |
如何找到 RTT 和 TTL ?
示例 1. ping amazon.com
我们可以使用 ping 命令找到 RTT 和 TTL。打开终端或命令提示符并键入以下命令以查看 amazon.com 的 RTT 和 TTL
ping amazon.com
您将看到与此类似的屏幕。
以回复字开头的每一行都是从服务器到客户端对发送的数据包的回复,在上面的例子中,我们得到了 4 个回复,这意味着我们发送了 4 个数据包。
用红框标记的值是RTT(往返时间) ,它以毫秒为单位显示,因为它是以毫秒为单位测量的
蓝色框标记的值是以秒为单位的TTL(生存时间)。
因此,上述 ping 的平均 RTT 为 (230+231+236+230) / 4 = 231.75 ms
ping 上面的 TTL 是235 秒或235 跳
示例 2. ping google.com
在以下命令的帮助下 Ping google.com
ping google.com
运行上述命令后,您将看到与此类似的屏幕
因此,上述 ping 的平均 RTT 为 (48+62+56+44) / 4 = 52.5 ms
ping 上面的 TTL 是114 秒或114 跳。