Skip to content

Instantly share code, notes, and snippets.

@phyoewaipaing
Created November 11, 2023 02:08
Show Gist options
  • Save phyoewaipaing/4dcb3b9a25acf7d53ec3c9a3abdcd7ad to your computer and use it in GitHub Desktop.
Save phyoewaipaing/4dcb3b9a25acf7d53ec3c9a3abdcd7ad to your computer and use it in GitHub Desktop.
Scan IP Addresses through VMK Adapter
#!/bin/bash
## This script will ping IP addresses in a sequential order by using the vmk in the esxi host ##
# Define the range of IP addresses
START_IP=201
END_IP=210
# Define the first three octets
BASE_IP="192.168.218"
# Interface name
NetworkStackName="vmotion"
# Loop through the IP addresses
for i in $(seq $START_IP $END_IP); do
IP="$BASE_IP.$i"
vmkping -S $NetworkStackName -W1 -c2 $IP &> /dev/null
if [ $? -eq 0 ]; then
echo "$IP is reachable"
else
echo "$IP is not reachable"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment