Validating free IP’s on a non-routable subnet

In conjunction with my previous post about IP conflicts, I thought I should share a script I created.

When you are talking about the networking subnet that your VM’s live on, or the management subnet of your hosts, you can generally ping these from any number of tools that you may install on your laptop. What about your vMotion or iSCSI/NFS subnets that don’t usually allow outside traffic?

While most VMware administrators have heard of VMKping to test these subnets, it has a number of limitations. It’s really only useful for checking a few IP addresses at a time, and it can only be used from the CLI. Sometimes work policies or permissions don’t let you enable SSH or the DCUI for your hosts.

What we can do, is use PowerCLI to emulate the behaviour of VMKping by connecting remotely to an ESXi host and running the Get-EsxCli command to ping an address. Now I do need to point out that the Get-EsxCli command has a 10-second timeout, so if you have a subnet with lots of free IP’s, it can take up to 15 minutes to check every IP in the subnet. At least you don’t have to do it manually!

The following script lets you define the ESXi host to use for the work, plus the start and stop addresses of the subnet to check. You can find it on GitLab.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.