To do this, you need to put all the hosts that need to be checked in a file. For example, I put all my hosts in a file called ping_list:
$ cat ping_listThere are a few ways to ping multiple hostnames, I'll list out what I have tried before:
cat.myhost.net
dog.myhost.net
tiger.myhost.net
bird.myhost.net
1. Use nmap
$ nmap -sP -iL ping_listwhere -sP is for ping test and -iL is for inputting from files.
Failed to resolve given hostname/IP: cat.myhost.net. Note that you can't use '/mask' AND '1-4,7,100-' style IP ranges
Failed to resolve given hostname/IP: dog.myhost.net. Note that you can't use '/mask' AND '1-4,7,100-' style IP ranges
Host 192.168.0.99 is up (0.00036s latency).
Host 192.168.0.100 is up (0.00061s latency).
2. One liner for loop
$ for i in `cat ping_list`; do ping -c1 $i; doneI believe there are other tools or scripts beside those I listed above, but I always these 2 methods to ping multiple hosts. If you have other tools or script, please leave a comment.
ping: unknown host cat.myhost.net
ping: unknown host dog.myhost.net
PING tiger.myhost.net (192.168.0.99) 56(84) bytes of data.
--- tiger.myhost.net ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 0ms
PING tiger.myhost.net (192.168.0.100) 56(84) bytes of data.
--- bird.myhost.net ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 0ms
Thanks