Fixing the "HostDatastoreSystem.CreateNasDatastore" for object "ha-datastoresystem" error when setting up VMware ESXi NFS data store

If you try to add a remote NFS data store forVMware Esxi, you may encounter this error:
Call “HostDatastoreSystem.CreateNasDatastore” for object “ha-datastoresystem” on ESX “{ESX server}” failed:

This is often a firewall issue, and the very first place you should look. Browse to Configuration/Software/Security Profile and verify that the  “NFS Client” is listed under “Outgoing Connections:”

If you do not see the NFS Client entry, click “Properties” and enable it:

Now retry the connection to the NFS data store. If you still cannot connect, open a command prompt on the ESXi console and issue a “vmkping <hosthame>” command where the hostname is your NFS server.  If you receive a successful ping, your VMKernel is setup correctly.  If it returns this, you have a VMKernel problem:

# vmkping
*** vmkernel stack not configured ***

You now need to examine your Virtual Switch settings to verify the presence of a VMKernel Port.  Browse to Configuration/Hardware/Networking and examine your settings.  You should see an entry for VMKernel Port; if you do not, your configuration will look like something like this:

To fix this, click the “Properties” link in the upper right corner to examine the properties of your vSwitch0.  You will notice that there is no VMKernel listed:

Click the “Add” button and select the VMKernel connection type:

You will be taken to the first screen of a multi-step wizard.  Keep the default properties you see on the first screen of the wizard:

The second screen is IP Connection Settings. Here, select “Use the following IP settings” and enter a unique IP address and your network’s subnet mask:

Next, click the “Edit” button and enter your network’s default gateway:

You are now done with the wizard, and should see your new VMkernel. Click the “Finish” button:

You should now see VMkernal in the vSwitch0 properties:

You should also now see it in your main vSwitch0 properties:

Now retry adding your NFS store, and you should now be able to do so successfully.

A vmkping should also work now:
# vmkping
PING ( 56 data bytes
64 bytes from icmp_seq=0 ttl=64 time=0.121 ms
64 bytes from icmp_seq=1 ttl=64 time=0.153 ms
64 bytes from icmp_seq=2 ttl=64 time=0.137 ms