VmWare/Setup iSCSI
Contents |
Pre-requisites
Setup done using:
- ESXi host 6.7.0 (13006603)
- TrueNas-12.0-U8.1
ESXi setup
vSwitches
Have (2) vSwitches
(1) vSwitch should be connected to a physical adapter with a real IP address that is resolvable on your network. (ie. management vmknic)
(1) vSwitch should be not be connected to any physical adapters (intranet).
Port Groups
You'll need to create (2) port groups, one for the vmknic we will create next and one for the virtual machines. They cannot share the same port group, once the vmknic is assigned to the port group, it will not be visible to the vms and vice versa.
Create port group #1, named Intranet and associated with the vIntranet0 vSwitch you just created. This will be for the virtual machines.
Create port group #2, named Intranet vmk1 and associated with the vIntranet vSwitch you just created. This will be exclusively for the vmknic.
VMkernel NIC
Create a new VMkernel NIC and select the intranet vmk1 vSwitch as its Port group. Define a static IP address such as:
IP Address: 192.168.0.5 Subnet: 255.255.255.0
TrueNAS setup
Configure NICs
Have (2) physical NICs (vmknics) associated with the VM.
(1) vmknic should be connected to to the vSwitch providing it with a resolvable ip address.
(1) vmknic should be connected to the intranet vSwitch
For the second vmknic (intranet), give it a static internal address such as:
IP Address: 192.168.0.15/24
Note: Make sure to also configure the first vmknic to DHCP, TrueNAS doesnt retain the existing configuration automatically.
Add Zvol to existing pool
on the (3) dots for the pool, from the drop down select `Add Zvol`.
give it a name such as: truenas02.pool02
Specify a size for the pool, do not assign more than 75% of the pool size. (ie. 7.5TB for a 10TB pool)
Use defaults for:
Sync: Inherit (standard) Compression level: Inherit (lz4) ZFS Deduplication: Inherit (off)
Create iSCSI
Under sharing select iSCSI and use the wizard.
Step 1: Create or choose block device Name: truenas02.pool02 Extent Type: Device Device: pool02/truenas02.pool02 Sharing Platform: VMWare
Step 2: Portal Portal: Create New IP Address: 192.168.0.15 Port: 3260
Step 3: Initiators Leave blank.
Confirm the changes and then save. the Save should prompt you to enable the iSCSI service, if it does not, go to Services set it to Running and Start Automatically
ESXi iSCSI Config
From the iSCSI config on truenas, get the Target global configuration base name, in my case it is iqn.2005-10.org.freenas.ctl
From the iSCSI config on truenas, get the Target Name, in my case it is truenas02.pool02
From the Network config on truenas, get the Network IP address you defined earlier, in my case it is 192.168.0.15
on the ESXi webinterface, Go to storage > adapters > select Software iSCSI. Toggle the radio button to Enabled and allow it to load the configuration screen.
Network Port Binding > Do not add a port binding. ESXi requires a physical nic be associated with your vmknic in order to setup port binding. It is not needed for this setup, so skip.
Add a Static target, for the target use "target global configuration base name"."Target Name". in my case it is iqn.2005-10.org.freenas.ctl:truenas02.pool02. For the Address, add the network config we added in truenas, in my base it is 192.168.0.15
For dynamic target, add the same ip address from truenas, in my case it is 192.168.0.15
After saving the above, under Storage > Adapters, select the option to rescan.
Now create a new datastore and hopefully you will see the new iSCSI disk ready to be setup with a vmfs partition.