How to check IPs respond – Ping Multiple IPs
Many users have multiple IPs assigned to their Dedicated Server and KVM VPS server. On our KVM plans users can have a maximum of 64 additional IPs or on a dedicated server users can have a maximum of 250 IPs and when users have multiple IPs assigned to their servers they want a way to check that all their IPs are functioning without having to ping each individual IPs.
Ping IP Or Multiple IPs With Bash
A simple bash script can be used to ping multiple IPs. We have provided a quick script below. To use the script just copy the code to a new file on your server. This does not have to be run by the root user.
nano pingall.sh
Now, copy the below code the file.
#!/bin/bash
date
cat ping.txt | while read output
do
ping -c 1 "$output" > /dev/null
if [ $? -eq 0 ]; then
echo "IP $output is up"
else
echo "IP $output is down"
fi
done
Save and close the file. Next place all of the IPs you want to ping in a new file called ping.txt. This file should be in the same directory as the pingall.sh file.
nano ping.txt
The file will now have a list of IPs. One IP per line.
51.68.247.104
51.68.247.105
51.68.247.106
51.68.247.107
51.68.247.108
51.68.247.109
51.68.247.110
51.68.247.111
Finally, you can run the script with the below command. This will cycle through each IP in the ping.txt file returning whether the IP is up or down.
sh pingall.sh
Tue Aug 18 10:37:33 UTC 2020
IP 51.68.247.104 is up
IP 51.68.247.105 is up
IP 51.68.247.106 is up
IP 51.68.247.107 is up
IP 51.68.247.108 is down
IP 51.68.247.109 is up
IP 51.68.247.110 is up
IP 51.68.247.111 is up
Blacklist & Heartbeat Tracking
This quick script does not provide any sort of log or output other than telling you if an IP is up or down. If you want a professional way to monitor your IPs for outages, RBL blacklists with a full log of uptime and alerts via SMS and email consider using our Blacklist & Heartbeat tracking service. Every customer can order the free or paid plan from your client area. This service allows you to monitor the uptime of SolusVM nodes, custom ports or services like email, ssh or MySQL.

Further Resources
Ping an IP or multiple IPs with Fping.
How was this article?
You might also like
More from All About Linux
Install Ioncube Loaders In Ubuntu, Debian, CentOS and AlmaLinux
Ioncube Loaders are a piece of software that is used to protect the underlying code in PHP applications. Its aim …
How to install FTP and configure FTP on an Ubuntu 22 LTS instance
If you need to upload files to your NVMe VPS you have a couple of options. You can use a …
How to install a Cloudflare Origin SSL Certificate – NGINX
An SSL Certificate is vital to encrypt data between you and your clients. SSLs can be complicated things. If they …
1 Comment
[…] -s < ips.txt) to the command for full statistics. Overall fping is much more flexible than pinging multiple IPs with bash and provides for more options and […]