Test Connections from an ESXi Host Using vmkpingJune 23, 2014
If you’ve been in a situation where you need to test connectivity, you’ve probably used the ping command. But what do you do when you’re trying to test connectivity from an ESXi host? Luckily there is a command called vmkping that will allow you to test from the host.
The first thing that you need to do is to SSH into your ESXi host. Turn the SSH Service on from the Configuration –> Security Profile Tab. Then you can use your favorite ssh client and remote into your host.
Once you’ve logged in, you can then issue a vmkping command with an associated IP Address.
The vmkping will attempt to use any path it can to reach the destination. Consider the following scenario. You have two VLANs that are both routed and you want to make sure that you have connectivity between two devices that are on the same VLAN. To illustrate, look at the example below which consists of an ESXi host with two interfaces, and a storage device that is presenting NFS Shares. You run vmkping to make sure that you have connectivity between the host and the storage device on the NFS Network. The example below shows you what you THINK you are testing, and is your desired result.
But, what if in this example we have a failure on the NFS network somewhere and we just run the vmkping command again?
Below, we see that the ESXi host has a network adapter link that is down. The VMkernal Port that is normally used for NFS Traffic is unable to communicate with the storage array. But, since the networks are routed, if you issued a vmkping command on this host, it might still show that there is connectivity between the two hosts. You can see that the traffic could be sent from the vmk0 port, out onto the management network, up to the router and over to the storage array on the NFS VLAN. This is probably not what you intended, but if you are just looking for a ping reply, you might not have noticed the issue on the NFS network.
Luckily, starting with vSphere 5.1, the vmkping command can also specify a VMkernal port to be used for testing with. Now, we can run the same command with an additional switch to specify how the pings should be sent out on the wire.
vmkping -I vmk1 [VIP1_IP_ADDRESS_HERE] would force the pings over the vmk1 port and would fail to reach the destination, allowing you to troubleshoot the issue correctly.
Ping is a great command and is by many as the first troubleshooting step in diagnosing a network problem. VMware ESXi has a similar command to test connections from an ESXi host as well. Be sure to use it correctly and to know your environment so that you don’t falsely read the data.