Scott's Weblog The weblog of an IT pro specializing in cloud computing, virtualization, and networking, all with an open source view

ESX iSCSI Basic Configuration from the CLI

Sometimes, I find it better/faster/easier to perform tasks from the command-line interface (CLI) than going through a GUI. So, the other day, I needed to setup a new VMware ESX Server for iSCSI storage, and thought I’d document the commands I used to set that up.

Unfortunately, the commands weren’t able to do all the configuration I needed—I couldn’t find the commands to let me set iSCSI security (CHAP username and password), and I needed iSCSI security for the target to which I was connecting. However, these commands should work just fine for a basic iSCSI configuration.

Here are the commands I used. First, to enable the software iSCSI initiator:

esxcfg-swiscsi -e  

Next, to configure the ESX Service Console firewall (iptables) to allow the traffic from the software iSCSI initiator:

esxcfg-firewall -e swISCSIClient  

Next, set the target IP address for the vmhba40 adapter (the adapter that represents the software iSCSI initiator):

vmkiscsi-tool -D -a 192.168.100.50 vmhba40  

Finally, rescan for storage devices on vmhba40:

esxcfg-rescan vmhba40  

I’m sure there are more commands available; for more information, you can refer to Mike Laverick’s excellent Guide to ESX 3 Service Console. In addition, please note that the ESX Server software iSCSI initiator is simply the open source version of an old Cisco iSCSI initiator for Linux, so you can use that command reference as well (I believe this information is also applicable). Just preface the commands from the CuddleTech article with “vmk” and it should work just as listed.

One oddity: you may find that some of the command-line tools will report a Cisco IQN, but after further configuration (and especially after configuration from VirtualCenter) it will switch to a VMware IQN. This may wreak havoc with iSCSI targets on which LUN presentation is based on IQN names, so plan accordingly.

Metadata and Navigation

Be social and share this post!