このエントリーをはてなブックマークに追加


Windowsでpingコマンドを実行してみる

Windowsにもpingコマンドがあります。
以下に使用方法と実行例を記します。


pingコマンドのオプション

よく使いそうなpingコマンドのオプションを以下に記します。

  • -a IPアドレス指定時、名前解決をする。
  • -n パケット送信回数を指定できる。
  • -w リプライの待ち時間をミリ秒で指定する(タイムアウト値)

Windowsのpingコマンドのヘルプは以下のようになっています。

C:\Documents and Settings\sakura>ping /?

Usage: ping [-t] [-a] [-n count] [-l size] [-f] [-i TTL] [-v TOS]
            [-r count] [-s count] [[-j host-list] | [-k host-list]]
            [-w timeout] target_name

Options:
    -t             Ping the specified host until stopped.
                   To see statistics and continue - type Control-Break;
                   To stop - type Control-C.
    -a             Resolve addresses to hostnames.
    -n count       Number of echo requests to send.
    -l size        Send buffer size.
    -f             Set Don't Fragment flag in packet.
    -i TTL         Time To Live.
    -v TOS         Type Of Service.
    -r count       Record route for count hops.
    -s count       Timestamp for count hops.
    -j host-list   Loose source route along host-list.
    -k host-list   Strict source route along host-list.
    -w timeout     Timeout in milliseconds to wait for each reply.

pingコマンドを実行してみる

www.yahoo.co.jpにpingを送信した出力結果です。

  • オプションなし デフォルトのping回数は4回になっています。
    C:\Documents and Settings\sakura>ping www.yahoo.co.jp
    
    Pinging www.g.yahoo.co.jp [124.83.147.212] with 32 bytes of data:
    
    Reply from 124.83.147.212: bytes=32 time=19ms TTL=127
    Reply from 124.83.147.212: bytes=32 time=24ms TTL=127
    Reply from 124.83.147.212: bytes=32 time=27ms TTL=127
    Reply from 124.83.147.212: bytes=32 time=22ms TTL=127
    
    Ping statistics for 124.83.147.212:
        Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
    Approximate round trip times in milli-seconds:
        Minimum = 19ms, Maximum = 27ms, Average = 23ms
  • オプション -n で回数を指定 オプション -n で1回を指定したときの出力。
    C:\Documents and Settings\sakura>ping -n 1 www.yahoo.co.jp
    
    Pinging www.g.yahoo.co.jp [124.83.179.227] with 32 bytes of data:
    
    Reply from 124.83.179.227: bytes=32 time=22ms TTL=127
    
    Ping statistics for 124.83.179.227:
        Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),
    Approximate round trip times in milli-seconds:
        Minimum = 22ms, Maximum = 22ms, Average = 22ms


トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2015-03-20 (金) 22:49:37