Note: This post attempts to provide information to those looking to build a simple, nested vSphere lab who may require some basic examples of iSCSI configuration. The examples are intended to be as simple as possible and do not include security configuration or performance tuning.
Building a nested vSphere lab is one of the best ways to gain hands-on experience in a virtual environment. Assuming you don’t want to practice on your production environment and that you don’t have access to a full hardware lab it is actually a very good alternative.
There are many guides and tutorials available that walk through a complete lab setup and configuration. You can build it within ESXi, VMware Workstation, VMware Fusion and others. The most popular lab build available is the excellent AutoLab on labguides.com. The outstanding work provided by the creators will allow you to set up your binaries in pre determined locations and then literally kick off an automated install of a complete environment. It’s incredible! Just think how much time this saves for anyone who needs a quick, fresh lab.
For beginners, however, an automated lab may not provide the greatest benefit. To get your feet wet with vSphere you really should go through the complete process and perform it manually. You haven’t really installed vCenter until you had to destroy a few databases, lost all communications because you configured a port group and locked yourself out of your own Active Directory domain. Not that it happened to me…
Your first shared storage
One of the first challenges you will encounter when attempting to build a functioning vSphere environment revolves around shared storage.
Shared storage is the basis for many of the advanced features enabled by virtualization. vMotion, HA, DRS, SvMotion cannot truly work without shared storage. So how do you accomplish this in a home lab or even on a single laptop?
There are three types of shared storage that can be used; Fibre Channel, iSCSI and NFS. The vast majority of home lab builders will not have a fibre infrastructure in their basement which forces us to consider the remaining two. Luckily, both protocols use Ethernet so it is not that hard to set up. Both iSCSI and NFS are great solutions and each have their benefits. In this post I will cover iSCSI and leave NFS for a future write-up.
iSCSI
iSCSI is an IP-based standard that uses the network infrastructure to transfer data. Because the commands that it uses are regular SCSI commands the connected computer believes its storage is directly attached when in reality it is delivered over the network. iSCSI is a SAN storage protocol since it passes blocks of data. This is different from NFS which is file storage, NAS, and viewed as a share on the network.
Many newcomers already have experience with NFS and are familiar with the export file, mounting commands and root permission issues. iSCSI is new territory for many and requires some research. But not much.
iSCSI can be set up, configured and tweaked to provide incredible performance. With the advances in Ethernet speeds the sky is truly the limit for this protocol. But that is down the road. At the moment I just want to walk people trying to set up a home lab through the very simple process of adding some iSCSI datastores.
The Minimum You Need to Know
- Initiator – Initiates a session by sending a SCSI command
- Target – Listens for Initiators’ commands and provides input/output data transfers. The Target is the one that provides one or more LUNs to the initiator.
- Naming and addressing - Each iSCSI element that uses the network has a unique and permanent iSCSI name and is assigned an address. The most common name is the IQN – iSCSI Qualified Name, which has the following format:
iqn.yyyy-mm.naming-authority:unique nameExample: iqn.2004-04.com.qnap:ts-412:iscsi.qnap02.ccb19e-The date refers to the name and month when the naming authority was established.
-The naming authority is usually represented as a reverse syntax of the Internet domain name of the naming authority.
-Unique name is any name you want to use.
Step 1 – Locate your storage.
Determine what storage will be presented to your ESXi hosts. This is one of the parts I enjoy most when setting up a home lab. Obviously I go completely nuts and attempt to use something different each time just for the hell of it. There are a number of options:
- A dedicated NAS – You may have decided to invest in a small home or office NAS. These little boxes are INCREDIBLE! I have a Qnap TS-412 at home and I love it. It can do everything.
- Build your own NAS – Solutions like FreeNas and Open Filer can provide you with as much and even more functionality as a store-bought NAS. All you need is an available PC, some hard disks and a 1gig Ethernet connection. Building your NAS is another fun experience that also happens to teach you a lot during the process.
- Build your own Virtual NAS – If you have enough power in your virtual host, be it ESXi, workstation or anything else, you can build that same NAS and run it as a VM. It will be there right next to your vCenter, Domain Controller and Database. You can even download a vApp and avoid all the setup, but why would you do that? You want to learn, right?
- Use software to create an iSCSI target. If you don’t have any of the above options then this is your solution. There are several free iSCSI targets that operate completely in software. All you need to do is install the software and point it to a specific folder. This folder can even be on the same machine where the target is installed. I will show two examples.
Step 2 - Enable and configure iSCSI.
Note: Since this is an introductory tutorial I will be creating the iSCSI targets with no advanced options and I will not be enabling security. Obviously in a production or even a corporate test environment you should always enable security options.
Example 1: iSCSI on a NAS
The Qnap TS-412 offers a quick configuration wizard for iSCSI. The wizard will create both the iSCSI target and the required LUN in a single step.
Example 2 – Software iSCSI using the free Microsoft Software iSCSI Target
The Microsoft iSCSI target can be downloaded for free here. Please note that it requires Server 2003 or 2008/R2 to install.
You will need to dedicate space on which the software will create a virtual disk. This virtual disk will be the LUN presented to the initiator.
At this point you will be asked to provide the identifier of the initiator. If using the ESXi iSCSI adapter you can copy the IQN from the configuration menu and paste it in.
After the target has been done you will need to add a Virtual Hard Disk to the target. I added another disk to my VM and will point my target at it.
Note that when choosing the location to place the VHD you will give it a name with .vhd extension.
These are the properties of the VHD that is connected to the target.
Step 3 - Connect ESXi host Initiator to iSCSI Target
Now we finally get to work with ESXi. Remember that since vSphere 5.0 the software iSCSI has to be added from the configuration > Storage Adapters menu.
After adding the adapter go to the properties of the adapter and select the “Dynamic Discovery” tab. Enter the IP of the target. If you didn’t make any changes to defaults leave the port on the usual 3260.
If all works well then ESXi will locate the target and LUN presented. You will be prompted to perform a scan of the adapters. The new target will now appear in the bottom part of the screen.
And there is my new Qnap target!
You can now proceed to create a datastore on the new target.
Well, that's it for now. I hope you found something helpful in this post, it was a good refresher for me.
If you would like to see anything else or have any questions or comments, leave a reply.