首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >平地TTL与dig

平地TTL与dig
EN

Server Fault用户
提问于 2015-01-21 13:56:23
回答 2查看 1.3K关注 0票数 -1

当我运行ping google.com时,我得到一个ttl55

代码语言:javascript
复制
64 bytes from 173.194.127.103: icmp_seq=68 ttl=55 time=16.4 ms

当我运行dig google.com @ns1.google.com.时,它得到一个TTL300

代码语言:javascript
复制
google.com.     300 IN  A   173.194.127.34

为什么TTL有两个不同的值,哪个值与什么情况有关?

EN

回答 2

Server Fault用户

回答已采纳

发布于 2015-01-21 14:08:19

与DNS相比,带有TTLping具有完全不同的含义。

对于DNS来说,它意味着记录在被认为太旧之前可以缓存多长时间。ping的值意味着数据包在被丢弃之前可以接管不同网络的跳数。在到达目标的路径上,每跳一次就会将该值减少1,如果跳数过多,数据包将被丢弃。这是为了防止在配置错误的情况下对数据包进行永不结束的循环。

我也同意,像谷歌这样的庞然大物,必须千方百计地运用每一个技巧来尽快回答这个问题,这并不是一个好的例子。

票数 5
EN

Server Fault用户

发布于 2015-01-22 04:14:08

来自手册的ping TTL的附加上下文。

代码语言:javascript
复制
TTL DETAILS
       The  TTL  value  of  an  IP  packet represents the maximum number of IP
       routers that the packet can go through before being  thrown  away.   In
       current  practice  you can expect each router in the Internet to decre-
       ment the TTL field by exactly one.

       The TCP/IP specification states that the  TTL  field  for  TCP  packets
       should  be set to 60, but many systems use smaller values (4.3 BSD uses
       30, 4.2 used 15).

       The maximum possible value of this field is 255, and most Unix  systems
       set the TTL field of ICMP ECHO_REQUEST packets to 255.  This is why you
       will find you can ‘‘ping’’ some hosts, but not  reach  them  with  tel-
       net(1) or ftp(1).

       In  normal  operation  ping  prints  the  ttl  value from the packet it
       receives.  When a remote system receives a ping packet, it can  do  one
       of three things with the TTL field in its response:

       · Not  change  it;  this  is  what Berkeley Unix systems did before the
         4.3BSD Tahoe release. In this case the  TTL  value  in  the  received
         packet  will  be  255  minus  the number of routers in the round-trip
         path.

       · Set it to 255; this is what current Berkeley  Unix  systems  do.   In
         this  case the TTL value in the received packet will be 255 minus the
         number of routers in the path from the remote system to  the  pinging
         host.

       · Set it to some other value. Some machines use the same value for ICMP
         packets that they use for TCP packets, for example either 30  or  60.
         Others may use completely wild values.
票数 0
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/661226

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档