Configuring NFS networking for a nested ESXi VM

I have just begun planning and building a lab for my ESXi / vSphere environment so that I can do a upgrade of our vSphere environment (more to come on this process), but I got stuck with an issue for NFS storage. The issue was that I could not mount the datastores on the nested ESXi host, I was not able to find any clear information quickly on the web, so I decided to do a “settings” process here.

A brief background of the environment:

  • Networking: Cisco 3850, with Trunk VLAN configured.
  • Storage: NetApp cDOT with NFS volumes
  • ESXi Version: 6.0U3

The important changes are in bold below and the reasoning is VERY well outlined in this “ancient”, yet 100% valid post by William Lam: Why is Promiscuous Mode Forged?

Continue reading Configuring NFS networking for a nested ESXi VM

Clone Datastores from one ESXi host to Another

As we I progress with our server refresh and I continue to build our global virtualised infrastructure, I am constantly trying to make things easier for my less experienced colleagues and so that there will be consistency in what we do. One of the most tedious tasks must be NFS datastore creation. While we could script this out and create each datastore individually, I figured I would try find a way clone the datastore configuration from one host to another. This way you simply execute the script and let it run along, giving you time for other cool stuff.

This little script will save you hours, especially if you have hundreds of datastores and hosts.

Script 1: This is for host to host clone only

$Source_Host = Read-Host "Enter The Source Host"
$Destination_Host = Read-Host "Enter the Destination Host"
$Source_Root_Password = Read-Host "Enter Root Password for Source Host"
$Destination_Root_Password = Read-Host "Enter Root Password for Destination Host"
Connect-VIServer -Server $Source_Host -User root -Password $Source_Root_Password
Connect-VIServer -Server $Destination_Host -User root -Password $Destination_Root_Password
foreach (
			$datastore in (Get-VMhost $Source_Host | Get-Datastore | where {$_.Type -eq "nfs" -and $_.Accessible -eq "true"})
		)
		{
			New-Datastore -VMhost $Destination_Host -Nfs -Name $datastore.Name -Path $datastore.RemotePath -NfsHost $datastore.RemoteHost
		}
Disconnect-Viserver * -Confirm:$false

Script 2: This for host to Cluster wide .

$Source_Host = Read-Host "Enter The Source Host"
$Destination_vCenter = Read-Host "Enter the vCenter you want to connect to"
$Cluster = Read-Host "Enter the name of the Cluster to connect to"
$Source_Root_Password = Read-Host "Enter Root Password for Source Host"
Connect-VIServer -server $Source_Host -user root -password $Source_Root_Password 
Connect-VIServer -server $Destination_vCenter
foreach (
			$datastore in (Get-VMhost $Source_Host | Get-Datastore | where {$_.Type -eq "nfs" -and $_.Accessible -eq "true"})
		)
		{ 
			Get-Cluster "$Cluster" | Get-VMhost | New-Datastore -Nfs -Name $datastore.Name -Path $datastore.RemotePath -NfsHost $datastore.RemoteHost
		}
Disconnect-Viserver * -Confirm:$false

Copy the above text in to a text document and save it as a ps1 (powershell) file and run it using PowerCLI.