This post won't explain NPIV as a standard and how it works. But we will see VMware implementation for this technology. Its more or less similar to the implementation in Cisco UCS & HP FlexConnect.
NPIV is a technology used to allow multiple WWNs to register with SAN Fabric through single HBA and claim multiple FCIDs.
In vSphere environment, NPIV can be enabled per VM. Each VM will have vHBA which will have WWNN/WWPN unique. Therefore multiple VMs each with vHBA can register with SAN Fabric through single host HBA. This is the concept of NPIV.
WWNs are assigned to VMs once you enable NPIV even if the VM is off. You can see those WWNs in VM vmx file.
wwn.node = "2807000c29000001"
wwn.port = "2807000c29000002"
wwn.type = "vc"
wwn.enabled = "TRUE"
However, vHBAs will be created only once the VM is powered-on. They are called VPORTs and will own the WWNs of the VM. Once the VM is powered-off, the VPORT will be destroyed.
So what's the advantage of NPIV?
Since each VM has its vHBA with unique WWNs, VMs can connect directly to SAN using vHBAs bypassing VMFS layer. Zoning/Masking in SAN Fabric should be done based in vHBAs WWNs.
Also, very important to note that the type of disks to be added to VMs should be RDMs since we are bypassing VMFS layer. You can still add VMDK disks but those won't be taking the advantage of NPIV.
In this case why we need NPIV? Why not to use RDM disks directly without NPIV?
The advantage of NPIV is having Granular Control. Without NPIV, zoning/masking in SAN fabric is done based on host's HBA WWN. This means that all VMs hosted on top of this host will have visibility to all LUNs as RDM disks which is let's say less secured especially in multitenant environment.
With NPIV, you are extending SAN zoning to the VMs which one step beyond to control LUNs presence. You can present LUN-A to VM-A which won't be visible by VM-B when trying to add RDM disk. This is using VM-A WWNs.
Limitations & Requirements
1. Host HBAs and FC Fabric should support NPIV
2. NPIV supports vMotion and will retain same WWNs. If destination host doesn't support NPIV, physical HBA WWN will be used to connect VM to LUN (assuming proper zoning is done).
3. NPIV doesn't support Storage vMotion
4. Cloning a VM with NPIV enabled doesn't retain WWNs.
How to Configure?
1. Edit Settings of your VM
2. Navigate to Options Tab > Advanced > Fiber Channel NPIV.
3. Enable NPIV as below snapshot. NPIV can be enabled only for powered-off VMs.