Configuring iSCSI with ESXCLI in vSphere 5.0

This is mostly me learning my way around some of the new namespaces in esxcli as part of vSphere 5.0

If you want to know what’s new in esxcli in vSphere 5.0, please read these two posts from Duncan Epping and William Lam.

I wanted to see what needed to be done to configure a load balanced iSCSI connection with two VMkernel portgroups.

So here goes; All done against just a standard vSwitch.

Enable software iSCSI on the ESXi host
~ # esxcli iscsi software set --enabled=true

Add a portgroup to my standard vswitch for iSCSI #1
~ # esxcli network vswitch standard portgroup add -p iSCSI-1 -v vSwitch0

Now add a vmkernel nic (vmk1) to my portgroup
~ # esxcli network ip interface add -i vmk1 -p iSCSI-1

Repeat for iSCSI #2
~ # esxcli network vswitch standard portgroup add -p iSCSI-2 -v vSwitch0
~ # esxcli network ip interface add -i vmk2 -p iSCSI-2

Set the VLAN for both my iSCSI VMkernel port groups - in my case VLAN 140
~ # esxcli network vswitch standard portgroup set -p iSCSI-1 -v 140
~ # esxcli network vswitch standard portgroup set -p iSCSI-2 -v 140

Set the static IP addresses on both VMkernel NICs as part of the iSCSI network 
~ # esxcli network ip interface ipv4 set -i vmk1 -I 10.190.201.62 -N 255.255.255.0 -t static
~ # esxcli network ip interface ipv4 set -i vmk2 -I 10.190.201.63 -N 255.255.255.0 -t static

Set manual override fail-over policy so each iSCSI VMkernel portgroup had one active physical vmnic
~ # esxcli network vswitch standard portgroup policy failover set -p iSCSI-1 -a vmnic0
~ # esxcli network vswitch standard portgroup policy failover set -p iSCSI-2 -a vmnic3

Bond each of the VMkernel NICs to the software iSCSI HBA
~ # esxcli iscsi networkportal add -A vmhba33 -n vmk1
~ # esxcli iscsi networkportal add -A vmhba33 -n vmk2

Add the IP address of your iSCSI array or SAN as a dynamic discovery sendtarget
~ # esxcli iscsi adapter discovery sendtarget add -A vmhba33 -a 10.190.201.102

Re-scan your software iSCSI hba to discover volumes and VMFS datastores
~ # esxcli storage core adapter rescan --adapter vmhba33
About these ads
This entry was posted in ESXi, VMware vSphere and tagged , , , , . Bookmark the permalink.

6 Responses to Configuring iSCSI with ESXCLI in vSphere 5.0

  1. Magnus says:

    Nice overview. I run into a problems though with:
    esxcli iscsi networkportal add -A vmhba38 -n vmk2
    esxcli iscsi networkportal add -A vmhba40 -n vmk3

    I get the following error “Unable to bind iscsi port. [force = 0]. I have made sure to set only one active adapter per vmknic but I still get the error.

    Any ideas?

    My config:
    vmhba38
    Adapter: vmhba38
    Vmknic: vmk3
    MAC Address: 18:03:73:f2:3f:31
    MAC Address Valid: true
    IPv4: 192.168.3.33
    IPv4 Subnet Mask: 255.255.255.0
    IPv6:
    MTU: 1500
    Vlan Supported: true
    Vlan ID: 0
    Reserved Ports: 63488~65536
    TOE: false
    TSO: true
    TCP Checksum: false
    Link Up: true
    Current Speed: 1000
    Rx Packets: 424162
    Tx Packets: 343967
    NIC Driver: bnx2
    NIC Driver Version: 2.0.15g.v50.11-5vmw
    NIC Firmware Version: 6.2.12 bc 5.2.3 NCSI 2.0.1
    Compliant Status: compliant
    NonCompliant Message:
    NonCompliant Remedy:
    Vswitch: vSwitch0
    PortGroup: ISCSI2
    VswitchUuid:
    PortGroupKey:
    PortKey:
    Duplex:
    Path Status: active

    vmhba40
    Adapter: vmhba40
    Vmknic: vmk2
    MAC Address: 00:10:18:aa:66:8e
    MAC Address Valid: true
    IPv4: 192.168.3.32
    IPv4 Subnet Mask: 255.255.255.0
    IPv6:
    MTU: 1500
    Vlan Supported: true
    Vlan ID: 0
    Reserved Ports: 63488~65536
    TOE: false
    TSO: true
    TCP Checksum: false
    Link Up: true
    Current Speed: 1000
    Rx Packets: 407261841
    Tx Packets: 363701943
    NIC Driver: bnx2
    NIC Driver Version: 2.0.15g.v50.11-5vmw
    NIC Firmware Version: 6.2.12 bc 5.2.3
    Compliant Status: compliant
    NonCompliant Message:
    NonCompliant Remedy:
    Vswitch: vSwitch0
    PortGroup: ISCSI1
    VswitchUuid:
    PortGroupKey:
    PortKey:
    Duplex:
    Path Status: active

    • Barrie says:

      I am binding two vmkernel nics to one software iSCSI adapter.

      You look as if you are using two hardware iSCSI HBAs (vmhba38 and vmhba40)?

      I believe this uses a different command in the iscsi namespace

      esxcli iscsi physicalnetworkportal

  2. Magnus says:

    Ah, I see. Will test it out tomorrow (1 am now). I use two physical NICs.

  3. Magnus says:

    Looks like I missunderstood the setup a bit with 2 physical NICs. There is no need for the above step in my config since I get two paths on vmhba level instead of on “controller/vmk” level:
    vmhba38:C0:T0:L0
    vmhba40:C0:T0:L0

    Pic:
    http://imageshack.us/photo/my-images/840/iscsiconf.png/

  4. daz says:

    On the same vswitch config set one NIC as ‘Active’ and the other as ‘Unused’ (assuming 2 Uplinks)

  5. Dan says:

    As I found out whilst stumbling through the esxcli commands on vSphere 5 being different to 4.1 – you can actually do the binding through the GUI by right clicking on the software iSCSI adapter (in my case vmhba37) and click properties. Then go to the network configuration tab. For a small number of hosts I find it quicker than the command line.

Comments are closed.