存活時間
维基百科,自由的百科全书
存活時間(Time To Live,簡寫TTL)是電腦網路技術的一個術語,指一個封包在通過一個網路時,最長可以逗留的時間。每當封包經過一個路由器,其存活時間就會減一。當其存活時間是1時,主機便取消封包,並傳送一個ICMP TTL封包給原封包的發出者。
目录 |
[编辑] Time to live of IP datagrams
In IPv4, time to live (TTL) is an 8-bit field in the Internet Protocol (IP) header. It is the 9th octet of 20. The time to live value can be thought of as an upper bound on the time that an IP datagram can exist in an internet system. The TTL field is set by the sender of the datagram, and reduced by every host on the route to its destination. If the TTL field reaches zero before the datagram arrives at its destination, then the datagram is discarded and an ICMP error datagram ( 11 - Time Exceeded) is sent back to the sender. The purpose of the TTL field is to avoid a situation in which an undeliverable datagram keeps circulating on an internet system, and such a system eventually becoming swamped by such immortal datagrams.
In theory, time to live is measured in seconds, although every host that passes the datagram must reduce the TTL by at least one unit. In practice, the TTL field is reduced by one on every hop. To reflect this practice, the field is named hop limit in IPv6.
[编辑] DNS
在網域名稱系統 (DNS)中亦有利用「存活時間」這個概念,用來作為nameserver的有效紀錄。
TTLs also occur in the Domain Name System (DNS), where they are set by an authoritative nameserver for a particular Resource Record. When a Caching (recursive) nameserver queries the authoritative nameserver for a Resource Record, it will cache that record for the time ( in seconds ) specified by the TTL. If a stub resolver queries the caching nameserver for the same record before the TTL has expired, the caching server will simply reply with the already cached resource record rather than retrieve it from the authoritative nameserver again. Nameservers also have negative TTLs for negative replies (NXDOMAIN); they are generally short in duration (3 hours at most).
Shorter TTLs can cause heavier loads on an authoritative nameserver, but can be useful when changing the address of critical services like web servers or MX records, and therefore are often lowered by the DNS administrator prior to a service being moved, in order to minimize disruption.
[编辑] 參看
[编辑] 外部連結
- http://serversniff.net/ipinfo.php Serversniff.net shows initial TTLs of a host's IPv4-Datagramms
- http://www.httpsniffer.com/http/1431.htm Max-Forwards as TTL header in HTTP.
- http://rfc-gnutella.sourceforge.net/developer/testing/messageArchitecture.html Gnutella TTL and Hops header values used for preventing loops and monitoring of network topology.