TTL в ping по сравнению с роет

Когда я работал ping google.com, Я получаю a ttl значение 55:

64 bytes from 173.194.127.103: icmp_seq=68 ttl=55 time=16.4 ms

Когда я работал dig google.com @ns1.google.com., это получает a TTL значение 300.

google.com.     300 IN  A   173.194.127.34

Почему я получаю два различных значения для TTL, и какой релевантен в какой ситуация?

-1
задан 22 January 2015 в 03:12
2 ответа

TTLTTL с ping имеет совершенно другое значение, чем для DNS.

Для DNS это означает, как долго запись может кэшироваться, прежде чем ее можно будет считать слишком старой. Значение для ping означает, сколько прыжков пакет может пройти по разным сетям, прежде чем он будет выброшен. Каждый прыжок на пути к цели уменьшит это значение на 1, и если будет слишком много прыжков, то пакет будет сброшен. Это сделано для того, чтобы предотвратить никогда не заканчивающиеся циклы для пакетов в случае ошибок в конфигурации.

И я согласен, что такой гигант, как Google, который должен идти на необычайно длинные расстояния и использует все доступные уловки, чтобы иметь возможность ответить так же быстро, как они это делают, не является хорошим примером для рассмотрения этого вопроса.

5
ответ дан 5 December 2019 в 19:03

Дополнительный контекст для проверки связи TTL из справочной страницы.

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
ответ дан 5 December 2019 в 19:03

Теги

Похожие вопросы