茫茫網海中的冷日
         
茫茫網海中的冷日
發生過的事,不可能遺忘,只是想不起來而已!
 恭喜您是本站第 1664657 位訪客!  登入  | 註冊
主選單

Google 自訂搜尋

Goole 廣告

隨機相片
IMG_60D_00031.jpg

授權條款

使用者登入
使用者名稱:

密碼:


忘了密碼?

現在就註冊!

一網情深 : [轉貼]Ping 的基礎用法

發表者 討論內容
冷日
(冷日)
Webmaster
  • 註冊日: 2008/2/19
  • 來自:
  • 發表數: 15766
[轉貼]Ping 的基礎用法
Ping的基礎用法

ping是一個電腦網路工具,用來測試特定主機能否通過IP到達。

簡單說,就是由執行 ping 的主機送出資料給另一主機,並等待其回應,以檢查兩台主機間之網路狀況的工具。

例如,假設 A = 您的電腦,B = www.yahoo.com.tw
我利用執行cmd之後
輸入ping www.yahoo.com.tw -t
會一直重複出現測試結果。time值越低越好。

出現下列結果:
Reply from 203.84.119.112: bytes=32 time=150ms TTL=51
Request timed out
Reply from 202.43.195.12: bytes=32 time=257ms TTL=50
Reply from 202.43.195.12: bytes=32 time=56ms TTL=52
Reply from 202.43.195.12: bytes=32 time=80ms TTL=52
Reply from 202.43.195.12: bytes=32 time=150ms TTL=51
Reply from 202.43.195.12: bytes=32 time=243ms TTL=52


ping 這個程式,就是發一個封包給對方,待對方回答之後,計算兩者間隔以判斷網路狀況。
t=0:A-ping!-------------------B (A 發出 ping)
t=x:A-------------------ping!-B (ping 抵達 B)
t=y:A---------------ping!-----B (B 回應 ping)
t=z:A-ping!-------------------B (ping 回道 A)
A 便會計算從 t=0 到 t=z 的往返時間,回報 time=150ms (0.15秒).
TTL 是 Time to Live 的簡稱,封包每經過一個 host/router,TTL 就會減一。一般從 64 開始算,所以,您的 TTL=51 意思是 www.yahoo.com.tw 的回答經過了 64-51 共 13 台機器,回到您的主機。
如果您的主機發出了 ping,但卻收不到回答 (可能是封包在網路中掉了,或是 www.yahoo.com.tw 拒絕回答 ) ,那主機會回報 request timed out.

根據資料顯示,網路確定塞車。因為往返時間有一次 time=56ms,意思是機器明明做的到 56ms 的,但是有時候它花了 time=257ms,多餘的時間就是塞在半路上的時間。
另外, TTL 時間也有問題,它有時候50,有時候51,有時候52,意思是每個 ping 封包經過的路徑不同,最常見的原因就是塞車造成封包改道。
根據以上資料判斷,網路本身在塞。.

列出一個正常的 ping參考:
Reply from 209.131.36.158: bytes=32 time=211ms TTL=52
Reply from 209.131.36.158: bytes=32 time=231ms TTL=52
Reply from 209.131.36.158: bytes=32 time=254ms TTL=52
Reply from 209.131.36.158: bytes=32 time=173ms TTL=52
Reply from 209.131.36.158: bytes=32 time=195ms TTL=52
Reply from 209.131.36.158: bytes=32 time=216ms TTL=52
Reply from 209.131.36.158: bytes=32 time=237ms TTL=52
Reply from 209.131.36.158: bytes=32 time=156ms TTL=52
Reply from 209.131.36.158: bytes=32 time=178ms TTL=52

注意 TTL 很固定,代表封包從未繞道避開塞車。time 也很穩定,從未掉封包。

常用參數:
-t 
不停的ping地方主機,直到你按下Control-C。
-a
解析電腦NetBios名。
示例﹕
ping -a 203.84.219.114
Pinging iceblood.yofor.com [203.84.219.114] with 32 bytes of data:
Reply from 203.84.219.114: bytes=32 time<10ms TTL=254
Reply from 203.84.219.114: bytes=32 time<10ms TTL=254
Reply from 203.84.219.114: bytes=32 time<10ms TTL=254
Reply from 203.84.219.114: bytes=32 time<10ms TTL=254
Ping statistics for 203.84.219.114:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms

從上面就可以知道IP為203.84.219.114的電腦NetBios名為w2.rc.vip.sg1.yahoo.com。
-n.
發送count指定的Echo資料包數。
一般ping都只發送四個資料包,通過這個命令可以自己定義發送的個數,對衡量網路速度很有幫助,比如我想測試發送50個資料包的返回的平均時間為多少,最快時間為多少,最慢時間為多少就可以通過以下獲知﹕
示例﹕
ping -n 50 202.103.96.68
Pinging 202.103.96.68 with 32 bytes of data:
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
Request timed out.
………………
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
Ping statistics for 202.103.96.68:
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
Minimum = 40ms, Maximum = 51ms, Average = 46ms

從以上我就可以知道在給202.103.96.68發送50個資料包的過程當中,返回了48個,其中有兩個由於未知原因丟失,這48個資料包當中返回速度最快為40ms,最慢為51ms,平均速度為46ms。

原文出處:Ping的基礎用法 @ 采奕資訊股份有限公司 :: 隨意窩 Xuite日誌
冷日
(冷日)
Webmaster
  • 註冊日: 2008/2/19
  • 來自:
  • 發表數: 15766
[轉貼]指令 ping 得到 TTL 值的意義

指令ping得到TTL值的意義

發表於 2007/01/04

ping xxx.xxx.xxx.xxx
得到Peply from xxx.xxx.xxx.xxx: bytes=32 time<1ms TTL= 128
讓對方返回給你的TTL值大小,粗略的判斷目標主机的系統類型是Windows系列還是UNIX/Linux系列,一般情況下Windows系列的返回的TTL值在100-130之間,而UNIX/Linux系列的系統返回的TTL值在240-255之間,當然TTL的值在對方的主机裡是可以修改的

TTL
128 win2000
64  freebsd
60  hp printer
32  win98,me


修改方法:
[HKEY_LOCAL_MACHINE�SYSTEM CurrentControlSet Services Tcpip Parameters]
  "DefaultTTL"=dword:000000ff
  255—FF
  128—80
  64—-40
  32—-20
http://www.php5.idv.tw/modules.php?mod=books&act=show&shid=2470



原文出處:指令ping得到TTL值的意義 | 人生五十才開始
冷日
(冷日)
Webmaster
  • 註冊日: 2008/2/19
  • 來自:
  • 發表數: 15766
[轉貼]TTL on wiki(存活時間)
存活時間
維基百科,自由的百科全書

存活時間(英語:Time To Live,簡寫TTL)是電腦網路技術的一個術語,指一個封包在經過一個網路時,可傳遞的最長距離(躍點數)。每當封包經過一個路由器時,其存活時間就會被減一。當其存活時間為0時,路由器便會取消封包並傳送一個ICMP TTL封包給原封包的發出者。其設計目的是防止封包因不正確的路由表等原因造成的無限循環而無法送達及耗盡網路資源。

DNS
在網域名稱系統 (DNS)中亦有利用「存活時間」這個概念,用以設定網域名稱紀錄的最長快取時間。

原文出處:存活時間 - 維基百科,自由的百科全書

Time to live

Time to live (TTL) or hop limit is a mechanism that limits the lifespan or lifetime of data in a computer or network. TTL may be implemented as a counter or timestamp attached to or embedded in the data. Once the prescribed event count or timespan has elapsed, data is discarded. In computer networking, TTL prevents a data packet from circulating indefinitely. In computing applications, TTL is used to improve performance of caching or to improve
privacy.

IP packets

Under the Internet Protocol, TTL is an 8-bit field. In the IPv4 header, TTL is the 9th octet of 20. In the IPv6 header, it is the 8th octet of 40. The maximum TTL value is 255, the maximum value of a single octet. A recommended initial value is 64.

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 router 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 (

In theory, under IPv4, 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 renamed hop limit in IPv6.

DNS records

TTLs also occur in the Domain Name System (DNS), where they are set by an
authoritative name server 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. TTL for NXDOMAIN responses is set from the minimum of the MINIMUM field of the SOA record and the TTL of the SOA itself, and indicates how long a resolver may cache the negative answer. [ jargon]


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 disruptions.

The units used are seconds. An older common TTL value for DNS was 86400 seconds, which is 24 hours. A TTL value of 86400 would mean that, if a DNS record was changed on the authoritative nameserver, DNS servers around the world could still be showing the old value from their cache for up to 24 hours after the change.

Newer DNS methods that are part of a DR (

HTTP

Time to live may also be expressed as a date and time on which a record expires. The Expires: header in HTTP responses and the expires field in HTTP cookies express time-to-live in this way.

See also

References

  1. ^ "Default TTL Values in TCP/IP" . Retrieved 2013-02-19.
     
  2. ^ "IP OPTION NUMBERS". 2012-11-30 . Retrieved 2013-02-19. The current recommended default time to live (TTL) for the Internet Protocol (IP) is 64 [RFC791], [RFC1122].
     
  3. https://tools.ietf.org/html/rfc2308

External links

前一個主題 | 下一個主題 | 頁首 | | |



Powered by XOOPS 2.0 © 2001-2008 The XOOPS Project|