Ping

Article on other languages:

del.icio.us del.icio.us
Digg Digg
Furl Furl
Reddit Reddit
Rojo Rojo
Add to OnlyWire


ping(ピング、ピン)はTCP/IPネットワークにおいて、ノードの到達性を確認するツールである。TCP/IPネットワークへの接続をサポートするOSには、大抵デフォルトで搭載されている。pingはICMPの”echo request”パケットを対象ノードに投げ、対象ノードから”echo response”が返ってくることで到達性を確認している。pingではリプライが返ってくるまでの時間や応答率から、対象ノード間のラウンドトリップタイム(RTT)やパケットロス率を求めることができる。これらは対象ノード間の回線状況を知るため重要な情報である。

目次

pingの歴史

1983年12月、当時アメリカ陸軍の弾道学研究所(Ballistics Research Lab)に所属していたマイク・ムースMike Muuss)氏が自身の管理するネットワークでのトラブルシュート用にプログラムを書いた。そのプログラムの挙動が潜水艦などで使われるアクティブソナーの発する音波(=ping)の挙動と似ていることから、pingと名づけた。後にNTPを開発したデビット・L・ミルズ(David L. Mills)氏により”Packet Internet Grouper (Groper)”、別の人より”Packed Internet Gopher”(ここでのGopherはIT用語でのGopherではなく、齧歯目のGopher)というバクロニムを授かっている。

インターネットの接続性の問題の”診断”にも有用なpingであったが、2003年末、Welchiaのようなpingをネットワークにフラッドし標的を探すタイプのコンピュータウイルスが出現したり、悪意を持ったユーザが攻撃目標の調査やネットワークに負荷をかけるなどの目的でpingの悪用を行ったため、一部のISPでICMP Type 8(echo request)パケットがフィルタリングされるようになった。

pingの出力例

以下の出力例はLinux端末からwww.google.comへ、iputilsバージョンのpingからpingを打った結果である。

$ ping www.google.com
PING www.l.google.com (64.233.183.103) 56(84) bytes of data.
64 bytes from 64.233.183.103: icmp_seq=1 ttl=246 time=22.2 ms
64 bytes from 64.233.183.103: icmp_seq=2 ttl=245 time=25.3 ms
64 bytes from 64.233.183.103: icmp_seq=3 ttl=245 time=22.7 ms
64 bytes from 64.233.183.103: icmp_seq=4 ttl=246 time=25.6 ms
64 bytes from 64.233.183.103: icmp_seq=5 ttl=246 time=25.3 ms
64 bytes from 64.233.183.103: icmp_seq=6 ttl=245 time=25.4 ms
64 bytes from 64.233.183.103: icmp_seq=7 ttl=245 time=25.4 ms
64 bytes from 64.233.183.103: icmp_seq=8 ttl=245 time=21.8 ms
64 bytes from 64.233.183.103: icmp_seq=9 ttl=245 time=25.7 ms
64 bytes from 64.233.183.103: icmp_seq=10 ttl=246 time=21.9 ms

--- www.l.google.com ping statistics ---
10 packets transmitted, 10 received, 0% packet loss, time 9008ms
rtt min/avg/max/mdev = 21.896/24.187/25.718/1.619 ms

出力例からわかることは、まずwww.google.comというURLDNSのCNAMEレコードによりwww.l.google.comへ誘導され、64.233.183.103というIPアドレスにリソルブされている。そして64.233.183.103に向けて10回pingが打たれており(Linuxの場合はデフォルトではCtrlとCを打って止めるまで、ずっとpingが打たれる設定となっている)、出力の最後にpingの結果が出ている。

結果からわかることは以下の通りである。

  • パケットは10回送信され、10回とも受信された。パケットロスは0%である。
  • ラウンドトリップタイムは最短21.896ミリ秒(1ミリ秒=1/1000秒)、平均24.187ミリ秒、最長25.718ミリ秒、平均偏差は1.619である。

以下の出力例はMac OS X端末からwww.google.comへ、ターミナルのコマンドpingからpingを打った結果である。 ただし、computernameはコンピューター名、usernameはユーザー名である。

computername:~ username$ ping www.google.com
PING www.l.google.com (66.249.89.104): 56 data bytes
64 bytes from 66.249.89.104: icmp_seq=1 ttl=238 time=30.556 ms
64 bytes from 66.249.89.104: icmp_seq=2 ttl=238 time=30.412 ms
64 bytes from 66.249.89.104: icmp_seq=3 ttl=238 time=31.272 ms
64 bytes from 66.249.89.104: icmp_seq=4 ttl=238 time=30.121 ms
64 bytes from 66.249.89.104: icmp_seq=5 ttl=238 time=30.942 ms
64 bytes from 66.249.89.104: icmp_seq=6 ttl=238 time=32.132 ms
64 bytes from 66.249.89.104: icmp_seq=7 ttl=238 time=30.680 ms
64 bytes from 66.249.89.104: icmp_seq=8 ttl=238 time=32.614 ms
64 bytes from 66.249.89.104: icmp_seq=9 ttl=238 time=29.405 ms
64 bytes from 66.249.89.104: icmp_seq=10 ttl=238 time=41.360 ms
64 bytes from 66.249.89.104: icmp_seq=11 ttl=238 time=32.176 ms
64 bytes from 66.249.89.104: icmp_seq=12 ttl=238 time=32.321 ms
^C
--- www.l.google.com ping statistics ---
13 packets transmitted, 12 packets received, 7% packet loss
round-trip min/avg/max/stddev = 29.405/31.999/41.360/2.978 ms

Mac OS XUNIX互換であるため、Linuxとほぼ変わらない表示である。 今回は-cオプションで回数設定していないため、Control+cでとめない限り、永遠に続くのである。(例では13回pingを打っている) 見方はLinuxの出力例を参考。

logから分かる事は、

  • 13回パケットを送信し、12回受信してロスは、7%である。
  • RTT(ラウンドトリップタイム)は最短29.405ミリ秒(ms)、平均31.999ミリ秒、最長41.360ミリ秒、平均偏差は2.978ミリ秒である。

以下の出力例はMicrosoft Windows XP端末からwww.google.comへ、コマンドプロンプト標準のpingを使用してpingを打った結果である。

C:\>ping www.google.com

Pinging www.l.google.com [64.233.183.103] with 32 bytes of data:

Reply from 64.233.183.103: bytes=32 time=25ms TTL=245
Reply from 64.233.183.103: bytes=32 time=22ms TTL=245
Reply from 64.233.183.103: bytes=32 time=25ms TTL=246
Reply from 64.233.183.103: bytes=32 time=22ms TTL=246

Ping statistics for 64.233.183.103:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 22ms, Maximum = 25ms, Average = 23ms

出力例からわかることは、まずwww.google.comというURLがDNSのCNAMEレコードによりwww.l.google.comへ誘導され、64.233.183.103というIPアドレスにリソルブされている。そして64.233.183.103に向けて4回pingが打たれており(Windowsの場合はデフォルトではpingは4回ずつ打たれる設定となっている)、出力の最後にpingの結果が出ている。

結果からわかることは以下の通りである。

  • パケットは4回送信され、4回とも受信された。パケットロスは0%である。
  • ラウンドトリップタイムは最短22ミリ秒、最長25ミリ秒、平均23ミリ秒である。

関連項目

外部リンク

  • The Story of the PING Program pingの作者である故マイク・ムース氏の解説(英語)
  • ping.eu Ping and other online tools and services オンラインネットワークサービス

This article is from Wikipedia. All text is available under the terms of the GNU Free Documentation License.


Giant Panda

Mercedes Car
James Bond Guide
This site monitored by SitePinger.net