Skip to main content
Pure Technical Services

How-To: Configure Windows host to connect via 2 separate VLANs to the same array using PowerShell

Currently viewing public documentation. Please login to access the full scope of documentation.

Problem

In some iSCSI based environments, it may be preferred to implement the connectivity between Windows hosts and a Pure Storage FlashArray over 2 VLANs in order to provide another reliability layer (configuration changes on the VLAN) or for security compliance.

In this type of environment, issues may arise if they want to specify the connections "Initiator IP" and "Target Portal IP" via the iSCSI client GUI on Microsoft Windows Server 2012R2, 2016, and 2019.

In these versions, the GUI only offers on the Target Portal IP the targets reported by the first portal in the list.

It has also been noted that the Windows iSCSI Configuration UI may not present both of the Target Portals for an undetermined reason. This issue may be remediated using PowerShell.

Impact

The configuration process for iSCSI connectivity to the array can be impacted.

Solution

Using PowerShell it is possible to create the connectivity specifying any of the available initiator IPs and target portal IPs to obtain the granularity of connectivity intended.

An example in PowerShell that shows two Windows Server NICs connected to two VLANs, that will connect to four iSCSI targets on the array, two each on a separate VLAN.

# Define the variable IP addresses
# Windows server NIC iSCSI IPs
$nic1 = "192.168.1.1"
$nic2 = "192.168.2.1"
# Pure Array iSCSI port IPs
$target1 = "192.168.3.1"
$target2 = "192.168.3.2"
$target3 = "192.168.4.1"
$target4 = "192.168.4.2"
# Create the iSCSI Target portals
New-IscsiTargetPortal -InitiatorPortalAddress $nic1 -TargetPortalAddress $target1 -InitiatorInstanceName "ROOT\ISCSIPRT\0000_0"
New-IscsiTargetPortal -InitiatorPortalAddress $nic2 -TargetPortalAddress $target3 -InitiatorInstanceName "ROOT\ISCSIPRT\0000_0"
# Pause for portal creation completion
Start-sleep -seconds 2
$targetnames = Get-IscsiTarget
$targetname = $targetnames[0] 
# Connect the targets 1-4 for NIC 1 and 1-4 for NIC 2
Connect-IscsiTarget -InitiatorPortalAddress $nic1 -TargetPortalAddress $target1 -IsMultipathEnabled $true -NodeAddress $target.NodeAddress -IsPersistent $true
Connect-IscsiTarget -InitiatorPortalAddress $nic1 -TargetPortalAddress $target2 -IsMultipathEnabled $true -NodeAddress $target.NodeAddress -IsPersistent $true
Connect-IscsiTarget -InitiatorPortalAddress $nic1 -TargetPortalAddress $target3 -IsMultipathEnabled $true -NodeAddress $target.NodeAddress -IsPersistent $true
Connect-IscsiTarget -InitiatorPortalAddress $nic1 -TargetPortalAddress $target4 -IsMultipathEnabled $true -NodeAddress $target.NodeAddress -IsPersistent $true
Connect-IscsiTarget -InitiatorPortalAddress $nic2 -TargetPortalAddress $target1 -IsMultipathEnabled $true -NodeAddress $target.NodeAddress -IsPersistent $true
Connect-IscsiTarget -InitiatorPortalAddress $nic2 -TargetPortalAddress $target2 -IsMultipathEnabled $true -NodeAddress $target.NodeAddress -IsPersistent $true
Connect-IscsiTarget -InitiatorPortalAddress $nic2 -TargetPortalAddress $target3 -IsMultipathEnabled $true -NodeAddress $target.NodeAddress -IsPersistent $true
Connect-IscsiTarget -InitiatorPortalAddress $nic2 -TargetPortalAddress $target4 -IsMultipathEnabled $true -NodeAddress $target.NodeAddress -IsPersistent $true