Hypervisor Types: A hypervisor is a computer software, that allows to create and runs virtual machines on a hardware. There are two types of hypervisor
- Type1 Hypervisor - Baremetal: Hardware without operating system.
- VMWare ESXi
- Microsoft Hyper-V
- Citrix Xen Server
- Type2 Hypervisor -Hosted: Install on top of operating system.
- VMWare Workstation
- Microsoft Virtual PC
- Virtual Box
VMWare Workstation 16 Pro: Installation
- Download VMWare workstation
- Double Click setup for installation.
- You can perform the following in vmware workstation
- Create a new VM
- Open a VM
- Connect to a remote server.
ESXi Installation: VMWare vSphere ESXi 7.0
Hostname: ESXi7-01
192.168.173.97
Domain: star.local
Hostname: ADC1
IP: 192.168.173.40
2CPU, 6GB RAM
Domain: star.local
o/s: windows server 2017
|
|
Hostname: vcenter197.star.local
192.168.173.197
192.168.173.197:5480
vsphere:
user:administrator@vcenter97.local
|
|
Hostname: ESXi7-02
192.168.173.98
Domain: star.local
|
ESXI 7.0.3 Host Installation on Bare Metal:
- Create a bootable USB with ESXI installation media files.
- Boot system with USB and install.
ESXI 7.0.3 Installation on VMWare Workstation:
- ESXI ISO: Download esxi 7.0 iso (required login with vmware)
- Open VMWare workstation > create a new VM
- provide iso image location in installer disc_image file(iso), can provider later as well.
- Select guest operating system > VMWare ESXI > ESXi 7 or later
- Virtual Machine name : ESXi01
- Location: provide location in which VM files should be stored.
- VM Disk: Recommended 142 GB,
- click customize hardware:
- Edit and select RAM, CPU processor and Network
- Bridged: connected directly to the physical network (select this so that router will provide IP address)
- select check box: Replace physical network connection state.
- NAT: used to share the host's IP address
- Host-only: A private network shared with the host.
- Custom: Specific virtual network
- VMNet0,VMnet1 (host only), VMNet2, 3,4,5,6,7, VMNet8 (NAT),9,10,11,12,13,14,15,16,17,18,19
- LAN Segment
- Enter, F11, Enter and enter complex password. F11
- IP address can be used to access GUI panel within the org to access ESXI, open browser and enter the IP.
Shared Storage using iSCSI:
In virtual environment you have multiple ESXi host and in which multiple VMs are created, There is a SAN storage in the network in which LUN (logical unit number) is created and it has to share storage with these ESXi host. To communicate/attach these storage it required protocols like iSCSI, NFS etc..
- SAN & NAS
- SAN (Storage Area Network): Dedicated hight speed network, it provides shared sotrage to servers from pool of storage disk. SANS are higly scalable and redundant(size can be increased easily and in case of failure data can still be accessible).
- It is blob based storage, in which you can share hard disk in virtual format.
- Two types of SAN Solutions:
- Fiber Channel (FC): High speed network of interconnected fiber channel switches.
- iSCSI Protocol: Internet small computer system interface, low cost ip network.
- Storage virtualisation:
- Centralized backup.
- Dynamic failover protection.
- NAS (Network Attached Storage): It is a box of multiple hard disk which is shared with servers. It is cheap and not redundant, if in case of failure data can not be accessed.
- It is file based/object based storage.
- click here for SAN vs NAS video.
- LUN (Logical Unit Number): Making a portion from the SAN storage is called Logical Unit Number which is attach with VM.
- iSCSI: It is a protocol which is used to map LUN to a VM.
- NFS:Network File System: It is used to map LUN to a VM which works similar to iSCI.
- IQN:Identity Quality Number: To communicate with iSCSI an IP address or MAC address or DNS name or IQN can be used.
- RDM (Raw Device Management): In this LUN is directly linked with VM.
LAB: Server 2016 is installed in ESXi, which can be used as SAN storage.
- Server 2016/server manager/add roles and features/ select file storage services, iscsi and nfs.
- Go to file and storage services>
- select iSCSI (it creates iSCSI virtual disks)
- drop down in TASK and select create new iSCSI virtual disk>
- select the drive which is used to share space (The iSCSI virtual disk will be saved at \iSCSI virtual disk on the selected volume.
- Name of iSCSI virtual disk name(shared_storage) and location will be D:\iSCSIVirtualDisks/shared_storage.vhdx.
- enter the size of virtual disk.
- select new iSCSI target or select an existing target.
- specify target name.(shared-storage) it will not accept underscore.
- click add to specify to which machine this virtual disk need to be attached. select IP address from (enter a value from the selected type) and enter IP address.
- select CHAP( no selection)
- create.
- Not connected ( shared storage is ready but not connected in the target machine)
- Go to target machine (esxi) >
- go to storage
- select adapter: software iSCSI (configure iSCSI) and click enable to get details
- click add dynamic target and enter IP address of storage server.
- save configuration (check in shared storage server) it will show connected, refresh it by right clicking.
- click on datastore
- new datastore
- create new vmfs datastore
- select MSFT iSCSI Disk (naa.60003ff44dc75adcb8953bf248....)
- give name ADC1 (it creates VMFS partition)
- select custom to define size 50GB, click on before and define size. finish.
Share storage of SAN using NFS protocol:
- LUN created in SAN storage which needs to attach with ESXi host using NFS protocol.
LAB: Server 2016 can be used to create storage and nfs protocol to attach LUN to esxi.
- Create a folder in C or D drive(shared_storage) and right click/properties/nfs sharing/manage nfs sharing/share this folder/permission/add/enter ip address of VM to which it need to share/ allow root access and apply.
- Access esxi server in browser/Storage: it has two storage, one local SSD drive and another which is created in earlier lab of iSCSI.
- Click on new datastore/select mount nfs datastore/ enter following details
- Name: nfs-storage
- nfs Server: Enter IP address of machine in which nfs folder created
- nfs share: enter location of nfs folder: c:/nfs_VirtualDisks
- nfs version: ver3 or ver4
- Add the nfs_storage to a VM
- Go to VM/edit settings/add hard disk/new standard hard disk/enter the allowed size/Location browse and select nfs_datastore
- Go to disk manangement/Online/Initialize disk/assign letter.
Installing a VM (windows) in ESXi host machine:
- Access the ESXi host in webbrowser.
- Click on VM and click new. Three options are available
- create a new VM
- Deploya a VM from an OVF or OVA file
- Register an existing VM
- Create a new VM:
- Enter name of VM
- compatible with ESXi
- Guest O/S family and version
- Select Storage: Need to define storage for O/S to install.
- Local storage: This is the storage available in ESXi System,
- Shared Storage: This is shared storage using SAN/NAS.
- select the storage, enter size to match available size.
- Thin provisioned.
- CD/DVD drive, define O/S iso file. upload iso file. or create VM and define iso file later in edit settings.
- select VM, right click and edit vm, define iso image, click VM options and under boot options select BIOS.
- Right click and open console in new tab.
Post Installation Steps, install the following:
- Check Programs installed: Control Panel/Programs & Features/.
Installing VMWare Tools:
- VM created in ESXI: in esxi select the VM/right click/Guest OS/Install tools.
- VM created in VMware workstation: Login to VM and go to this pc and click on CD rom and run setup.exe. requires system restart.
VM's Files created: Select the VM and go to Actions or right click on VM and go to Edit settings/ find out VM is attached with which Data source.
- Expand Disk and check the location of file. (vm_file1.jpg)
- Go to storage and select the storage and click data browser: (vm_file2.jpg)
Snapshot: It is taken as a backup of VM. Usually we create snapsot before patching, upgrade or hardware upgrade etc.. so it can be restore if there is any issue.
- Snapshot taken on 05/07/2022 (snapshot1)
- Made few changes and install new appliation, snapshot taken on 10/07/2022(snapshot2)
- After creating snapshot 3 more files will be created and added in files.
-
- Select the VM/Actions/Snapshots/take snapshot.
- check in storage, files added.
- There is a problem and want to restore VM in previous date,
- Go to VM/Actions/Snapshot/Restore (select the snapshot1 or 2 and restore it)
Snapshot of a VM through Vcenter Server:
- Logon to Vcenter server.
- select the vm and right click and click snapshot.
Troubleshooting Snapshot Errors:
- When you click create a snapshot, you get error or failed.
- Lowspace: Check VM is connected with which datastore and check space in that datastore.
- VMWare Tool is not insalled.
- VM is not connected with RDM or RDM is configured in that VM (Raw Device Mapping), click here for RDM tutorial.
- VMCenter must not configured replication.
Create a VM in vcenter:
- Logon to vcenter server, and go to Host/ESXI in which you want to create a VM.
- click Actions on top and click create a new VM.
- Enter virtual machine name.
- select a location of the virtual machine (Datacenter)
- select a compute resource (destination compute resource or ESXI Host, in which this vm will be created)
- select storage in which files will be created.
- compatible with (esxi 7.0 or later or esxi 8.0) vm using hardware version 20 provide the best perfromance and latest features available in ESXi8.0.
- choose the guest Os (windows,linux, other)
- Customize Hardware
- define CPU, Memory, hard disk size, storage policy, location, disk provisioning (Thin or Thick), CD/DVD drive (define location of ISO file and select power on status),
- Go to VM Option, Boot Options and select firmware as BIOS.
VM Editing:
- Action:
- Power on: Switch on VM
- Power off: Switch off VM
- Suspend: Freeze VM in the current position.
- Reset: Restart VM
- Guest OS
- Shutdown: Through Software
- Restart: Through Software
- Snapshot:
- Console:
- open browser console: Access the VM through Browser
- Open console in new window: Access VM console in a new browser window
- Open console in new tab: Access VM console in a new tab
- Launch Remote console: Dowload the software from Download VMRC. Download and install in the system.
- Download VMRC: VM Remote Control software will be downloaded and it can be access with launch remote console.
- Autostart:
- Enable: Enable the autostart
- Start Earlier:
- Configure: Configure time so that it start automatically on that time.
- Disable:
- Edit Settings: Hardware changes can be done.
- Virtual Hardware:
- Add Hard disk
- Add network adapter
- Add other devices
- CPU:
- Core per socket:
- CPU Hot Plug:
- Limit:
- Shares:
- Hardware Virtualization:
- IOMMU:
- Performance Counters:
- Scheduling Affinity:
- Memory:
- RAM:
- Reservation:
- Limit:
- Shares:
- Memory Hot Plug: Enable (Check box)
- Hard Disk1: 48 GB
- Maximum Size: 208 GB
- Type :
- Eagerly Zeroed,
- Thick provisioned
- Thick Provisioned, Lazily Zeroed
- Disk File: [datastore1] win10/win10-000002.vmdk
- Shares: Low, Normal, High, Custom
- Limit-IOPs: Unlimited
- Controller Location: SCSi Controller0, CSCI(0:0)
- Disk Mode: Dependent, Independent(Persistent), Independent(non-persistent)
- Sharing: Disk sharing is only possible with eagerly zeroed, thick provisioned disks.
- Add disk to VM:
- select vm/edit settings/hard disk1/add hard disk, define size and go to VM/disk management and online disk. It can be done in running VM.
- SCSI Controller 0 :
- LSI Logic SAS
- SCSI Bus Sharing:
- SATA Controller 0
- USB Controller 1
- Network Adapter 1
- VM Network
- Status: Connect at power on (check box)
- Adapter Type: E1000e
- MAC Address: Automatic : 00:0c:29:0d:d8:3d
- CD/DVD Drive 1: Datastore ISO file : Connect (check box)
- Status: Connect at power on (check box)
- CD/DVD Drive 1: [datastore1]Windows10.iso (Browse)
- Controller Location : STA Controller0 SATA(0:0)
- Video Card: Default settings
- VM Options:
- General Options:
- VM Name:
- VM config File:
- VM Working Location:
- Guest OS:
- Guest OS Version:
- VMWare Remote Console Options:
- Guest OS Lock:
- Maximum Number of Sessions:
- VMWare Tools:
- Power Operation: Shut down Guest, Put Guest on Stanby, Power on /Resume VM, Restart Guest.
- Run VMWare Tools Script:
- After Powering On
- After Resuming
- Before Suspending
- Before Shutting Down Guest
- Tools Upgrades
- Turn and upgrade VMWare Tools before each power on
- Time
- Synchronize Guest time with Host
- Power Management:
- Standby Response
- How should the virtual machine respond when the guest OS is placed on standby?
- suspend the virtual machine
- Put the Guest OS into standby mode and leave the virtual machine powered on.
- Wake on Lan:
- Wake on LAN for Virtual Machine Traffic on
- Network Adapter 1(VM Network)
- Boot Option:
- Firmware: Choose which firmware should be used to boot the virtual machine
- Boot Delay: Whenever the virtual machine is powered on or reset, delay boot by
- Force BIOS Setup:
- The next time the virtual machine boots, force entry into the BIOS setup screen.(check box)
- Failed boot recovery:
- When the virtual machine fails to find a boot device, automatically retry boot after (Check Box) enter time in seconds
- Advanced
- Settings:
- Disabled acceleration
- Enable Logging
- Debugging and statistics
- Swap file location:
- Default : Use the settings of the cluster or host containing the virtual machine.
- Virtual machine directory: Store the swap file in the same directory as the virtual machine.
- Datastore specified by host: Store the swap files in the datastore specified by the host to be used for swap files. If not possible, store the swap files in the same directory as the virtual machine. Using a datastore that is not visible to both hosts during vMotion might affect the vMotion performance for the affected virtual machines.
- Configuration parameters:
- Latency sensitivity:
- Fiber Channel NPIV:
- Virtual machines running on hosts with Fiber Channel hardware that supports NPIV can be assigned virtual WWNs for advanced features. These WWNs are normally assigned by the host or by vCenter Server.
- VBS
- Hot Plug Enabling: It is used to increase CPU and RAM in the VM, both are grayed out,
- power off vm and select hot plug enabled.
- After hot plug enabling cpu and memory can be increase/decrease even VM in Poweron state.
- There is no hot plug for hard disk.
Upgrade ESXI 7.0.3 to 8.0:
- Download ESXI 8.0 ISO file
- Change location of ISO file in ESXI.
- Time delay set in .vmx
- Open .vmx file in notepad and add line bios.bootdelay = 20000 and restart esxi, during boot click on screen and press ESC to enter boot menu.
- select CD for boot and system will start booting from ISO location.
- select upgrade option and continue installation.
Check url for boot screen delay: https://sportsclinictampico.com/device/how-to-increase-the-vmware-boot-screen-delay/
Upgrade ESXi 7.0 to 8.0: https://www.virtualizationhowto.com/2022/10/esxi-8-0-upgrade-in-three-ways/
Virtual Network Editor: VMWare workstation virtual network editor is used to maintain network configuration (IP address assignment) for VMs.
- VMWare Workstation > Edit > Virtual Network Editor
- 3 types of virtual network created by default in VMWare Workstation which assign IP address to VMs.
- Bridged (VMnet0): Connected directly to the physical network:
- Replicate physical network connection state. (checkbox):
- IP will be assign by DHCP from your network.
- VMs can communicate with each other.
- NAT (VMnet8): Network Address Translation:
- ALL VMs will get private IP address from the defined pool and it will translate to public IP if VMs trying to communicate outside the network (Internet).
- Home router where Private IP will assign to all devices but they can communicate with other network or can have internet access.
- Host-Only (VMnet1):
- All VM can communicate with each other only,
- No other network communication and cannot communicate with host.
vSphere for Client Installation: From ESXi 6.0 onward vshpere client is not required to manage esxi, it can be access with webclient. enter ip address of esxi in browser.
- Managing Host with vSphere Clients:
- Networking: Adding Port Groups and VMKernel Ports:
- Network Traffic and Load Balancing:
Add Domain to ESXi:
- Configuration in ESXi Server:
- Logon to ESXi, user name and password and press f2
- Confiture time and date synchronization:
- Host / Manage/system/Edit NTP settings
- NTP: user network time protocol and enter IP address of DNS or ESXI and save it.
- Go to Services and start NTP daemon.
- Configure Management Network:
- IPv4:
- select static IPV4 address and network configuration.
- enter IP address, Subnet mask, default gateway.
- Press Enter to accept the newly entered details and press esc and y to accept.
- DNS Configuration:
- Primary DNS server: enter DNS IP
- Secondary DNS Server: Enter secondary DNS IP
- Hostname: esxi name
- Go to Domain Controller: DNS > forward lookup zone and create A record, enter the hostname(esxi) and ipaddress of esxi
- Go to browser: enter IP address and credentials
- Manage>security and users> Authentication
- join domain: enter domain name, user name and password of DNS server.
Networking: There are two types of networking available in ESXi.
- VM Network Port: You have VM on host machine, you assign network interface card or eswitch from network port, this will have no IP address.
- Vkernal Port:
- NIC Teaming: Make group of more than one physical Interface card.
- Failover:
- Load Balancing:
Select the Storage and click Data Store browser/
- The above the location where files of VM10 are stored
Go to datastore1 and click Datastore browser: Click on VM
- VMWare.log: Any activity perform related to VM, it contain all the information like VM start, stop, restart, update etc. not related with O/S of VM.
- .vswp: Swap file / Cache file, (small size is for VM and bigger size is for ESXi).
- .nvram: non volatile RAM: It is a firmware, BIOS of VM. (Firmware is a type of software that is etched directly into a piece of hardware. It operates without going through APIs, the operating system, or device drivers).
- .vmdk: Virtual Machine Disk, VM o/s is installed in this disk.
- .vmsd: Virtual Machine Snapshot Data, it contains meta data of snapshots of vm.
- .vmx: Contain information of hardware of VM.
- .vmx.lck: it is lock file applied to VM so no one can make changes.
- .vmx~: it is read only file: If you made any changes in VM configuration which is stored in .vmx file and permanent data is stored in .vms~
- .vmxf: File system of VM.
HP Proliant D380 Gen10 Server:
- It comes with 4 NIC card and additionally can order unto 16 NIC cards.
Lab:
- HP Proliant D380 with 4 NIC cards
- 3 switches where two are used in production. 1 switch is used as management switch.
- attach cable from ILO port to management switch.
- second cable for serial port 0101.
- Third cable to switch 1.
- Fourth cable to switch 2.
- These switches are connected with firewall and users are connected via firewall to the server or its vMs.
- Installing ESXi on this new HP server.
- Suppose server have two hard drives of 150 each, you create a logical volume of 100 gb of these drives.
- Laptop is connected to firewall with vpn and laptop has ESXi software.
- Laptop connected to ILO and mount the software via vpn to install ESXI.
- During installation after pressing f11 it will discover the hardware, it will not discovered and show serial and management ethernet ports. These two works/functioning from firmware not from o/s level.
- It assign vmnic0 and vmnic1.
- standard switch: It creates internal vswitch called vsphere standard switch and connects to vmnic0 and start communication.
- switch has two components.
- VM Kernel port: It communicates with host(ESXI), the IP assigned to esxi host will be displayed in management network/vmkernel port.
- Port Group: it communicates with VMs.
Redundancy LAB:
- Adding network cards in ESXi host machine:
- Go to ESXI machine, VMware workstation and right click required esxi / settings / add network adapter, restart ESXI. (ex. ESXI is running on vmware worksation).
- In baremetal add physical adapter and restart ESXI.
- login to esxi via browser and check network adapters(vmnic1,2,3,.,.,.,.,. added)
- Adding Virtual Switches:
- Switches are two types on virtual environment:
- Standard switch: It comes with every ESXI host installation. It has 3 components.
- Uplink: Physical NIC, the IP address which is used to access the vm is managed by uplink.
- VM Network: Port group which is used to seggregate the network.
- Management Network: It contain 2 important services.
- VMKernel:Responsible to get shared storages to esxi.
- VMotion: Help to migrate vm from one esxi to another esxi.
- Distributed virtual switch: It required vcenter server to configure distributed switch.
Networking In ESXI host: Access host in browser, Go to Networking:
- Port Group:
- Virtual Switches:
- Physical NICs:
- VMKernel NICs:
- TCP/IP Stacks:
- Firewall Rules:
Networking In vcenter server: select the ESXI/configure/add networking/switches/add networking, select virtual machine port group for a standard switch, we already have kernal port (swtich0).
-
- select new standard switch option.
- Assign adapters, click + and select two adapters (vmnic2 and 3).
- Enter VLAN number (vlan199) and finish.
- Create multiple vlans in this switch, add networking/select switch and enter vlan299 and finish.
- create two vms in two vlans (199 and 299) and ping to test. remove vmnic2 and test ping.
- Connection of Physical adapters with Vswitches (Vswitch0).
- Remove port group from vmnic: right click on port group and click remove.
- kernal port is linked with vmnic0 and vmnic1 (responsible for host traffic)
- ping 192.168.173.97 (will get reply) now remove one connection from vmnic0 (go to esxi / edit/network adapter/connected(uncheck):
- now ping again 192.168.173.97 and it will ping using vmnic1.
- port group is linked with vmnic2 and vnmic3 (responsible for vm traffic),
- create two port groups, two vms are installed in two different port groups.
- Difference between physical switch and virtual switch:
- physical switch works on L3 which uses IP address
- Virtual switch works on L2 which uses MAC address.
VCenter Installation: Hierarchy of vcenter.
- Vcenter server : 192.168.173.197
- Datacenter:
- Cluster: it is group of hosts or VMs, it is availble in vcenter.
- Host - ESXI1 (192.168.173.97)
- VM - ADC2
- VM - vcenter (additional VCLS (vsphere cluster services) vms will be created depend upon the size of network), This feature ensures cluster services such as vSphere DRS and vSphere HA are all available to maintain the resources and health of the workloads running in the clusters independent of the vCenter Server instance availability
Session timeout in vcenter server 8:
- Login to vcenter sphere and go to Home/Administration/client configuration/edit session timeout (default 120 Minutes), save it and restart vsphere client service.
DRS, HA and VSAN: In VSphere cluster we have three important services:
- DRS
- HA
- VSAN
DRS: Distributed Resource Scheduler:
- It works like Load Balancer for CPU and RAM consumption. If you have multiple host(ESXI) and each host has multiple VM installed. If cpu or memory utilisation in one of the host then it will move VM to another host (esxi).
HA: High Availability:
- If you have mutliple Host(esxi) and each host has multiple VMs, In case one of esxi is corrupt then it will transfer all its VMs to another host(esxi).
VSAN: It is related with shared storage. It is virtual storage area network.
LAB:
DRS: we have two hosts(ESXi1 (192.168.100.97) and ESXi2 (192.168.100.98)), which is connected with vcenter server (192.168.100.197), we have 2 shared storage(shared-storage1 and shared-storage2)connected with both esxi hosts.
Requirement:
- Shared storage
- turn on vmotion:
- Go to ESXi1> Networking> VMKernel NIC> click on vmk0 > Actions > edit settings > services and select check box vmotion. save configurtion,
- Perform the above task in second host (ESXI2).
- Activate DRS services in cluster> right click and settings > Edit > Activate: it has 3 options
- Automation Level:
- Manual:
- Partial automation:
- Fully automation: DRS will move some of VMS to another host automatically. DRS is turned on.
- Create vms in the shared storage with 64 bit o/s so that its capacity gets exhausted in either host. (ex. esxi1)
- When resources, cpu or memory exhausted then vcenter will automatically transfer vm into second host ESXi2.
- Click on ESXi2 in vcenter and go to VM and check if there is VM are transferred.
HA:
Storage:
Troubleshooting:
Virtual Machine appears to be in use: When you open an existing virtual machine using .vmx file and get the following error:
Error: This virtual machine appears to be in use. If this virtual machine is not in use, press the "Take Ownership" button to obtain ownership of it. Otherwise, press the "Cancel" button to avoid damaging it.
Configuration file: location.vmx.
Solution:
- Close VMware Workstation.
- Delete any .lck or .lock files and/or folders you see, in the directory of the problematic VM.
- Run VMware Workstation.
- Start the VM using .vmx file.