LoginSignup
2
0

More than 5 years have passed since last update.

pingをある範囲に実施するワンライナー

Posted at

Powershellにて

for($idx=0;$idx-lt255;$idx++){ping -n 1 192.168.0.$idx | Select-String TTL;}

出力例

以下のように返答があったアドレスのみ表示される。

192.168.0.1 からの応答: バイト数 =32 時間 =2ms TTL=64
192.168.0.31 からの応答: バイト数 =32 時間 =686ms TTL=64
192.168.0.35 からの応答: バイト数 =32 時間 =180ms TTL=64
192.168.0.54 からの応答: バイト数 =32 時間 =3ms TTL=64
192.168.0.80 からの応答: バイト数 =32 時間 <1ms TTL=128
192.168.0.148 からの応答: バイト数 =32 時間 =123ms TTL=64

動機

RasPiをLANにつないでSSH経由でモニタレスでセットアップしたいが、RasPiのアドレスを調べる必要があったため。
そういう時はRaspberryPiのSSHを有効にしてから起動するようにする。
Raspberrypi sshを有効に

2
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
2
0