ping ,time,TTL详解
PING (Packet Internet Grope),因特网包探索器,用于测试网络连接量的程序。Ping发送一个ICMP回声请求消息给目的地并报告是否收到所希望的ICMP回声应答。他是怎么工作的呢,看下图
ping请求说明
二,什么是TTlTTL:生存时间
指定数据包被路由器丢弃之前允许通过的网段数量。
TTL 是由发送主机设置的,以防止数据包不断在 IP 互联网络上永不终止地循环。转发 IP 数据包时,要求路由器至少将 TTL 减小 1。
使用PING时涉及到的 ICMP 报文类型:
一个为ICMR请求回显(ICMP Echo Request)
一个为ICMP回显应答(ICMP Echo Reply)
TTL 字段值可以帮助我们识别操作系统类型。
UNIX 及类 UNIX 操作系统 ICMP 回显应答的 TTL 字段值为 255
Compaq Tru64 5.0 ICMP 回显应答的 TTL 字段值为 64
微软 Windows NT/2K操作系统 ICMP 回显应答的 TTL 字段值为 128
微软 Windows 95 操作系统 ICMP 回显应答的 TTL 字段值为 32
当然,返回的TTL值是相同的
但有些情况下有所特殊
LINUX Kernel 2.2.x & 2.4.x ICMP 回显应答的 TTL 字段值为 64
FreeBSD 4.1, 4.0, 3.4;
Sun Solaris 2.5.1, 2.6, 2.7, 2.8;
OpenBSD 2.6, 2.7,
NetBSD
HP UX 10.20
ICMP 回显应答的 TTL 字段值为 255
Windows 95/98/98SE
Windows ME
ICMP 回显应答的 TTL 字段值为 32
Windows NT4 WRKS
Windows NT4 Server
Windows 2000
Windows XP
ICMP 回显应答的 TTL 字段值为 128
这样,我们就可以通过这种方法来辨别操作系统
C:\Documents and Settings>ping blog.51yip.com Pinging blog.51yip.com [173.201.152.6] with 32 bytes of data: Reply from 173.201.152.6: bytes=32 time=257ms TTL=45 Reply from 173.201.152.6: bytes=32 time=256ms TTL=45 Reply from 173.201.152.6: bytes=32 time=262ms TTL=45 Reply from 173.201.152.6: bytes=32 time=258ms TTL=45 Ping statistics for 173.201.152.6: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 256ms, Maximum = 262ms, Average = 258ms
由此我们可以断定,blog.51yip.com是一台linux主机,经过了64-45=19次中转后到达本机,time=257ms,这个时间是一次请求的时间,这个时间越小,说明速度越快,越大说明速度越慢。
C:\Documents and Settings>ping 127.0.0.1 Pinging 127.0.0.1 with 32 bytes of data: Reply from 127.0.0.1: bytes=32 time<1ms TTL=128 Reply from 127.0.0.1: bytes=32 time<1ms TTL=128 Reply from 127.0.0.1: bytes=32 time<1ms TTL=128 Reply from 127.0.0.1: bytes=32 time<1ms TTL=128 Ping statistics for 127.0.0.1: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss) Approximate round trip times in milli-seconds: Minimum = 0ms, Maximum = 0ms, Average = 0ms
在这里的TTL=128是表示二个意思:
1,请求主机是一台WINDOWS系统的电脑
2,并且没有经过路由中转,也就是请求的是本机。每次请求的时间呢,小于百万份之一秒。
(adsbygoogle = window.adsbygoogle || []).push({});- PING工具里的Byte= ` Time=` TTL=`代表的意思
- 详解ping命令TTL
- 详解ping命令TTL
- ping主机时显示 Request Time Out Destination Unreachable TTL Expired in transit
- Golang1.7使用ICMP协议实现ping功能,带TIME和TTL
- %date~0,4%和 %time~0,2%等用法详解
- 服务器TIME_WAIT和CLOSE_WAIT详解和解决办法
- ping 命令 time出现负数
- 串口、COM口、TTL、RS-232、RS-485区别详解
- TCP 协议状态分解---服务器TIME_WAIT和CLOSE_WAIT详解和解决办法
- time模块和datetime模块详解
- 串口、COM口、TTL、RS-232的区别详解
- LeetCode - 121. Best Time to Buy and Sell Stock - 思路详解 - C++
- linux下能ping ip不能ping域名详解
- TCP TIME_WAIT详解
- Run time setting设置详解
- TCP TIME_WAIT详解
- SmokePing之配置文件config详解
- PING命令使用详解
- ping命令详解 ping命令入门详解