Prepare your lab using Virtual Box

When I was preparing for my first certification exam, I learned that hands-on experience is key to achieve your goals in IT. Practice make the master and make labs with real life examples is the funniest part of the learning process.

In this post, I will walk you through VirtualBox, which has been my default virtualization tool for several years. From my own experience, if are looking to pass an exam, you should have a good laptop/desktop able to at least open two virtual machines at the same to test client-server applications. In my case, I am using a Dell laptop i7 with 8GB of ram and 1TB of hard disk. I believe these specs are perfect for practicing and make your own labs, I have been able to run three virtual machines at the same time and still get a good performance from the laptop itself and from the VMS.

On the other hand, Linux is quite light and it can be handled with very little ram, and even more if the OS doesn’t have any GUI installed Ubuntu server or CentOS server, so you could even run more virtual machines with less ram if you play well your cards.

Requirements:

In order to virtualize the BIOS must have the virtualization option enabled, otherwise when you install VirtualBox you won’t be able to install a virtual machine on 64 bits, to enable this for your PC model, you need access the BIOS and enable the virtualization option, if you are buying a laptop make sure it does has virtualization capabilities.

Recommended: 8GB or more ram memory (it could be done with less but, my experience with this amount has been quite good)

Recommended: Processor even the more basic i7 or even i5, I think laptop using i3 processor are not built to virtualize.

Recommended: 250GB on hard disk also depending on how many virtual machines are going to install.

Getting started

1. From this link you can download the latest version of VirtualBox and install it on your computer, good news if 100% free: https://www.virtualbox.org/wiki/Downloads

2. After installing it, You will see a console similar than the one below, from here you can monitor and manage your virtual machines:

console

3. To install centOS on a virtual machine, you firstly need to download the ISO from this link:

http://isoredirect.centos.org/centos/7/isos/x86_64/CentOS-7-x86_64-DVD-1611.iso

The called “DVD ISO” from the list you can download the closest to you for a faster download.

4. After download, click “new” to create new virtual machine:

5. Select the name of the virtual machine and type of OS from the list.

Memory size

You need to select what size do you want to assign for each VM (VM = virtual machine), remember the size given here are provisioned from your physical memory and it will be used only when the machine is on.

As you can see in the screenshot above I usually select around 3gb of ram and which Linux and Windows (desktop) this is an acceptable amount of memory.

Note: this can be modified at any stage after the machine is created.

Creating the virtual disk

From this page, you will be able to create a new disk or select an existing, usually the option to select disk existing disk is used to migrate one virtual machine from one place to another so it will use the same HD in another location.

disk

In the type of disk, we have several options to choose from, below are most used virtual disk format in the market:

VDI = VirtualBox Disk Image

VMDK = Virtual Machine Disk (usually used by WMware)

VHD = Virtual Hard disk (usually used by Windows)

You can select the virtual disk type, depending on what application are you planning to use your virtual machines. In my case, as I am only will use this virtual machine with Virtual Box I chose VDI.

type-of-disk

Storage on the physical disk

As along as you start to use virtualization tools you start to realize the type of storages available, as the screenshot above explained, there are two types of ways to storage data on disk, dynamic or static.

Dynamic: It will allocate the data of the virtual machine, that include OS, applications installed and etc but it won’t occupy free space on your laptop if doesn’t need it.

Example:

The virtual machine has 30GB of dynamic storage, but it has 20GB of free space.
The space occupied in the physical disk will be 10GB as the data actually occupied.
If the space of the virtual machine increase, this will be provisioned dynamically.

Static: The virtual machine will occupy all the space in your laptop even the empty spaces.

For testing purpose, I always use dynamic because I rather using storage on demand.

Hard disk size

This has happened to me, I allocated very little storage space to the VM and then I have to recreate the whole thing losing all my work.

Recommendation: Assign a good amount of space (dynamic space) to the disk so you won’t suffer as I did. I would say that 40 or 35 suffices for a lab environment, but you can add as much as you want.

Networking

Another important task of the virtualization process is to select the networking strategy, it took me some time to figure it out what each of them does and how can I take advantage of each of them.

They are few types of networking setups for VMs and I’ll go through the most used and how can be useful for you.

 

nat

NAT: It gives you access to a private IP address within the range of 10.0.2.x, this IP grants you internet access but is unable to communicate with other virtual machines.

Bridge: This one is like to have a real computer connected to your wireless or LAN network.

Example: Let’s say we get the IP address 192.168.1.3 from our DHCP.

If one of the network cards from my virtual machine are setup in bridge mode, this one will get an IP address similar than the one above e.g: 192.168.1.5, This will allows communication between the virtual machine and any device connected to your network.

This mode is usually used in production environment.

Internal network: This one will be a network created by you where you have to manually setup who has access and who don’t, please bear in mind if you want your machine to communicate with each other you need to use the same IP range and subnet mask.

E.g: By default, the internal network name is “intnet” we should keep the same name to connect both VMs and avoid confusion. So once we activate the network card we have to manually setup a range where they can see each other, lets say:

VM1 = 192.168.1.20 / 255.255.255.0 / No need gateway address
VM2 = 192.168.1.10 / 255.255.255.0 / No need gateway address

After making this change in both virtual machines, they should be able to see each other and communicate.

Note: My ISP router has some issues to handle bridge mode so I usually use NAT for internet connection and then I create separate network card using “internal network mode” to make the connection between the virtual machines. In my opinion, this is the safest way to use the virtual machine if you have the same issues than me.

Also remember if you are messing around with NAT and filtering, proxies etc if you are not sure what you are doing, you can mess up your home network and getting few shouts from your girlfriend like me :).

I hope you like it…

See you in the next post

Ops4life!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s