Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
43 views76 pages

Virtualization Lab Exercises

The document outlines a series of virtualization lab exercises conducted at A.V.C College of Engineering, focusing on creating and managing virtual machines using tools like VirtualBox and VMware. It includes detailed procedures for installing guest operating systems, managing virtual disks, creating snapshots, and setting up RAID volumes. Additionally, it covers desktop virtualization using VNC and Chrome Remote Desktop, providing step-by-step instructions for remote access and control of desktops.

Uploaded by

m.bala
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views76 pages

Virtualization Lab Exercises

The document outlines a series of virtualization lab exercises conducted at A.V.C College of Engineering, focusing on creating and managing virtual machines using tools like VirtualBox and VMware. It includes detailed procedures for installing guest operating systems, managing virtual disks, creating snapshots, and setting up RAID volumes. Additionally, it covers desktop virtualization using VNC and Chrome Remote Desktop, providing step-by-step instructions for remote access and control of desktops.

Uploaded by

m.bala
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 76

A.V.

C COLLEGE OF ENGINEERING, MANNAMPANDAL


DEPARTMENT OF CSE

CCS372-VIRTUALIZATION LAB EXERCISES

Ex No: 1 Date:

Create type 2 Virtualization in VMWARE or any equivalent Open Source Tool.


Allocate memory and storage space as per requirement. Install Guest OS on that
VMWARE.

AIM:
To install Virtual box /VMware Workstation with different flavours of Linux OS.

DEFINITION:

VirtualBox is open-source software for virtualizing the X86 computing


architecture. It acts as a hypervisor, creating a VM(Virtual Machine)where the user
can run another OS(Operating System).The operating system where VirtualBox runs
is called the “host”OS. The operating system running in the VM is called the
“guest”OS . VirtualBox supports Windows, Linux, or macOS as its hostOS.

PROCEDURE:
1. Download and Install VirtualBox. Using the link-
https://www.virtualbox.org/wiki/Downloads
2.Download and Install Ubuntu. Using the link-
https://ubuntu.com/download/desktop/thank-you?version=20.04.1&architecture=amd64

Run the virtual box setup and click on “Next” Button.


Click on “Next” button.
Click on “Next” button.

Click on “Yes” button


Installing “Ubuntu”as Virtual machine in “Oracle VM VirtualBox”.

1. Open “Oracle VM VirtualBoxManager”.


1. Click on” New “button and select “Expert Mode”.

.
2. Provide the name and operating system information for virtual machine.
3.Select the path for the virtual hard disk and Click on “create”button.

4. Select the virtual machine from the Virtual box manager and click on
“settings “ button.
5. Select “System” and navigate to “processor” tab to adjust number of processor
virtual machine for better performance.

6. Select “storage” and choose the installation media of Operation System


(ISO/CD/DVD). Preferred Linux “.iso” can be download from CC ftp site.
Also many different flavours of Linux are available on the internet- Fedora ,
CentOS , Ubuntu, Debian, Mageia, openSUSE, Arch Linux, Slackware
Linux, etc.
7. Select “Network” to make changes required for network setting of virtual
machine and click on “OK”.
8. Select the created Virtual machine and click on “Start” button.

9. Proceed with the installation of operating system in virtual machine.


Installing “Guest Additions CD image” in Ubuntu virtual machine.
1. Login to user account on Ubuntu virtual machine.
Select “Device>Insert Guest Addition CD image”.

2. Click “Run “to install “Guest Additions”.


3. Input the authentication of super user and click on “Authenticate”.
Aftercompleting installation “Reboot” the virtual machine.

Enable “Shared Folder” between host OS (i.e. Windows OS) and guest OS
(i.e.Ubuntu).
NOTE: Before continuing, shutdown the virtual machine.

1. Create a folder on host OS (i.e. on Windows) with any name “Share” on any
drive having sufficient available space.
2. Select the virtual machine in “Oracle VM VirtualBox Manager” and click on
“settings”.

3. Select “Shared Folders” and click on “+” to add a shared folder to virtual
machine.
4. Enter the “Folder path, Folder Name” and select “Auto-mount” and click
on”OK” button.

5. Power on the virtual machine and open “Terminal”.


6. Run the following commands in “Terminal”
“mkdir vmshare” where vmshare is the mount point for Shared Folder.
“sudo chmod 777 vmshare”

7. Append a line in “/etc/rc.local” file to automount the “Shared Folder”


on every boot.
Mount -t vboxsf -o uid=1000,gid=1000 share /home/<your User
Name>/vmshare
Save the file and reboot the virtual machine
Choose the required installation type.
Enter a username and password for your VM.

Once the installation finishes, restart the virtual system.


Complete the installation process.

RESULT:

Thus, the VirtualBox was installed with Ubuntu OS over Windows 10


Successfully.
Ex No: 2 Date:

a. Shrink and extend virtual disk


b. Create, Manage, Configure and Schedule snapshots
c. Create Spanned, Mirrored and Striped volume
d. Create RAID 5 volume

AIM:
To Shrink and extend virtual disk in Windows OS.

PROCEDURE:
Step 1: Open Disk Management by typing DiskMangement in Start menu search box and
hitting enter or Click the Start Button and Go to MyComputer and then Right click MyComputer
> Click Manage.
Step 2: Now right-click on the volume that you want to shrink and select Shrink
Volume option.

Step 3: Enter the amount of disk space to shrink in MB.

Step 4: Click shrink button to start shrinking the volume.


If we want to extend a volume by adding space from one or more additional disks, you can use
Extend Volume feature present in disk management.

How to extend a volume in Windows 7:

Step 1: Again, open disk management by typing either disk management or diskmgmt.msc in
start menu search box and hitting enter.

Step 2: Right-click on the volume that you want to extend and select Extend Volume option to
open extend volume wizard. Click next to continue.
Step 3: Enter the amount of disk space that you want to add the current partition from available
free space.

Step 4: Click next to start extending your partition size.

RESULT:

Thus, the disk management was successfully partioned and the output was
verified.
2b. Create, Manage, Configure and schedule snapshots

AIM:

To create, manage, configure and schedule snapshots in oracle virtual box.

DEFINITION:

Snapshot: VM Snapshot a method to create a copy of Virtual Machine (VM) at specific


point of time and it is used to preserve a particular state of a VM.

PROCEDURE:

Step:1 Start the VirtualBox to create VM Snapshot.

Step: 2 Select the virtual machine for snapshot and then click on ‘Snapshots‘ option. In
this case we are going to create a snapshot of CentOS 7 VM.
Step: 3 Specify the Snapshot Name and Description and then Click on ‘OK‘

Note : When we try to take snapshot of running VM then Virtualbox manager will put
that VM in Paused state , so once the snapshot task is completed then we can move the
VM’s state from Paused to Running.
Restore VirtualBox VM from Snapshot
Step:1 Power off the Virtual Machine.

Step:2 Select the VM and Go to ‘Snapshots‘ option and then click on “Restore
Snapshot option”
When we click on “Restore Snapshot” option , it will give us an option to create
snapshot of current state of the VM and if we don’t want the current state snapshot then
untick the option ( Current state will be deleted permanently ).

Click on “Restore” option to Restore the snapshot.

Now Click on Start option to start the VM


RESULT:

Thus, the scheduled snapshots was created, managed and configured successfully
and the output was verified.
2c. Create Spanned, Mirrored and Striped volume

AIM:
To create spanned, mirrored and striped volume in Windows OS.

DEFINITION:
A spanned volume combines areas of unallocated space from multiple disks into one
logical volume, allowing you to more efficiently use all of the space and all the drive
letters on a multiple-disk system. A striped volume is created by combining areas of free
space on two or more disks into one logical volume.

A mirrored volume is a fault-tolerant volume that provides data redundancy by using


two copies, or plexes, of the volume to duplicate the data that is stored on the volume. All
data that is written to the mirrored volume is written to both plexes, which are located on
separate physical disks.

A striped volume (RAID 0) combines areas of free space from multiple hard disks
(anywhere from 2 to 32) into one logical volume. Data that is written to a striped volume
is interleaved to all disks at the same time instead of sequentially.

PROCEDURE:

Step 1: Open disk management by typing either disk management or diskmgmt.msc in start
menu search box and hitting enter.

Step 2: In Disk Management Graphical View, right-click an area marked Unallocated on a


dynamic disk, and then choose New Spanned Volume.
To perform the conversion simply right click on the icon for the drive in question and
select Convert to Dynamic Disk... from the popup menu. This will invoke the Convert to
Dynamic Disk dialog shown below:

Select the disk to be converted and click on OK. In the resulting dialog a list of drives
scheduled for conversion is displayed. To view the volumes on a drive, select the drive in
the list and click on details:
Click on Convert to initiate the conversion process. Once completed, the drive will
appear as a dynamic drive in the Disk Management interface.
To enable this we need to select disk 2 from the left hand list of available disks and
click on Add> to add it to the selected disks. Having done so the amount of space
from each drive may be selected up to the maximum combined space from both
disks.
Select one or more disks from the list of dynamic disks that are available and have
unallocated space. Click Add to add the disk or disks to the Selected list box. Next,
select each of the disks in turn, then specify the amount of space you want to use
on the selected disk. Click Next when you are ready to continue.

Use the Assign Drive Letter Or Path page to assign a drive letter or path. You can also choose
Do Not Assign A Drive Letter Or Drive Path if you want to create the partition without assigning
a drive letter or path. Click Next.

Use the Format Volume page, as shown in Figure 19-14, to set the formatting options. Simple
and spanned volumes can be formatted by using FAT, FAT32, or NTFS. Use NTFS because only
volumes using NTFS can be expanded.
Click Next. The final page shows you the options you've selected. If the options
are correct, click Finish. The wizard then creates the volume and configures it.

Likewise we are creating Mirrored volume and Striped volume.

1. Right-click one of the empty drives, and select New Mirrored Volume.

2. Click Next.
3. Select the available drive from the left.
4. Click Add.
5. Specify the amount of space for the mirrored volume. Important: The volume cannot be larger
than the amount of the available space in the smaller hard drive, as you can't mirror data to space
you don't have.
6. Click Next.
7. Assign a drive letter or leave the default settings and click Next.
8. Select Format this volume with the following settings option making sure file system is set to
NTFS, allocation unit size is set to default, and you enter a name for the volume.
9. Check the Perform a quick format option.
10. Click Next.
11.Click Finish.

Click Yes to convert the basic disks to dynamic disks, which is a requirement to create a
mirrored volume on Windows. Once the process completes, you'll only see one volume created,
and as you store content on the new volume, the data will also automatically get replicated into
the secondary drive.

Create a Striped Volume in Windows


1. Open the Disk Management console.

2. Right-click a segment of free-space that you want to include in the striped volume and right
click on “New Striped Volume”.

3. The New Striped Volume Wizard appears. Click Next.

4. On the Select Disks page, select from the available disks and then click Add to add the disks
to the striped volume.

5. Set the amount of space to use on the disks for the striped volume and click Next.

6. On the Assign Drive Letter Or Path page, the default is to assign the next available drive letter
to the new volume. You can also mount the volume on an empty NTFS folder on an existing
volume. Click Next.

7. On the Format Volume page of the New Striped Volume Wizard, choose the formatting
options for the new volume. Windows 11/10/8/7/Vista supports only NTFS formatting from the
Disk Management snap-in. Click Next.

8. Click Finish on the summary page to create the volume. If the disks are basic disks, you’ll be
warned that this operation will convert them to dynamic disks. Click Yes to convert the disks and
create the striped volume.

RESULT:

Thus, the spanned volume, mirrored volume and striped volume was created successfully
and the output was verified.
2d.Create RAID 5 volume
DEFINITION:

RAID level 5 is similar to striping, but with parity (equal or equivalent) data distributed across
all components (disk or logical volume). If a component fails, the data on the failed component
can be rebuilt from the distributed data and parity information on the other components.

Right-click the unallocated space and choose “New RAID-5 Volume”.

Then click on the “Next” in the pop-out “New RAID-5 Volume Wizard”.
Then select the disks you want to use for creating RAID-5 volumes, and click on “Next”.
At least 3 disk will be required.
Now, you can assign a drive letter to the RAID 5 volume and format the volume and click on
“Next”.
At last, click on “Finish”.

RESULT:

Thus, the RAID 5 Volume was created successfully and the output was
verified.
Ex No: 3 Date:

A. Desktop Virtualization using VNC

AIM:
To install desktop virtualization using VNC.

DEFINITION:
Desktop virtualization is technology that lets users simulate a workstation load to access
a desktop from a connected device. It separates the desktop environment and its
applications from the physical client device used to access it.

VNC stands for Virtual Network Computing. It is a cross-platform screen sharing


system that was created to remotely control another computer. This means that a
computer’s screen, keyboard, and mouse can be used from a distance by a remote user
from a secondary device as though they were sitting right in front of it.

PROCEDURE:

Step 1: Enable Remote Desktop on your computer

Right-click 'My Computer' and then click 'Properties'. Click the 'Remote' tab and then
choose 'Allow remote connections to this computer'. Then click the 'OK' button.
Step 2: Install VNC server software on the host machine where you want to virtualize the
desktop. Examples of popular VNC server software include RealVNC. Follow the
installation instructions specific to the VNC server software you choose.
Step 3: Configure the VNC server software by specifying settings such as display
resolution, authentication methods and other options as needed.
Step 4: Start the VNC server on the host machine, which will make the desktop available
for remote access.
Step 5: Install the VNC client software on the client machine from which you want to
access the virtualized desktop. Examples of client software include RealVNC Viewer.
Follow the installation instructions specific to the VNC client software you choose.

Step 6: Launch the VNC client software on the client machine.

Step 7: Enter the hostname or IP address of the host machine where the VNC server is running
along with the port number and authentication credentials if required.
Step 8: Connect to the VNC server from the client machine which will establish a remote
desktop session with the virtualized desktop on the host machine.

Step 9: Use the VNC client software to interact with the virtualized desktop, just like you would
with a physical desktop.
RESULT:

Thus the output of setting up desktop virtualization using VNC will be a remote
desktop session with the virtualized desktop on the host machine, accessible from the
client machine. The result is that you can remotely access and control the desktop on the
host machine from a different location providing a virtualized desktop experience.
Ex No: 3 Date:

B. Desktop Virtualization using Chrome Remote Desktop

AIM:
To set up desktop virtualization using Chrome Remote Desktop
Desktop,, a free remote
desktop solution provided by Google.

DEFINITION:
Chrome Remote Desktop is a remote desktop software tool, developed by Google, that
allows a user to remotely control another computer's desktop through a proprietary
protocol also developed by Google, internally ca
called Chromoting.

The easy way to remotely connect with your home or work computer, or share your
screen with others. Securely access your computer whenever you're away, using your
phone, tablet, or another computer.

PROCEDURE:

Step 1: Set up remote access to your computer


computer.

You can set up remote access to your Mac, Windows, or Linux computer.

1. On your computer, open Chrome.


2. In the address bar, enter remotedesktop.google.com/access.
3. Under “Set up Remote Access,”
Access,”click Download” .
4. Follow the onscreen directions to download and install Chrome Remote Desktop.

We may have to enter your computer password to give Chrome Remote Desktop access.
You may also be prompted to change security settings in Preferences.

Step 2: Share your computer with someone else

We can give others remote access to your computer. They’ll have full access to your
apps, files, emails, documents, and history.

1. On your computer, open Chrome.


2. In the address bar at the top, enter remotedesktop.google.com/support,
remotedesktop.google.com/support and
press Enter.
3. Under “Get Support, “click Download” .
4. Follow the onscreen directions to download and install Chrome Remote Desktop.
5. Under “Get Support,” select Generate Code.
6. Copy the code and send to the person we want to have access to your computer.
7. When that person enters yyour access code on the site, we'll
'll see a dialog with their
email address. Select Share to allow them full access to your computer.
8. To end a sharing session, click Stop Sharing.

The access code will only work one time. If you are sharing your computer, you will be
asked to confirm that you want to continue to share your computer every 30 minutes.

Step 3: Access a computer remotely


remotely.

1. On your computer, open Chrome.


2. In the address bar at the top, enter remotedesktop.google.com/access,
remotedesktop.google.com/access and
press Enter.
3. Click Access to select which computer you want.
4. Enter the PIN required to access another computer.
5. Select the arrow to connect.

Step 4: Stop a remote session

When we arere finished, close yo


your tab to stop your session. We can also
select Options Disconnect
Disconnect.

Step 5: Remove a computer from your list


list.

1. On your computer, open Chrome.


2. In the address bar at the top, enter remotedesktop.google.com/access,
remotedesktop.google.com/access and press
Enter.
3. Next to the computer you want to remove, click Disable remote connections .

Step 6: Give remote support

1. If someone has shared their remote access code with you, you can remotely offer
support.
2. On your computer, open Chrome.
3. In the address bar at the top, enter remotedesktop.google.com/support,
remotedesktop.google.com/support and press
Enter.
4. Enter the code under “Gi
“Give support” and click Connect.

Step 7: Remove Chrome Remote Desktop in Windows

1. On each computer where you want to remove Chrome Remote Desktop access,
remove the app:
1. Go to Control Panel Programs Add/Remove Programs.
Programs
2. Find the "Chrome Remote Desktop" application.
3. Click Remove.
Result:

Thus the output of setting up desktop virtualization using Chrome Remote Desktop will
be a remote desktop session with the virtualized desktop on the host machine, accessible
from the client machine using the Chrome Remote Desktop application. The result is that
you can remotely access and control the desktop on the host machine from the client
machine using the Google Chrome web browser, providing a virtualized desktop
experience.
Ex No: 4 Date:

4. Create type 2 virtualization on ESXI 6.5 server

AIM:
To install type 2 virtualization on ESXI 6.5 server.

DEFINITION:
VMware ESXi, also called VMware ESXi Server, is a bare-metal hypervisor
developed by VMware for vSphere. ESXi is one of the primary components in the
VMware infrastructure software suite.

ESXi is a Type 1 hypervisor, meaning it runs directly on system hardware without the
need for an OS. Type 1 hypervisors are also referred to as bare-metal hypervisors because
they run directly on hardware. Hypervisors help run multiple VMs efficiently on a
physical server.

PROCEDURE:

Step 1: Login to Virtual Center using Web Client or vSphere Client.

Step 2: Select ESXi Host and do a Right Click.

Step 3: Click on New Virtual Machine. It will open New Virtual Machine Wizard.
Step 4: From Select a Create Type, Choose "Create a new virtual machine" and Click
on Next.

Step 5: Enter a unique name for the Virtual Machine and Select either Datacenter or
Specific Folder you want to deploy this VM. The name can contain up to 80
characters. Click on Next.

Step 6: Select Cluster and ESXi host where you will deploy this Virtual Machine.
Virtual machine will have access to the resources of the selected object. (i;e Datastore
and Network attached to that Cluster/Hosts).
Step 7: Select Datastore in which you would like to store the Virtual Machine
configuration files and all of the virtual disks. Please note that Virtual disks and
configuration files can also be in different datastores. Click on Next.

Step 8: Select Compatibility for this Virtual Machine. Choose default and Click
on Next.
Step 9: On Select a Guest OS Wizard, Choose the Guest OS type(i;e
Windows/Linux/Other, 32/64 Bit) and Guest Name. Please note that selecting Guest OS
Type affects the supported devices and number of virtual CPUs available for the virtual
machine. i;e i fwe choosed 32 Bit Windows OS, then even if vSphere 6.5 support 128
vCPU, but this VM will only support up to vCPU depending on OS compatibility.

Step 10: Configure the Virtual Machine Hardware as per requirement and Click on
Next.

Step 11: Select Scheduling Option for this Virtual Machine.


Step 12: You change Virtual Machine Scheduling to some different time. To do
this, Click on Change and setup scheduling.

Step 13: If you want to deploy now, click on Next.


Step 14: You can review the virtual machine before you deploy the virtual machine.
Click on Finish to Complete the New Virtual Machine Wizard.

Step 15: A new Virtual Machine has been deployed in ESXi Host. You can click on
Summary Page and review the configuration and status.
Step 16: Creating Virtual Machine Wizard only provision a New Virtual Machine in
Environment. It doesn't install Operating System. To Install OS, follow the below
Process:-

o Right Click on Virtual Machine.


o Go to Edit Settings.
o Mount ISO for specific OS.
o Power On Virtual Machine and follow Installation Wizard.

RESULT:

Thus, the type 2 virtualization on ESXI 6.5 server was installed on Windows 10 and
successfully created a new virtual machine.
Ex No: 5 Date:

5. Create a VLAN in CISCO packet tracer

AIM:
To create a VLAN in CISCO packet tracer.

DEFINITION:
A Virtual LAN (VLAN) is simply a logical LAN. VLANs have similar characteristics
with those of physical LANs, only that with VLANs, you can logically group hosts even
if they are physically located on separate LAN segments.
Each VLAN as a separate subnet or broadcast domain. For this reason, to move packets
from one VLAN to another, we have to use a router oor a layer 3 switch. VLANs are
configured on switches by placing some interfaces into one broadcast domain and some
interfaces into another.

PROCEDURE:

1. In Cisco Packet Tracer, create the network topology as shown below:


2. Create 2 VLANs on the switch: VLAN 10 and VLAN 20. You can give them
custom names.

Switch#config terminal

Switch(config)#vlan 10

Switch(config-vlan)#name SALES

Switch(config-vlan)#vlan 20

Switch(config-vlan)#name IT

3. Assign switch ports to the VLANs. Remember each VLAN is viewed as separate
broadcast domain.

you configure that switch ports could be either access or trunk.

 An access port is assigned to a single VLAN. These ports are configured for switch ports
that connect to devices with a normal network card, for example a PC in a network.
 A trunk port on the other hand is a port that can be connected to another switch or router.
This port can carry traffic of multiple VLANs.

We will configure switch interfaces fa 0/1 through fa 0/4 as access ports to connect to our
PCs. Here, interfaces fa 0/1 and fa 0/2 are assigned to VLAN 10 while interfaces fa
0/3 and fa 0/4 are assigned to VLAN 20.

Switch Interface fa0/5 will be configured as trunk port, as it will be used to carry traffic
between the two VLANs via the router.

Switch>enable

Switch#config terminal

Switch(config)#int fa0/1

Switch(config-if)#switchport mode access

Switch(config-if)#switchport access vlan 10


Switch(config-if)#int fa0/2

Switch(config-if)#switchport mode access

Switch(config-if)#switchport access vlan 10

Switch(config-if)#int fa0/3

Switch(config-if)#switchport mode access

Switch(config-if)#switchport access vlan 20

Switch(config-if)#int fa0/4

Switch(config-if)#switchport mode access

Switch(config-if)#switchport access vlan 20

Worth noting: We could have configured all the above interfaces as access ports
using interface range command as shown below:

Switch(config-if)#int range fa0/1-4

Switch(config-if-range)#switchport mode access

In the above commands, we have specified an interface range and then proceeded to
configure all the ports specified as access ports.

Interface fa0/5 is configured as trunk and will be used to for inter-VLAN communication.

Switch(config)#int fa 0/5

Switch(config-if)#switchport mode trunk

4. Assign static IP addresses to the four PCs which are located in the separate VLANs.
PC1 and PC2 fall in VLAN 10 while PC3 and PC4 fall in VLAN 20.

PC1 IP address 192.168.1.10 Subnet mask 255.255.255.0

Default gateway 192.168.1.1


PC2: IP address 192.168.1.20 Subnet mask 255.255.255.0

Default gateway 192.168.1.1

PC3: IP address 192.168.2.10 Subnet mask 255.255.255.0

Default gateway 192.168.2.1

PC4: IP address 192.168.2.20 Subnet mask 255.255.255.0

Default gateway 192.168.2.1

To test the connectivity within VLANs and between VLANs and to


o test communication
between hosts in the same VLAN:

Ping PC2 from PC1 both in VLAN 10. Ping test should be successful.

To test connectivity between hosts in different VLANs:

Ping PC3 in VLAN 20 from PC1 in VLAN 10. We have ve used VLANs to place the hosts
into two logical networks which can be viewed as separate broadcast domains.

6. Test VLAN connectivity.

To test connectivity between computers in different VLANs. Ping PC3 in VLAN 20 from
PC1 in VLAN 10.

RESULT:

Thus, the VLAN was successfully created using CISCO Packet tracer.
Ex No: 6 Date:

6. Install KVM in Linux

AIM:
To install Kernel based Virtual Machine (KVM) in Linux.

DEFINITION:
Kernel-based Virtual Machine (KVM) is an open-source type-1 (bare-metal) hypervisor.
This functionality permits a host system, such as Oracle Linux 8, to host multiple virtual
machines (VMs) or guests when running on supported hardware.

KVM hypervisor supports following features:

1. Over-committing: It means allocating more virtualized CPUs or memory than the


available resources on the system.
2. Thin provisioning: It allows the allocation of flexible storage and optimizes the
available space for every guest virtual machine.
3. Disk I/O throttling: Provides the ability to set a limit on disk I/O requests sent
from virtual machines to the host machine.
4. Automatic NUMA balancing: Improves the performance of applications running
on NUMA hardware systems.
5. Virtual CPU hot adds capability: Provides the ability to increase processing
power as needed on running virtual machines, without downtime.

PROCEDURE:

Step 1: Check Virtualization Support in Ubuntu

Before installing KVM on Ubuntu, we are first going to verify if the hardware
supports KVM. A minimum requirement for installing KVM is the availability of CPU
virtualization extensions such as AMD-V and Intel-VT.

1. To check whether the Ubuntu system supports virtualization, run the following
command.

$ egrep -c '(vmx|svm)' /proc/cpuinfo


If the command returns a value of 0, your processor is not capable of running KVM. On
the other hand, any other number means you can proceed with the installation.

2. Now, check if your system can use KVM acceleration by typing:

sudo kvm-ok

If kvm-ok returns an error stating KVM acceleration cannot be used, try solving the
problem by installing cpu-checker.

3. To install cpu-checker, run the following command:

sudo apt install cpu-checker

4. When the installation completes, restart the terminal.

We are now ready to start installing KVM.

Step 2: Install KVM on Ubuntu 20.04 LTS

To enable KVM virtualization on Ubuntu 20.04:

 Install related packages using apt


 Authorize users to run VMs
 Verify that the installation was successful

Install KVM Packages

1. First, update the repositories:


sudo apt update

2. Then, install essential KVM packages with the following command:

sudo apt install qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils

A little explanation of the above packages.

 The qemu package (quick emulator) is an application that allows you to perform
hardware virtualization.
 The qemu-kvm package is the main KVM package.
 The libvritd-daemon is the virtualization daemon.
 The bridge-utils package helps you create a bridge connection to allow other
users to access a virtual machine other than the host system.
 The virt-manager is an application for managing virtual machines through a
graphical user interface.

This will start the installation of four KVM packages:

3. When prompted, type Y, press ENTER, and wait for the installation to finish.

Step 3: Authorize Users

1. Only members of the libvirt and kvm user groups can run virtual machines. Add a
user to the libvirt group by typing:

sudo adduser ‘username’ libvirt

Replace username with the actual username.


2. Now do the same for the kvm group:

sudo adduser ‘[username]’ kvm

Note: If you need to remove a user from the libvirt or kvm group, just
replace adduser with deluser in the command above.

Step 4: Verify the Installation

1. Confirm the installation was successful by using the virsh command:

virsh list --all

You can expect an output as seen below:

2. Or use the systemctl command to check the status of libvirtd:

sudo systemctl status libvirtd

If everything is functioning properly, the output returns an active (running) status.


3. Press Q to quit the status screen.

4. If the virtualization daemon is not active, activate it with the following command:

sudo systemctl enable --now libvirtd

Creating a Virtual Machine on Ubuntu 20.04

1. Before you choose one of the two methods listed below, install virt-manager, a tool for
creating and managing VMs:

sudo apt install virt-manager

2. Type Y and press ENTER. Wait for the installation to finish.

Make sure you download an ISO containing the OS you wish to install on a VM and
proceed to pick an installation method.
Method 1: Virt Manager GUI

1. Start virt-manager with:

sudo virt-manager

2. In the first window, click the computer icon in the upper


upper-left corner.

3. In the dialogue box that opens, select the option to install the VM using an ISO image.
Then click forward.

4. In the next dialogue, click Browse Local and navigate to the path where you stored the
ISO you wish to install.
5. The ISO you chose in the previous window populates the field in Step 2. Proceed to
Step 3 by clicking forward.

6. Enter the amount of RAM and the number of CPUs you wish to allocate to the VM and
proceed to the next step.
7. Allocate hard disk space to the VM. Click Forward to go to the last step.

8. Specify the name for your VM and click Finish to complete the setup.
9. The VM starts automatically, prompting you to start installing the OS that’s on the ISO
file.

Method 2: Using Command Line

Use the virt-install command to create a VM via Linux terminal. The syntax is:

virt-install --option1=value --option2=value ...

In the following example, virt-install is used to install Fedora 33 Workstation.


Options behind the command serve to define the parameters of the installation.

Option Description

--name The name you give to the VM

--
A short description of the VM
description

--ram The amount of RAM you wish to allocate to the VM

--vcpus The number of virtual CPUs you wish to allocate to the VM

The location of the VM on your disk (if you specify a qcow2 disk file that does not
--disk
exist, it will be automatically created)

--cdrom The location of the ISO file you downloaded

--graphics Specifies the display type

RESULT:

Thus, the Kernel based Virtual Machine was successfully created in Linux OS.
Ex No: 7 Date:

7. Create Nested Virtual Machine (VM under another VM)


AIM:
To Create Nested Virtual Machine (VM under another VM) in Kernel based Virtual
Machine.

DEFINITION:
Nested virtualization allows you to run a virtual machine (VM) inside another
VM while still using hardware acceleration from the host.

PROCEDURE:

i) Enable Nested Virtualization in KVM

Step 1: Checking if nested virtualization is supported

For Intel processors, check the /sys/module/kvm_intel/parameters/nested file. For AMD


processors, check the /sys/module/kvm_amd/parameters/nested file. If you see 1 or Y,
nested virtualization is supported; if you see 0 or N, nested virtualization is not
supported.

For example:

cat /sys/module/kvm_intel/parameters/nested
Y

Step 2: Enabling nested virtualization

To enable nested virtualization for Intel processors:

1. Shut down all running VMs and unload the kvm_probe module:

sudo modprobe -r kvm_intel

2. Activate the nesting feature:

sudo modprobe kvm_intel nested=1

3. Nested virtualization is enabled until the host is rebooted. To enable it


permanently, add the following line to the /etc/modprobe.d/kvm.conf file:

options kvm_intel nested=1


To enable nested virtualization for AMD processors:

1. Shut down all running VMs and unload the kvm_amd module:

sudo modprobe -r kvm_amd

2. Activate the nesting feature:

sudo modprobe kvm_amd nested=1

3. Nested virtualization is enabled until the host is rebooted. To enable it


permanently, add the following line to the /etc/modprobe.d/kvm.conf file:

options kvm_amd nested=1

Step 3: Configuring nested virtualization in virt-manager

Configure your VM to use nested virtualization:

1. Open virt-manager, double-click the VM in which you wish to enable nested


virtualization, and click the Show virtual hardware details icon.

2. Click CPUs in the side menu. In the Configuration section, there are two options -
either type host-passthrough in the Model: field, or select the Copy host CPU
configuration check box (that fills the host-model value in the Model field).

3. Click Apply.

Step 4: Testing nested virtualization

1. Start the virtual machine.

2. On the virtual machine, run:

sudo dnf group install virtualization

3. Verify that the virtual machine has virtualization correctly set up:

1. sudo virt-host-validate
2. QEMU: Checking for hardware virtualization : PASS
3. QEMU: Checking if device /dev/kvm exists : PASS
4. QEMU: Checking if device /dev/kvm is accessible : PASS
5. QEMU: Checking if device /dev/vhost-net exists : PASS
6. QEMU: Checking if device /dev/net/tun exists : PASS
...
ii) Enable Nested Virtualization Feature for VirtualBox VM from GUI

Step 1: Open VirtualBox manager either from Dash or Menu. Click on the VM in which
you wanted to enabled the nested feature and then select "Settings".

Step 2: Go to "System -> Processor" and click the "Enable Nested VT-x/AMD-V" check
box. Click OK to save the changes.

From now on this VM will act as a hypervisor, so that you can run VMs inside it.

Nested VT feature is available on host systems that run AMD and Intel CPUs. However,
for Intel CPUs, the option is grayed out. So, you can't directly enable it from Virtualbox
manager.
Step 3: Verify If Nested Virtualization Is Enabled For VMs

Start the VM in which you just enabled the nested feature.

Log in to the VM and run the following command to check if nested feature is enabled or
not:

$ egrep --color -i "svm|vmx" /proc/cpuinfo

Verify if nested virtualization is enabled in virtualbox VM

If we see “vmx” (Intel-VT technology) or “svm” (AMD-V support) in the output, the
virtualbox guest machine can work as a hypervisor and host VMs. As you can see in the
above output, Ubuntu 20.04 VM supports virtualization.

RESULT:

Thus, the Nested Virtual Machine (VM under another VM) in Kernel based Virtual
Machine was successfully created.

You might also like