Académique Documents
Professionnel Documents
Culture Documents
shared storage,
This would normally be quite a bit of physical hardware to source for a test lab or demo;
however it is possible to create all of this in a nested (Running Virtual Machines inside of
other Virtual machines) virtualized set, all running on top of a normal Windows host PC.
In this article, well go through setting up a VMware lab environment, all hosted and run off one
PC. As this is a lab environment, you should note that this will in no way be tuned for
performance. To even begin tuning this for performance, you would need dedicated hypervisors,
shared storage (Fibre Channel or iSCSI SAN) and networking equipment as you would use in a
production environment.
Once we have our lab environment set up, youll be able to create VMs, use vMotion to migrate
them across your Host servers with zero downtime, as well as test VMware HA (High
Availability) and DRS (Distributed Resource Scheduler) two of the great features I mentioned
above as being some of the products strongest selling points.
Prerequisites
This is a list of what we need (and what we will be creating in terms of VMs) to satisfy our
requirements for a fully functional lab environment.
The VMs we will create and run in VMware Workstation on the Physical Host PC:
o ESXi VM #1 (Hypervisor)
o ESXi VM #2 (Hypervisor)
o Windows Server 2003 or 2008 Domain Controller
o Windows Server 2003 x64, 2008 x64, or 2008 R2 x64 vCenter server
o Shared Storage VM (I use the excellent, opensource FreeNAS)
As you can see, we do need a fairly beefy host PC as this will be running everything in our lab!
The main requirement here is that the CPU supports the necessary virtualization features and the
machine has a lot of RAM. For VMware Workstation, you could use a 30 day trial version, but a
license is not very expensive and is very useful to have for other projects. A free alternative may
be to use VMware Server 2.0, although I have not tested this myself.
Our first two VMs that we will create will have VMware ESXi 4.1 installed on them. You can
register for and download a 60 day trial of ESXi from VMwares website. The next machine we
need to create will be our Windows Server 2003 or 2008 Domain Controller, with Active
Directory and DNS Server roles installed on it. Thirdly, we need a VM to run VMware vCenter
Server. This is the server that provides unified management for all the host servers and VMs in
our environment. It also allows us to view performance metrics for all managed objects, and
allows us to automate our environment with features like DRS and HA. Lastly, we will need
shared storage that both of our ESXi hosts can see. In this lab environment we can use something
simple like FreeNAS or OpenFiler two opensource solutions that allow us to create and share
NFS or iSCSI storage. In this article we will opt for FreeNAS and will be using this to provide
NFS storage to our two ESXi hosts.
For networking, I will be using VMware Workstations option to Bridge each VMs network
adapter to the physical network (i.e. the network your physical host PC is using). Therefore all
vSphere host, management and storage networking will be on the same physical network. Note
that this is definitely not recommended in a production environment for both performance and
reliability reasons, but as this is just a lab setup, so this wont be a problem for us.
Installation
Start off by installing VMware Workstation on your host PC. Once this is running, use the New
Virtual Machine wizard to create the following VMs.
the same server with its DNS role installed, so this is set at localhost (127.0.0.1) once the
DNS role is installed
configure your ESXi host DNS names later on using the ESXi console networking
configuration.
Figure 2: Creating A records for our two ESXi hosts on the DNS Server.
2 x ESXi 4.1 Hosts. These hosts will be our workhorses they will be managed by
vCenter Server and will be the hypervisors that run our nested Virtual Machines. HA and
DRS will look after these two hosts, managing high availability of Virtual Machines if
one were to fail and distributing resources between the two based on their individual
workloads. Note that the minimum amount of RAM required for ESXi is 2 GB, but the
HA agent that needs to install on each host will be likely to fail to initialize if we dont
have at least 2.5 GB RAM per host. In a production environment, these hosts would be
physical rack-mounted servers or blade servers. Create two of these VMs using the new
custom VM wizard and give each ESXi Host the following specifications:
o 1 vCPU
o 2560 MB RAM (More if you can, as each VM that the host runs requires RAM
from the ESXis pool of RAM)
o 40 GB Hard drive (Thin provisioned)
o Networking use bridged networking
o 1 x extra vNIC (Network adapter).
o Guest operating system VMware ESX
Dont forget to add the additional NIC using Bridged mode this is so that we can
simulate management network redundancy (and therefore not get an annoying warning in
vCenter about not having this in place). It wont be true redundancy, but will at least keep
vCenter happy. Before completing the wizard, choose the Customize Hardware button
to add this extra NIC. Here is a screenshot of what your VM settings should look like,
followed by a screenshot showing the second NIC being added.
FreeNAS VM (shared storage). Now we will need to setup our shared storage which
both ESXi hosts need to have access to in order to use clustering capabilities such as HA
and
DRS.
You can follow this guide to download a preconfigured VM for VMware Workstation and
get everything you need for your NFS shares setup. It also has a section near the end that
demonstrates adding the shared storage to each ESXi host. When you download the
FreeNAS VM as explained in this guide, youll just need to use VMware Workstation to
open the .vmx file that comes with the download to get going.
vCenter VM. This VM requires a 64-bit Windows Server 2003 or 2008 / R2 Guest
operating system. So get a VM setup with one of these, and add it to your Windows
domain. Once you are ready to begin, register for and download the vSphere vCenter
Server software from VMware if in ISO format, just attach this to your VM, by going
into your VMs settings in Workstation and connecting it. Start the installer and again, we
will be following through with all the default options as this is just a lab setup. To begin
with just ensure you select the Create a standalone server instance for vCenter
installation. You will get to the Database section in the setup soon choose the default of
a SQL Server Express instance for the database. This is fine for smaller deployments of
ESX/ESXi hosts and vCenter. Larger production environments would usually go for a
SQL Server Standard or Enterprise or Oracle DB setup and specify a dedicated database
server at this stage. Complete the setup and restart the VM afterwards.
o 1 vCPU
o 2 GB RAM
o 40 GB Hard drive (Thin provisioned)
o Guest operating system choose the appropriate Windows OS here.
Individual ESXi host configurations. Now we need to configure each ESXi host using
the vSphere client from our host PC. We need to get them to match each other identically
in terms of setup so that HA and DRS work well between the two host servers. In a
production environment you should be using a feature called Host profiles to establish
a baseline host profile, and would then be able to easily provision host servers off of that
profile. (Feature available in vCenter Enterprise Plus only). However we only have two
hosts
to
do
here,
so
well
configure
them
manually.
Open a web browser on your local PC, and browse to the IP address of one of your ESXi
hosts using the prefix of https://. Youll get to a banner page, which should offer you a
download of the vSphere client for Windows. Download and install this on your local
host PC. Run the vSphere client and login to your first ESXi host using the root
credentials you configured earlier accept the security certificate warning you get when
you click Login.
Figure 6: Specify the IP address of the ESXi host you are connecting to and login.
Once the management GUI appears, well be able to start configuring the ESXi host, by
adding our shared storage first. Navigate to the Storage Configuration area for your host
and click the Add Storage... link near the top right of the GUI.
Click Next, review the summary page to ensure you are happy, then finish the wizard to
complete adding your Shared Storage. Remember to keep the Datastore Names the same
across all your ESXi hosts for consistency. Under Datastores in the vSphere client, you
should now be able to see your shared storage and the host server will now be able to use
this to access and run VMs from.
Figure 8: datastore1 refers to the ESXi's local storage. SharedDatastore1 is our shared
storage which we'll be using.
Next, well do the network configuration. Start by clicking Networking under the
Configuration area in the vSphere client. Click on Properties for vSwitch0 and well
get our second NIC added and configured for standby mode. A vSwitch in VMware is a
virtual switch try to think of it as a logical switch as it is not much different to the
real thing!
Figure 9: Open the vSwitch0 Properties to start configuring your host's networking.
Click the Network Adapters tab then select the Add button. A page will appear which
should list your unclaimed virtual network adapter with the name vmnic1. (vmnic0 is
already being used as our active NIC). Tick this adapter (vmnic1), and then click Next.
Finally, click OK and then Close to complete our networking configuration for the ESXi
host. Here is a summary of our vSwitch0 Virtual Switch configuration:
Another way of configuring your network adapters for vSwitch0, as Duncan Epping
recommends would be to set both adapters as Active on your vSwitch0 (provided your
physical switch allows you to). In our case it does, because we are bridging the network
adapters to our physical network via our host physical PC network connection. (i.e. VMware
Workstation is essentially our physical switch). This configuration would then enable us to use
both NICs for the types of traffic we have defined on our vSwitch instead of just one handling
active traffic and one sitting in standby mode. This configuration still maintains network
redundancy you can test this by running a VM on one of the hosts with two adapters in
Active mode, setting the guest operating system in the VM to ping a location inside or outside
your network, then removing one of the active NICs from your vSwitch0 you shouldnt see any
dropped packets.
To set one of your Standby NICs back to an Active NIC, configure your vSwitch0 as per this
screenshot, using the NIC Teaming tab:
Ensure that all your lab VMs are powered up i.e. DC, FreeNAS, two ESXi hosts and vCenter
(in that order too). Use your vSphere Client to connect to your vCenter server by IP or hostname.
You can use your domain administrator account to login with, although best practise is of course
to create normal domain users in Active Directory to use for vCenter administration. Accept the
message stating you have 60 days left of your trial, and you should land on a welcome /
summary area of the GUI when the log in is complete.
Before we can add any objects to the vCenter Server inventory, we need to create a datacenter
object. This is for all intents and purposes, a container object, and can often be thought of as the
root of your vCenter environment. The items visible within the datacenter object will depend
on which Inventory view you have selected in the vSphere client. For example, Hosts and
Clusters will show your Cluster objects, ESX/ESXi hosts and VMs under the datacenter object.
Click on Create a datacenter under Basic Tasks to define yourself a datacenter object and call it
anything you like. I named mine Lab-datacenter. .
Next up, well want to create a cluster object for our ESXi hosts to be a part of. A cluster is a
group of hosts (ESX or ESXi host servers) that are used for collective resource management.
Well use this cluster to setup DRS and HA for our hosts as these features can only be enabled on
clusters. Right-click on your datacenter object and choose the option for New Cluster.
Figure 17: Add your ESXi hosts to the cluster by hostname (the FQDN). This is also a good test
that your DNS is setup correctly.
Figure 18: vCenter configuring various agents on the host once added to the cluster.
So here is the fun part get a few VMs up and running on your cluster. Right-click on one of
your hosts and select New Virtual Machine, use the wizard to create a few VMs with different
operating systems. I created another FreeNAS VM using my ISO I had already downloaded just
to play around with. If you start it up on your first ESXi host, then while it is running, open a
console (right-click -> open console on the VM), and then try migrating it between ESXi hosts.
You can accomplish this by right-clicking the VM, selecting Migrate then completing the
migration wizard, by choosing your second host as the target to migrate to.
Upon completing the wizard, your VM will live migrate (using vMotion) to your second host all
the while continuing to stay powered up and running whatever services has and applications are
active upon it. As a fun test, why not set your guest Operating System in your test VM to ping a
device on your outside network for example a router or switch, or another PC on your network.
While it is pinging this device, get it to migrate between hosts and see if you get any dropped
packets. The worst I have seen is a slightly higher latency on one of the ICMP responses (and
bear in mind this is on a low-performance lab setup!)
You now have everything you need to test out some of the great features of vSphere and vCenter
Server, all hosted from one physical PC / server! Create some more VMs, run some services /
torture tests in the guest operating systems and watch how DRS handles your hosts and available
resources. Do some reading and try out some of the other features that vSphere offers. You have
60 days to run your vCenter trial so make good use of it! If you ever need to try it out again after
your trial expires, youll need a new vCenter server and trial license just follow this guide
again keeping everything in Virtual Machines makes setup and provisioning a breeze and you
can keep your entire vSphere lab on just one PC, laptop or server.