Send a ping to each IP on a subnet

后端 未结 13 1266
时光说笑
时光说笑 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:32

    Not all machines have nmap available, but it's a wonderful tool for any network discovery, and certainly better than iterating through independent ping commands.

    $ nmap -n -sP 10.0.0.0/24
    
    Starting Nmap 4.20 ( http://insecure.org ) at 2009-02-02 07:41 CST
    Host 10.0.0.1 appears to be up.
    Host 10.0.0.10 appears to be up.
    Host 10.0.0.104 appears to be up.
    Host 10.0.0.124 appears to be up.
    Host 10.0.0.125 appears to be up.
    Host 10.0.0.129 appears to be up.
    Nmap finished: 256 IP addresses (6 hosts up) scanned in 2.365 seconds
    

提交回复
热议问题