Saturday, June 30, 2012

How to Create a VMWare lab on your machine

I have seen lots of posts by newly certified VCPs to know how they can create labs for testing and to enhace the knowledge they gained after certification. Creating VM ware "labs" is an expensive thing and not every one can afford. This post of mine is to help those who don't want to spend too much but still want to have Lab where they can create/break/troubleshoot things as they want and experiment things learnt in VCP course.
I started working on VMWare esxi host when 3.0 was about to come in market and after gaining few years of experience I thought of going for certification. This was the time when esxi host 4.5 was much talked about. I would like to thank Mr. Abdullah who was instructor for delivering such good lactures. After completing my certification I wanted to do lot of experiments with HA, vMotion, FT etc. but unfortunately could not find environement. The IT consultant company for which I am working has lots of virtualisation environment but at no client site we are using vCentre. So I made up my mind to buy a new system which can support virtualisation. Boght a new system with following configurations. 

Processor - Intel Core i7 2600
M.Board  - ASUS Extreme GENE-Z
HDD - 512 gb SATA
NAS device for creating shared storage.

Here is how I created my LAB with two esxi host 4.5 and a vCenter.
-Installed win7 utltimate on 100gb partition.
-Created two primary partition of remaining disks.
-Installed VM ware workstation 8 on one partition.
-Created 3 VMs in VMware Workstation. 1 for windows 2003 with 64 bit VM and 2 for esxi VMs.
-Installed windows server 2003 64 bit on the windows machine.
-Installed esxi 4.5 on each of the other VM. Configured IP and host name for both the hosts.
-Kept documenting stuff and I advise same to you too.
-Once both the Esxi hosts were accessible from another machine LAN, created 2 windows VM in each host.
-Installed vCenter on the windows 2003 server 64 bit which was created on vmware workstation 8.
-Accessed vCenter over the network and added both the esxi host to it.
-Here is your vmware lab ready with two esxi hosts which are being managed from vCentre.

You can do as much as experimentation as you like. If you already have a machine with mother board and processor supporting VT, you can go ahead with creating above lab. If  this article of mine is helpful to you do drop your feedback. Please experiment and share your findings which might be helpful for all. Thanks for reading.

Sunday, March 4, 2012

Virtual Machine

A virtual machine is a set of hardware on which a supported guest oprating system and its applications run. The virtual machine is a set of discrete files. The virtual machine's configuration file describes the virtual machine's configuration , which includes the virtual hardware, such as CPU, memory, disk, network interface, Optical Drive and floppy drives etc. While naming virtual machine avoid use of special characters including spaces etc.

Files that make up a Virtual Machine

The table lists the files that make upa VM. Except for the log files, the name of each file starts with the VM's name . A virtual machine consists of the following files



  • Configuration file (.vmx)


  • One or more virtual disk files. The first virtual disk has files .vmdk and -flat.vmdk.


  • A file contiaining the VM's BIOS (.nvram).


  • A VM log file (.log) and a set of files used to archive old log entries (-#.log). Six of these files are maintained at any one time.


  • A swap file (.vswp).


  • A snapshot description file (.vmsd). This file is empty if the virtual machine has no snapshots.

If the virtual machine is converted to a template, a virtual machine template configuration file (.vmtx) replaces the virtual machine configuration file (.vmx).


If the virtual machine has more than on disk file, the file pair for the second disk file and later is named (VM_name>_#.vmdk and (VM_name>_#-flat.vmdk, where # is the next number in the sequence, starting with 1.


Six of the archive log files are maintained at any one time. e.g. -1.log to -6.log might exist at first. The next time an archive log file is created e.g. when the virtual machine is powered off and powered back on -2.log to -7.log are maintained (-1.log is deleted), then -3.log to -8.log and so on.


A VM can have other files e.g. if one or more snapshots were taken or if raw device mappings were added. A VM will have an additional lock file if it resides on an NFS datastore. A VM will have a change tracking file if it is backed up with the VMware data recovery appliance.


The configuration files of a VM can be displayed by going to Configuration > Datastore; right click datastore and browse. The another option to VM configuration files is by going to Configuration > Datastore > View and select 'Show All Virtual Mahine Files'


Virtual Machine Hardware


A VM uses virtual hardware. Each guest OS sees ordinary hardware devices. It does not know that these devices are virtual. All virtual machines have uniform hardware (except for a few variations that the system Administrator can apply). Uniform hardware makes virtual machines portable across VMware virtualization platforms. We can add and configure VM's CPU, Memory, HDD, CD/DVD, Floppy, SCSI devices etc. But we can't add video devices, but can configure existing video devices. A USB connected to physical host can be made available to one VM at a time. To make it available to another VM it should first be disconnected from existing VM.



CPU and Memory: VMware Virtual SMP allows you to take advantage of configuring a VM with upto 8 vCPU and Memory upto 255 gb.


Virtual Disk: The VM should have atleast one virtual disk. Adding the first virtual disk implicitly adds a virtual SCSI adapter for it to be connected. The ESX/ESXi host offers a choice of adapters: BusLogic Parallel, LSI Login Parallel, LSUI Logic SAS, and VMware Paravirtual. The VM creation wizrd in the vSphere client selects the type of virtual SCSI adapter, based on the choice of guest OS. By default Virtual disk is thick provisioned but this can be changed to thin-provisioned disk if needed. There is special disk mode call independent. The independent mode has two options: persistent and non-persistnet. If we want changes to disk written immediately and permanently then persistent is chosen. Non-persistnent option is chosen to discard changes when the VM is powered off or reverted to a snapshot. In most cases there is no need to change the disk mode for virtual disks.


vNetwork Interface Card: The network cards available for Virtual machine are Flexible (vlance & vmxnet), e100, vmxnet2 (enhanced vmxnet) and vmxnet3.


Other Devices: A VM can have CD/DVD drive or Floppy drive on the physical host. The CD-ROM, DVD drives either connect to physical drive or to an ISO file. We can also add generic SCSI devices, such as tape libraries to VM. These devices can be connected to the virtual SCSI adapters on a VM.


Virtual Machine Console: From console we can send power changes to a VM. The VM's guest OS can be accessed from it. The Ctr+Alt+Del is sent from console. If VM tolls are not installed then to release pointer VM's Console Ctr+Alt.

Saturday, March 3, 2012

Networking

Before we go for understaning vNetwork and vSwitch, let us understand the importance of vmware ESX/ESXi Network. The networking feature in the ESX/ESXi host allow virtual machines to communicate with each other as well as VMs on other host, IP based storage and physical machines. This means it is as good as configuring a physical network but the difference is that we don't have to deal with lots of networking cables. If the network is not configured properly it become difficult to manage VMs, IP storage etc.

In VMware ESX/ESXi network there are two important components to be understood; 1) vNetwork and 2) vSwitch.

Virtual Network provides networking for VMWare ESX/ESXi hosts and VMs. The fundamental component of a vNetwork is vSwitch.

Virtual Switch

-It directs network traffic between virtual machines and links to external networks. All network communications handled by a host passes through one or more virtual switches. A virtual switch provides connections for virtual machines to communicate with one another, whether they are on the same host or on a different host. A virtual switch allows connections for the management network on ESXi hosts and for the service console on the ESX host.

-We use vSwitch to combine the bandwidth of multiple network adapters and balances traffic among them. It can also handle physical network interface card (NIC) failover.

-Models a physical Ethernet switch e.g. VM's NIC can connet to a port and each uplink adapter uses one port.

-Virtual switches work at layer 2 of the OSI model. You can't have two virtual switches mapped to the same NIC but you can have two or more NICs mapped to the same virtual switch.

-When two or more virtual machines are connected to the same virtual switch, network traffic among them is routed locally. If an uplink adapter is attached to the virtual switch, eacj VM can access the external network that the adapter is connected to.

Let us now understand virtual switch in more details for ESXi hosts only.

Uplink Ports: Its number of Physical adapters (NIC) available.

Port Groups: A vSwitch can be subdivided into smaller units called port groups. There are three typs of port groups and each port group is related to different type of traffic: a) Virtual machines Port Group; b)Service Console port group (only ESX); c)VMKernel port group (used for vMotion, FT, IP Storage etc.)

A virtual switch provides three types of conection types to hosts and VMs.



  • Connecting VMs to the phycial netork.


  • Connecting VMkernel to physical network. VMkernel services include aces to IP storage, such as NFS or iSCSI, vMotion, access to the managment network on ESXi host.


  • Providing networking for the service console for ESX only.

Separate IP stacks are configured for each VMkernel port and the ESXi management netork port . Each ESXi management network port and each VMkernel port must be configured with tis own IP address, netwmask and gateway. All three port groups connect to outside world through physical adaptors assigned to the vSwitch. We can place all networks on a single vSwitch or multiple vSwitches can be opted which depends upon the situation.


There are two types of vSwitches; vNetwork Standard switch and vNetwork distributed switch. The vNetwork standard switch is configured at host level. We can have maximum of 4088 vSwitch ports per standard switch and 4096 vSwitch ports per host. The vNetwork distribued switch is configured at vCenter. Its components are same as vNetwork Standard switch but it functions as a single virtual switch across all associated hosts. This allows virtual machines to maintain consistent network configuration as the migrate across multiple hosts.


The virtual switches will be discussed in more details in succeeding posts.