Friday, 15 February 2019

Windows Server 2016 Basic iSCSI Configuration with NetApp ONTAP 9.2

In this post we have:
- Windows Server 2016 box with one LAN NIC, and two iSCSI NICs
- 3 x ONTAP 9.2 vSIM cluster and each node with 2 NICs for iSCSI

The following Walkthrough uses PowerShell and ClusterShell CLI to do everything required to get 2 iSCSI LUNs mounted into 2 folders as NTFS drives in Server 2016.

Image: The end results - example with one mapped drive showing
  
Part 1) Windows Server 2016 Basic Configuration


Rename-Computer -ComputerName localhost -NewName SERVER01
Get-WindowsFeature -Name 'Multipath-IO'
Add-WindowsFeature -Name 'Multipath-IO'
Restart-Computer -ComputerName localhost

Get-NetIPAddress | Where-Object {$_.AddressFamily -eq "IPv4"}
rename-netadapter -Name "Ethernet0" -NEwName "LAN"
rename-netadapter -Name "Ethernet1" -NEwName "iSCSIA"
rename-netadapter -Name "Ethernet2" -NEwName "iSCSIB"
New-NetIPAddress -InterfaceAlias "LAN" -IPAddress "10.0.1.51" -PrefixLength 8 -DefaultGateway 10.0.0.2
New-NetIPAddress -InterfaceAlias "iSCSIA" -IPAddress "1.0.0.51" -PrefixLength 24
New-NetIPAddress -InterfaceAlias "iSCSIB" -IPAddress "2.0.0.51" -PrefixLength 24

Set-Service -Name MSiSCSI -StartupType Automatic
Start-Service -Name MSiSCSI


Note: The iSCSI initiator name should be "iqn.1991-05.com.microsoft:server01"

Part 2) ONTAP Basic Configuration

We have just created a 3 node cluster with 3 x node management IPs and a cluster IP.
Each node has 6 ports: 2 for cluster, 2 for non-SAN, 2 for SAN


license add {{NODE 1 iSCSI LICENSE}}
license add {{NODE 2 iSCSI LICENSE}}
license add {{NODE 3 iSCSI LICENSE}}

disk assign -node CLU01-01 -all true
disk assign -node CLU01-02 -all true
disk assign -node CLU01-03 -all true

aggr show
aggr rename aggr0 -newname CLU01_01_root
aggr rename aggr0_CLU01_02_0 -newname CLU01_02_root
aggr rename aggr0_CLU01_03_0 -newname CLU01_03_root

set -c off
aggr add-disks -aggr CLU01_01_root -diskcount 2
aggr add-disks -aggr CLU01_02_root -diskcount 2
aggr add-disks -aggr CLU01_03_root -diskcount 2

aggr show
vol size vol0 -vserver CLU01-01 -new-size 2G
vol size vol0 -vserver CLU01-02 -new-size 2G
vol size vol0 -vserver CLU01-03 -new-size 2G
aggr show

disk show -container-type spare -owner *1
aggr create -aggr CLU01_01_data -diskcount 23 -maxraidsize 23 -node CLU01-01
aggr create -aggr CLU01_02_data -diskcount 23 -maxraidsize 23 -node CLU01-02
aggr create -aggr CLU01_03_data -diskcount 23 -maxraidsize 23 -node CLU01-03


Part 3) ONTAP iSCSI Configuration


net port show
broadcast-domain show
broadcast-domain remove-ports -broadcast-domain Default -ports CLU01-01:e0e
broadcast-domain remove-ports -broadcast-domain Default -ports CLU01-01:e0f
broadcast-domain remove-ports -broadcast-domain Default -ports CLU01-02:e0e
broadcast-domain remove-ports -broadcast-domain Default -ports CLU01-02:e0f
broadcast-domain remove-ports -broadcast-domain Default -ports CLU01-03:e0e
broadcast-domain remove-ports -broadcast-domain Default -ports CLU01-03:e0f
broadcast-domain create -broadcast-domain iSCSI_A -mtu 1500
broadcast-domain create -broadcast-domain iSCSI_B -mtu 1500
broadcast-domain add-ports -broadcast-domain iSCSI_A -ports CLU01-01:e0e
broadcast-domain add-ports -broadcast-domain iSCSI_A -ports CLU01-02:e0e
broadcast-domain add-ports -broadcast-domain iSCSI_A -ports CLU01-03:e0e
broadcast-domain add-ports -broadcast-domain iSCSI_B -ports CLU01-01:e0f
broadcast-domain add-ports -broadcast-domain iSCSI_B -ports CLU01-02:e0f
broadcast-domain add-ports -broadcast-domain iSCSI_B -ports CLU01-03:e0f

vserver create -vserver iSCSI_SVM -rootvolume rootvol -aggregate CLU01_01_data -rootvolume-security-style unix
vserver remove-protocols -vserver iSCSI_SVM -protocols fcp,cifs,nfs,ndmp
iscsi create -vserver iSCSI_SVM
iscsi show

net int create -vserver iSCSI_SVM -lif iSCSI_SVM_mgmt -role data -data-protocol none -home-node CLU01-01 -home-port e0c -address 10.0.1.113 -netmask 255.0.0.0 -status-admin up -firewall-policy mgmt
net int create -vserver iSCSI_SVM -lif N1_iSCSI_E -role data -data-protocol iscsi -home-node CLU01-01 -home-port e0e -address 1.0.0.101 -netmask 255.255.255.0 -status-admin up -firewall-policy data
net int create -vserver iSCSI_SVM -lif N1_iSCSI_F -role data -data-protocol iscsi -home-node CLU01-01 -home-port e0f -address 2.0.0.101 -netmask 255.255.255.0 -status-admin up -firewall-policy data
net int create -vserver iSCSI_SVM -lif N2_iSCSI_E -role data -data-protocol iscsi -home-node CLU01-02 -home-port e0e -address 1.0.0.102 -netmask 255.255.255.0 -status-admin up -firewall-policy data
net int create -vserver iSCSI_SVM -lif N2_iSCSI_F -role data -data-protocol iscsi -home-node CLU01-02 -home-port e0f -address 2.0.0.102 -netmask 255.255.255.0 -status-admin up -firewall-policy data
net int create -vserver iSCSI_SVM -lif N3_iSCSI_E -role data -data-protocol iscsi -home-node CLU01-03 -home-port e0e -address 1.0.0.103 -netmask 255.255.255.0 -status-admin up -firewall-policy data
net int create -vserver iSCSI_SVM -lif N3_iSCSI_F -role data -data-protocol iscsi -home-node CLU01-03 -home-port e0f -address 2.0.0.103 -netmask 255.255.255.0 -status-admin up -firewall-policy data
net int show -vserver iSCSI_SVM
network route create -vserver iSCSI_SVM -destination 0.0.0.0/0 -gateway 10.0.0.2

security login password -vserver iSCSI_SVM -username vsadmin
security login unlock -vserver iSCSI_SVM -username vsadmin

## NOW THE LUNS X 2 (One server so we used just one node and one aggregates) ##

volume create -vserver iSCSI_SVM -volume VOL_N1_01 -aggregate CLU01_01_data -size 18G -policy default -space-guarantee none -snapshot-policy none -percent-snapshot-space 0 -autosize false
volume create -vserver iSCSI_SVM -volume VOL_N1_02 -aggregate CLU01_01_data -size 10G -policy default -space-guarantee none -snapshot-policy none -percent-snapshot-space 0 -autosize false

volume efficiency on -vserver iSCSI_SVM -volume VOL_N1_01
volume efficiency on -vserver iSCSI_SVM -volume VOL_N1_02

volume efficiency modify -vserver iSCSI_SVM -volume VOL_N1_01 -policy default
volume efficiency modify -vserver iSCSI_SVM -volume VOL_N1_02 -policy default

lun create -vserver iSCSI_SVM -volume VOL_N1_01 -lun LUN_N1_01 -size 1.8G -ostype windows_2008 -space-reserve disabled -space-allocation enabled
lun create -vserver iSCSI_SVM -volume VOL_N1_02 -lun LUN_N1_02 -size 1G -ostype windows_2008 -space-reserve disabled -space-allocation enabled

igroup create -vserver iSCSI_SVM -igroup server01 -protocol iSCSI -ostype windows -initiator iqn.1991-05.com.microsoft:server01
lun map -vserver iSCSI_SVM -volume VOL_N1_01 -lun LUN_N1_01 -igroup server01 -lun-id 1
lun map -vserver iSCSI_SVM -volume VOL_N1_02 -lun LUN_N1_02 -igroup server01 -lun-id 2


Part 4) Windows Server 2016 iSCSI LUN connection


New-IscsiTargetPortal -InitiatorPortalAddress 1.0.0.51 -TargetPortalAddress 1.0.0.101
New-IscsiTargetPortal -InitiatorPortalAddress 1.0.0.51 -TargetPortalAddress 1.0.0.102
New-IscsiTargetPortal -InitiatorPortalAddress 1.0.0.51 -TargetPortalAddress 1.0.0.103
New-IscsiTargetPortal -InitiatorPortalAddress 2.0.0.51 -TargetPortalAddress 2.0.0.101
New-IscsiTargetPortal -InitiatorPortalAddress 2.0.0.51 -TargetPortalAddress 2.0.0.102
New-IscsiTargetPortal -InitiatorPortalAddress 2.0.0.51 -TargetPortalAddress 2.0.0.103

Get-IscsiTarget | Connect-IscsiTarget -IsPersistent $True -IsMultipathEnabled $True -InitiatorPortalAddress 1.0.0.51 -TargetPortalAddress 1.0.0.101
Get-IscsiTarget | Connect-IscsiTarget -IsPersistent $True -IsMultipathEnabled $True -InitiatorPortalAddress 1.0.0.51 -TargetPortalAddress 1.0.0.102
Get-IscsiTarget | Connect-IscsiTarget -IsPersistent $True -IsMultipathEnabled $True -InitiatorPortalAddress 1.0.0.51 -TargetPortalAddress 1.0.0.103
Get-IscsiTarget | Connect-IscsiTarget -IsPersistent $True -IsMultipathEnabled $True -InitiatorPortalAddress 2.0.0.51 -TargetPortalAddress 2.0.0.101
Get-IscsiTarget | Connect-IscsiTarget -IsPersistent $True -IsMultipathEnabled $True -InitiatorPortalAddress 2.0.0.51 -TargetPortalAddress 2.0.0.102
Get-IscsiTarget | Connect-IscsiTarget -IsPersistent $True -IsMultipathEnabled $True -InitiatorPortalAddress 2.0.0.51 -TargetPortalAddress 2.0.0.103

Get-IscsiConnection

New-MSDSMSupportedHW -VendorID NETAPP -ProductId "LUN C-Mode"
Update-MPIOClaimedHW -Confirm:$false
Restart-Computer

## SORTING DISKS ##

get-disk | Where{$_.OperationalStatus -eq "Offline"} | Set-Disk -IsOffline $false
get-disk | Where{$_.FriendlyName -eq "NETAPP LUN C-Mode"} | Initialize-Disk -PartitionStyle GPT
get-disk | Where{$_.FriendlyName -eq "NETAPP LUN C-Mode"} | Foreach{$_ | New-Partition -UseMaximumSize | Format-Volume -FileSystem NTFS -NewFileSystemLabel ($_.SerialNumber)}

New-Item -Path C:\LUN001 -ItemType Directory
New-Item -Path C:\LUN002 -ItemType Directory

Get-Volume | Where{$_.FileSystemLabel -eq "wpEzy]N7gGHQ"} | Get-Partition | Where{$_.Type -eq "Basic"} | Add-PartitionAccessPath -AccessPath "C:\LUN001"
Get-Volume | Where{$_.FileSystemLabel -eq "wpEzy]N7gGHR"} | Get-Partition | Where{$_.Type -eq "Basic"} | Add-PartitionAccessPath -AccessPath "C:\LUN002"


THE END

No comments:

Post a Comment