29 Aug 2014

How to install and configure Hyper-V on a Windows Server 2012 machine

Leave a Comment
Hyper-V installation
In today's article I will show you how to install and configure Hyper-V Server Role on a Windows Server 2012. Note that for this tutorial I will be using a Virtual Machine hosted on VMware. We've had a short introduction to Hyper-V in a past article and I think it's better if you read it before proceeding with this post.

Because Hyper-V ships as an inbuilt role into Windows Server 2012, it can easily installed using the Server Manger Console. Once you've opened the console, navigate to the Roles section and select Hyper-V from the list. Hyper-V Module for Powershell and Hyper-V GUI Management Tools features will be added during the installation process.
Hyper-V tutorial
The wizard prompts you to create a new virtual switch. This is a virtual device that binds to your physical interface and allows your Server to communicate with the rest of the network. From the available menu choose the interface used for this Hyper-V Server.

Hyper-V live migrationServer live migration can be enabled in the following section. For now, it's best not to enable this feature because this is a testing environment and we will not interact with this feature.
Hyper-V installation
We'll need to specify the location for our virtual hard disk and configuration files. It's best that you keep these files in separate folders this way you isolate any problem that may occur. I will leave the default locations and proceed with the Installation. You will need to be patience for a short period of time until the wizard is completed. Note that you will need to reboot the Server once the wizard is finished.

Hyper-V training
You can now open Hyper-V Manager console from Administrative Tools. Open Hyper-V Settings by right clicking on your Hyper-V mode. There are many configurable sections in this menu and you will need to access them when customizing your System. From this section you can configure the following: Virtual Hard Disks and Virtual Machines location, Physical GPU Settings, NUMA Spanning to allow non-uniform memory spanning, Live and Storage Migrations, Enhanced Session Mode Policy, Replica Configuration and User settings. Each option has a short description that will make you understand its basic role within Hyper-V. I like this menu because it's pretty intuitive and allows you to configure Hyper-V pretty easy:

Hyper-V Settings

Using the Hyper-V Manager Console we can also Create, Edit or Inspect Virtual Disks. I will show you how to deploy a new Virtual Machine with Hyper-V in a future article and we will see how to edit a virtual disk. From the upper menu in the Action section you can see all available actions:
Hyper-V console

In the Virtual Switch Manager we can add virtual network devices which can be used within our virtualization infrastructure. If you are familiar with other virtualization products then this section may sound familiar. Hyper-V offers three types of virtual network switch, as follows:
  • external - this virtual device binds to the physical network adapter. Used to allow connectivity between VMs and physical network
  • internal - can be used only between the physical server and its Virtual Machines. No external access can be provided using this network switch
  • private - can be used only between Virtual Machines that are part of the same Hyper-V server.
Virtual Switch Manager

You can create one external virtual switch per physical interface but, you can create unlimited internal or private virtual switch. Once the virtual devices have been added in your Hyper-V Server, they can be configured just as physical interfaces from Control Panel\Network and Internet\Network Connections
Hyper-V Virtual Switch

You can configure virtual devices just as physical interfaces, you should already be familiar with this operation:
Hyper-V Virtual devices

On the Virtual SAN Manager page, you can create virtual Fibre Channels for your SAN (Storage Area Network). I haven't got the oportunity to work with this feature since I don't have a testing storage device.

The Windows Service that manages Hyper-V is Hyper-V Virtual Machine Management and you can view its status using the Services Console or by using Server Manager in the Hyper-V section. Note that if this service crashes or is stopped, all Hyper-V dependencies and the whole virtualization platform will not work:
Hyper-V Service

Hyper-V offers a lot of features that can be used within your virtual environment and we haven't covered all aspects about this technology. This article should at least offer your some basic information on how to install and configure Hyper-V. In the next tutorial I will show you how to create a new VM using Hyper-V and we will later see how to use these machines to deploy new Windows Servers using WDS. Please use my comments section to post questions regarding this topic or if you think there are things that were not covered properly. Wish you all the best and don't forget to enjoy your day!
Read More
13 Aug 2014

How to create a persistent network configuration on a Linux machine

Leave a Comment
In this article I will show you how to configure a persistent network configuration on your Linux machine. Note that you will need to edit the network adapter configuration file. If you choose to configure your server using other methods (DHCP or bash commands), the network parameters will not persist upon reboot. You can also add those commands in one of the initialization files but, I prefer editing the network adapter configuration file directly.
The location of the network configuration file may differ from one Linux distribution to another. For the following example I will be using two virtual machines running CentOS named VM2 and VM3. The network configuration file on a CentOS Server, can be found in /etc/sysconfig/network-scripts/ifcfg-eth0. If you are using a machine with multiple interfaces, there will be several confg files in the same location so make sure to edit the right file. 
If you have downloaded the OS image from http://www.centos.org/, your Server will be configured to obtain it's IP configuration from a DHCP Server this is why, the following lines would normally appear:
DEVICE=eth0 
BOOTPROTO=dhcp 
ONBOOT=no
  • DEVICE=interface_name; - physical interface name
  • BOOTPROTO=protocol; - protocol used to obtain IP configuration

            the specified protocol can be one of the following:
                 none — no boot-time protocol will be used
                 bootp — BOOTP protocol will be used. 
                 dhcp — DHCP protocol will be used.
  • ONBOOT=yes/no - will enable the interface upon reboot.
I've opened the ifcfg-eth0 on VM2 using a text editor. You will need to add the following lines on your CentOS machine:
DEVICE=eth0
HWADDR=00:0C:29:A2:36:CD
TYPE=Ethernet
UUID=58fd1273-f989-4cd6-bf67-8e7fec7bd1a2
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
IPADDR=10.10.1.10
NETMASK=255.255.255.0
NETWORK=10.10.1.0
GATEWAY=10.10.1.1

Note that the HWADDR,TYPE,UUID and NM_CONTROLLED parameters are configured automatically by the System so, you will not need to worry about those. I've added the IP Address, Network Mask, Gateway and Network Address parameters. 
This is how your configuration file should look like:
Linux static IP configuration

Now we will make similar configurations on the second Server:
How to create persistent network configuration

The only thing left to do is to restart the network service on both Servers. To achieve this result, you must run the following command: service network restart
Linux service command

There are several ways to test the network connectivity between these two servers but, one of the most common methods is by using the ping command:
Linux ping command

Now it's time to test our persistent configuration by rebooting both machines. Simply type reboot on each server:
Linux reboot command

For verifying your IP configuration use ifconfig or ip addr show commands. Note that you can configure a static IP address using these two commands but, these will not persist upon reboot. The ouput of these commands are as follows:
                                          ifconfig
Linux Ifconfig command

                                          ip addr show
Linux IP command

As you can see these commands have similar output so choose whatever method you desire. For verifying the default gateway, use the route command:
Linux route command

That's it for this article folks, I hope you've understood how to configure a persistent IP configuration on your Linux machine. Note that I'm still in the process of learning Linux this is why there may be things that I cannot explain yet. Please feel free to post any question related on this topic and I will try to respond as soon as possible. Wish you all the best and stay tuned for the following articles from IT training day.
Read More
7 Aug 2014

Hyper-V Virtual Machine validation error

Leave a Comment
Hello folks,
Hyper-V Virtual Machine validation error
I want to show you how to fix an Hyper-V validation error that may occur when Installing this Server Role on a Virtual Machine. I've stumbled upon this error when trying to install and configure Hyper-V on a VMware Server and after searching for a while I've discovered the solution for this problem. The wizard displayed the following error "Hyper-V cannot be installed: A hypervisor is already running" when using Server Manager Console:


Virtual Machine configuration file
The first thing you must do is to shutdown the virtual machine because we need to modify its configuration file. Open Powershell and type shutdown /s /t 0 to turn off the Server immediately. Navigate to the VM's location and open the *.vmx file using your favorite text editor: 

At the end of the file we'll need to add the following lines:
hypervisor.cpuid.v0 = “FALSE” - informs the OS that is being hosted on a Virtual Machine. The Hyper-V Installation will verify if the Server runs of a Virtual Machine so this setting must be added
Hyper-V installation problem
mce.enable = “TRUE” - enables Machine Check Exception (MCE) which is used to detect CPU hardware errors. You can read more about MCE on Wikipedia.

vhu.enable = “TRUE” - enables Nested virtualization
Once the lines have been added, save and close the file

There is one more thing we need to configure. Open the VM's Settings page, navigate to the Processors section and enable the following features:

Virtualize Intel VT-x/EPT or AMD-V/RVI.
Virtualize CPU Performance counters.

Fixing Hyper-V Virtual Machine problem

Once you power on your Server, you should be able to install Hyper-V without problems. Hope this article will serve you well in fixing this Hyper-V installation eror. Wish you all the best and stay tuned for the following articles.
Read More
30 Jul 2014

Introduction to Hyper-V

Leave a Comment
Hyper-V tutorial

This article will serve as an introduction to Hyper-V and its main features. First of all what is Hyper-V and what are the elements that are part of this technology? Hyper-V is Microsoft's virtualization tool which allows you to build Virtual Machines on both X32 and X64 architectures. Unlike its predecessor (Virtual Sever 2005), Hyper-V is built directly in the OS and can be installed as any other Server Role by using the Manager Console. Several features were added into this tool to allow Sysadmins to optimize their VMs and the overall network performance: 
  • Using Virtual Machines within your network you reduce the hosting costs for your infrastructure. By creating multiple Servers for hosting VMs you consolidate the whole hardware performance and provide an efficient way to allocate resources to your machines. Imagine that when implementing DNS, IIS or DHCP Servers you would rather create individual Virtual Machines that use the same hardware resources than installing and configuring physical Servers for each Server Role. 
  • Reliability is one important component of Hyper-V because you can create Server clusters for hosting your Virtual Machines. This technology allows you to limit downtime caused by hardware failures because resources are automatically allocated to the remaining machines. Further more, you can use hot swappable components (RAM, CPU and Hard drives) to ensure that your Systems can be easily repaired.
  • By allocating resources for each machine based on their necessities, you can increase the hardware capacity of Systems that need higher performance. The process of increasing/decreasing hardware specifications of a Virtual Machines becomes really fast and easy.
  • If needed, you can easily deploy multiple Virtual Machines and the process of decommissioning them becomes much faster rather than using physical Servers.
  • Using backup technologies (like shadow copies) and snapshots you can ensure that data is saved in case of hardware or network failures. Snapshots allows you to backup a Server anytime and offers a fast way to rollback a machine when problems are encountered. Hyper-V can store multiple snapshots for each VM so you can restore multiple versions of the same Server.
  • Virtual Machines can be easily moved from one host to another if needed so, in terms of portability, this technology offers huge advantages than physical machines. 
   Of course you need to take into consideration the Virtual Machine's purpose and hardware necessities. Because Virtual Machines use shared resources, a machine which requires high CPU, memory and disk performance is not suited for virtualization. Database Servers are usually not deployed within virtualized environments and instead physical Servers are used to satisfy their requirements. A physical Server will always perform better than a Virtual Machine with the same hardware specifications this is why planning is really important when deciding to go for virtualized environments.
   There are several ways to move your physical machine after deciding to migrate your infrastructure to Hyper-V. You can either install and configure new Virtual Machines for each Server or virtualize the existing physical Servers. Microsoft provides tools to virtualize physical Servers such as System Center Virtual Machine Manager and VSMT (Virtual Server Migration Tool). The difference between these two solutions is that the first one supports the management of large numbers of Servers and it's fully integrated into Powershell while the second one is mostly used when there is a small number of Servers that need to be virtualized.
Note that all virtualized Servers need to have a valid Microsoft Server License so, you'll need to ensure you have the right number of licenses.
That's about it for this introductory article, we will continue discussing about Hyper-V in future posts and you will discover more interesting things about this awesome technology. I will show you how to install and configure Hyper-V and how to deploy Virtual Machines within your network. Please share your thoughts about this article and don't forget to share it to others. Wish you a great day!
Read More
25 Jul 2014

Links and metacharacters in Linux

Leave a Comment
Links and meta characters in Linux   We will continue our Linux journey by talking about two important components of the File System:
links (soft and hard links) 
metacharacters
This would be an important step to further understand how this OS works and what are the main concepts behind its functionality. I will try as best as I can to explain these two concepts so please post a comment if you think that things were not described properly.
   Besides the actual data contained in each file within the File System, the Operating System will also store specific information for each one. Files are described by multiple attributes and we've seen some of them when we've learned about the ls -la command in this article. Attributes like file type, group and user ID, file permissions, file size, last modification date, creation date, etc, must be stored somewhere in the File System. In Linux, all this information is stored within inodes (Index-nodes). An inode will keep all data regarding a particular file except its name and each one will be identified by a unique number. They also store a list with all data blocks that are part of the same file and where is each block located on the hard disk. We will later see how you can view and interact with inodes. Basically, for every file there will be an associated inode allocated.

   A Linux partition is composed of several elements. In the following section I will try to explain the role of each component:
boot block - the location of the boot loader. We've described the Linux bootloader in a previous article.
super block - contains information like number of data blocks, mount-points, File system type, Size, Status, Information about other metadata structures, etc.
inode list - the list of inodes contained by a partition. Note that this is a finite number.
data blocks - this is where file content is stored. A file can contain one ore more data blocks and inodes are the ones who store the information about where is each data block located.

   In Linux, one file can be seen in multiple locations without multiplying its content. Practically, you can view the same resource in multiple locations but, all will have the same source file. This feature is handled in Linux using links. When talking about links in the UNIX/Linux Systems, we'll need to specify the two concepts behind this technology:

soft link also known as symbolic link - it's a redirection from one file to another. They have similar functionality as Windows shortcuts. To create a new symbolic link you'll need to use the following command:
ln -s existing_file new_file
This command will create a new "shortcut" to the file that already exists in the File System.
hard link - an association between file name and inode. As we've talked previously, the name information is not stored in the inode but, instead it's located in the directory which contains the file. If you want to create a new hard link for an existing file you'll need to use the following command: 
ln existing_file new_file
The command will basically create a new association which will contain another name and the existing inode.
To view the number of hard links for a file you can use the ls -l command (we've talked about this in a previous article)

Metacharacters are mainly used for filtering the output of a command. By parsing information before manipulating a command's result, offers System Administrators a powerful way to manipulate data within the File System. You will see that there are special characters reserved in the OS which have a distinct functionality and can often be used to simplify administrative operations. Regex (regular expressions) are build using metacharacters so, this part may sound familiar. I will try to explain the role of each metacharacter within the OS, please add more if you think are relevant on this topic:

> Used to redirect the output of a command to file. If the file does not exist, it will create a new one, if the file already exists its content will be replaced
>> Redirects the output of a command but, unlike the > character, it will append the new results to an existing file.
< used to redirect input
* wildcard used to substitute 0 or more characters. Example ls -al f* will output any file which begins with f
wildcard used to substitute only one character. Example: ls -al f??e will output any file that starts with "f", contains any two characters and then ends with "e"
[ ] will substitute any character between brackets. Example: ls -al f[iad]e will output fie fae fde
^ any other character except the ones indicated when used between []. Example: ls -al f[^a-c]e will not output fae, fbe ,fce
; used to separate multiple commands that are written on the same line
Predefined metacharacter class:
[[:alnum:]] - alphanumeric characters
[[:alpha:]] - alphabetic characters
[[:blank:]] - SPACE or TAB keys
[[:digit:]] - numeric characters
[[:upper:]] - upper letters
[[:lower:]] - lower letters
|| OR conditional execution
&& AND conditional execution
# used to specify comments within files
\ if you use this character in front of any other metacharacter, the output will use that particular symbol and not its special functionality. Example: 300\$ = 300$
. filters one character. Example d.g = dog, dag, deg
"$    preceeds the name of a variable to be expanded.
The variables are either assigned using  "="  or are one of the pre-defined variables (which cannot be assigned to):
$0  name of the shell or the shell script being executed.
$# number of the positional parameters to the command
$1  the value of the first positional parameter passed to the command. $2 is the second positional parameter passed to the command. etc. up to $9.
$*    expands to all positional parameters passed to the command
$@   expands to all positional parameters passed to the command, but individually quoted when "$@" is used. " from About.com
I've found this interesting article which describes regular expressions and metacharacters you can read it to discover more information on this topic. You can also use man bash command to discover more things about metacharacters.
That's about it for this article folks, please share your thoughts about it and don't forget to share it to others. Enjoy this wonderful day and stay tuned for the following articles from IT training day.
Read More
© 2014 All Rights Reserved.
IT training day & Powered By BloggerHero