扬州新安威网络科技有限公司

ESXi不使用kernal IP来和iSCSI通信

最近准备优化客户的iSCSI,但发现新建的kernal不主动和iSCSI通信,通过日志发现还是使用管理地址通信,当尝试把管理地址从iSCSI的允许列表中移除掉后,日志发现管理地址被拒绝了,且没有kernal的任何信息。
尝试使用esxcli swiscsi nic add –n vmk0 –d vmhba33来绑定却报了下面的错。
~ # esxcli swiscsi nic add -n vmk1 -d vmhba33
Errors:
Failed to add nic.
~ # esxcfg-vswitch -l
Switch Name      Num Ports   Used Ports  Configured Ports  MTU     Uplinks
vSwitch0         128         4           128               1500    vmnic0,vmnic1

PortGroup Name        VLAN ID  Used Ports  Uplinks
Management Network    0        1           vmnic0,vmnic1

DVS Name         Num Ports   Used Ports  Configured Ports  MTU     Uplinks
vSwitch          256         7           256               1500    vmnic9,vmnic8,vmnic7,vmnic6

DVPort ID           In Use      Client
333                 1           vmnic6
334                 1           vmnic7
335                 1           vmnic8
336                 1           vmnic9
33                  1           vmk1
271                 1           vmk2

VMware的解决方案如下

iSCSI Port Binding fails with the error: Add NIC failed in IMA

Details

  • Trying to bind a VMkernel port to the software iSCSI initiator using this command fails:esxcli swiscsi nic add -n vmk0 -d vmhba32
  • You see the errors:Add NIC failed in IMA.orFailed to add NIC

Note: Access the VMkernel interface by running the command # esxcfg-vmknic -l.

Solution

The software iSCSI initiator (for example, vmhba32) typically has 2 VMkernel ports bound to it (for example, vmk0 & vmk1). These VMkernel ports may in turn be associated with uplinks (for example,  vmnic0 and vmnic1) on a vswitch.   If the switch has 2 uplinks (typical example), then the first vmkernel port (in this example, vmk0) must have one uplink active (in this example, vmnic0) and the other uplink unused (in this example, vmnic1). The second VMkernel port (in this example, vmk1) must have one uplink active (in this example, vmnic1) and the other uplink unused (in this example, vmnic0).   If the second NIC is not placed in unused mode, the operation fails.   To resolve this issue, ensure that the other NIC is in unused mode when doing iSCSI port binding.    To set the network card in the unused mode:

  1. Connect to vCenter Server using the vSphere Client.
  2. Click the ESX host in the vCenter Server inventory.
  3. Click the Configuration tab.
  4. Click the Networking option under Hardware.
  5. Locate the virtual switch that you use for the iSCSI port binding.
  6. Click Properties. The Properties window for the vSwitch appears.
  7. Click vSwitch and click Edit.
  8. In the window that opens, click the NIC Teaming tab and move the appropriate adapter to Unused Adapters.
  9. Click OK and CLOSE to close the vSwitch Properties windows.

Note: This issue may also occur if you provide the wrong parameter to the flag -n in the command esxcli swiscsi nic add -n vmk0 -d vmhba32. Ensure all parameters are correct.