LoginSignup
3
0

More than 5 years have passed since last update.

pingコマンドでネットワークインターフェイスを指定する方法

Last updated at Posted at 2018-05-09

macOSでのpingコマンドでネットワークインターフェイスを指定するには-Sオプションを使う。

利用シーン

例えば、WiFiとLANケーブルの2つにMacBookを繋いでいる場合、ネットワークインターフェイスが2つできる。

ping -Sの使い方

ping -S [インターフェイスに割り当てられたIPアドレス] [ICMP送信先のIPアドレス]

「インターフェイスに割り当てられたIPアドレス」を調べる方法は、『Macでネットワークインターフェイスに割り当てられたIPアドレスを調べる方法』を参照。

例えば、ネットワークインターフェイスに割り当てられたIPアドレスが192.168.5.67で、ICMP送信先が1.1.1.1の場合は次のコマンドを実行する:

$ ping -S 192.168.5.67 1.1.1.1
PING 1.1.1.1 (1.1.1.1) from 192.168.5.67: 56 data bytes
64 bytes from 1.1.1.1: icmp_seq=0 ttl=58 time=2.312 ms
64 bytes from 1.1.1.1: icmp_seq=1 ttl=58 time=2.444 ms
64 bytes from 1.1.1.1: icmp_seq=2 ttl=58 time=2.267 ms
3
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0