Send a ping to each IP on a subnet

后端 未结 13 1218
时光说笑
时光说笑 2020-12-07 10:21

Is there a command line based way to send pings to each computer in a subnet? Like

for(int i = 1; i < 254; i++)
    ping(192.168.1.i);

t

13条回答
  •  死守一世寂寞
    2020-12-07 10:35

    for i in $(seq 1 254); do ping -c1 -t 1 192.168.11.$i; done
    

    Adding a -t 1 waits only one second before exiting. This improves the speed a lot if you just have a few devices connected to that subnet.

提交回复
热议问题