LEARN – Testing multiple non-routable IPs using VMKping

LEARN – Testing multiple non-routable IPs using VMKping
October 22, 2021 No Comments ESXi,Uncategorized,VMware neudorfer

An issue I’ve run into multiple times is duplicate IP addresses on VMKernals. This becomes a bigger issue when the IP address that is taken is from a Filer that also hosts other storage. When you have two devices fighting over traffic like that it can take down the device. To mitigate that issue we’ve included steps in our change control process to check every IP you plan on using on a VMKernel before you use it. This can get tedious if you have multiple new hosts you need to check IPs for. 

I’m sure this may have been obvious for any experienced Linux user but I had to go out and discover it for myself. You wrap a vmkping command, which is used to ping over a specified vmkernel (vmk3 in this example), in a for loop. This example will ping the IP range x.x.x.1 through x.x.x.255. You’ll need to change VMK3 to the name of your vmkernel and x.x.x will need to be changed to the first three octets of your network.

for ip in $(seq 1 255); do vmkping -c 1 -I vmk3 x.x.x.$ip; done

This will output. 


You can see I initiated a ping to – 255 over vmk3 using -c to only ping once. shows 100% packet loss because there isn’t a response on the IP so it would be available for use. 0% packet loss means there IS a host on that IP already, so not available for use.


Ideally your environment has IPAM or host/IP monitoring to help you mitigate any issues like this but there is always have a chance the info there is incorrect. Pinging directly from a host will give you total confidence that the IP is available or not. This is especially important if you don’t want to break anything.

About The Author