Tải bản đầy đủ (.pdf) (391 trang)

understanding hyperv in windows server 2012

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (23.56 MB, 391 trang )

Hands-on Guide:

Understanding 
Hyper-V 
in Windows Server 2012

Brien Posey

Pete Zerger, Chris Henley


Understanding Hyper-V in Windows Server 2012

Contents
Chapter 1. An Introduction to Hyper-V 3.0
Chapter 2. Failover Clustering

3
30

Chapter 3. Migrations84
Chapter 4. Managing Virtual Machine Failover

123

Chapter 5. PowerShell Management

144

Chapter 6. Virtual Machine Management


181

Chapter 7. P2V Conversions

222

Chapter 8. Replication246
Chapter 9. Hyper-V Management

273

Chapter 10. Networking293
Chapter 11. Backing up Hyper-V

317

Chapter 12. Automation and Orchestration

336

Share this e-book with your peers

2


Understanding Hyper-V in Windows Server 2012

Chapter 1

An Introduction

to Hyper-V 3.0
This chapter is designed to get you started quickly with
Hyper-V 3.0. It starts with a discussion of the hardware
requirements for Hyper-V 3.0 and then explains a basic
Hyper-V–deployment followed by an upgrade from
Hyper-V 2.0 to Hyper-V 3.0. The chapter concludes with
a demonstration of migrating virtual machines from
Hyper-V 2.0 to Hyper-V 3.0

3


Understanding Hyper-V in Windows Server 2012

Hyper-V 3.0 flavors
Before we get started, it is worth noting that like its predecessors, Hyper-V
3.0 comes in two different flavors. Microsoft offers a standalone version
of Hyper-V, or you can operate Hyper-V as a server role on top of Windows
Server 2012. This book deals with Hyper-V exclusively as a server role.

Hardware requirements
According to Microsoft, the minimum hardware required for deploying
Windows Server 2012 includes:
• A 64-bit processor operating at 1.4 GHz or higher
• 512 MB of RAM
• 32 GB of hard disk space
• A DVD Drive
• A monitor and video card with a minimum display resolution of 800 x 600
• Keyboard and mouse (or other compatible pointing device)
• Internet access

Because Hyper-V is designed to use the server’s hardware to host a number
of virtual machines, the minimum system requirements are not suitable
for Hyper-V. Specifically, you will need more memory and hard disk space,
and it’s advisable to have a server with multiple sockets and/or multiple CPU
cores. The servers used in the development of this book were equipped with
the following:
• An 8-core, 64-bit CPU
• 32 GB of RAM
• A 500-GB hard drive used to store the host operating system.
• Four 1-TB hard drives configured as a RAID 5 array
In addition to the hardware requirements listed above, the CPU must support
hardware-level virtualization. It is worth noting that virtualization has been
disabled by default on many servers, so you may need to enable virtualization
through the system BIOS, as shown in Figure 1.1. If your server’s BIOS contains
a setting for Data Execution Prevention (DEP), you will need to enable that
setting as well.

4


Understanding Hyper-V in Windows Server 2012

Figure 1.1

You may need to manually enable virtualization in the server’s BIOS.

Installing Windows Server 2012
and Hyper-V 3.0
Setting up a clean installation of Windows Server 2012 and Hyper-V 3.0 is
relatively simple and straightforward. First, install Windows Server 2012 by

completing these steps:
1. Boot your server from the Windows Server 2012 installation media.
2. When the Windows Server 2012 splash screen launches, verify that
the language, time and currency format, and keyboard or input methods
are correct (Figure 1.2).
Figure 1.2

Verify your installation preferences.

5


Understanding Hyper-V in Windows Server 2012

3. Click Next.
4. Click Install Now (Figure 1.3).
Figure 1.3

Click Install Now.

5. Choose the operating system that you want to install (Figure 1.4). It is
worth noting that a default Windows Server 2012 does not include
the GUI. If you want to use the GUI then do not choose the Server
Core option. Although Server Core is Microsoft’s preferred method
for deploying Windows Server 2012, it is easier to manage Hyper-V
through a GUI. Therefore, the instructions found throughout this book
will assume that you are using the GUI. If you are interested in Server Core
deployments, see Chapter 5 for a discussion about managing Hyper-V
through Windows PowerShell.
Figure 1.4


Choose the edition of Windows Server 2012 that you want to install.

6


Understanding Hyper-V in Windows Server 2012

6. Accept the license agreement and click Next (Figure 1.5).
Figure 1.5

You must accept Microsoft’s license agreement.

7. When prompted for the type of installation you want to perform, choose
the option for Custom: Install Windows Only (advanced) (Figure 1.6).
Figure 1.6

Choose the option to perform a custom installation.

8. Choose the volume on which you want to install Windows and click Next
(Figure 1.7).

7


Understanding Hyper-V in Windows Server 2012

Figure 1.7

Select the drive or volume on which you want to install Windows Server 2012.


9. Setup will now begin the installation process (Figure 1.8). After
the Windows installation completes , you must work through a separate
process to install Hyper-V.
Figure 1.8

The installation process will now begin.

Deploying Hyper-V 3.0
After Windows Server 2012 is up and running, the next step is to install
the Hyper-V role. To do so, follow these steps:
1. Open the Server Manager if it is not already open.
2. Choose the Add Roles and Features command from the Manage menu
(Figure 1.9).

8


Understanding Hyper-V in Windows Server 2012

Figure 1.9

Choose the Add Roles and Features command.

3. When the Add Roles and Features Wizard launches, click Next to bypass
the wizard’s Welcome screen.
4. Click Next.
5. Choose the Role-Based or Feature-Based Installation option (Figure 1.10).
Figure 1.10


Choose the Role Based or Feature Based Installation option.

6. Click Next.
7. On the Server Selection screen, make sure that the local server is selected
and click Next (Figure 1.11).

9


Understanding Hyper-V in Windows Server 2012

Figure 1.11

Make sure that your local server is selected.

8. Select Hyper-V from the list of server roles (Figure 1.12).
Figure 1.12

Select the Hyper-V role.

9. If you are prompted to install additional features, click the Add
Features button.
10.Click Next.

10


Understanding Hyper-V in Windows Server 2012

11.When the wizard displays the list of available features, click Next.

12.Click Next on the Hyper-V introductory screen.
13.Select the network adapters that you want to make available to your
virtual machines. Be sure to reserve at least one network adapter for host
management traffic (Figure 1.13).
Figure 1.13

Be sure to reserve a network adapter for host management traffic.

14.Click Next.
15.At this point you will see a screen asking if you want to allow the server to
send and receive live migrations of virtual machines. Live migrations are
discussed in Chapter 3, so for now just click Next to accept the defaults.
16.When prompted, click Next to accept the default stores.
17.When the Confirmation screen is displayed, click the Install button.

Post deployment tasks
After the installation process completes, you may need to perform a number of
post-deployment tasks, which might include:

• Configure the host’s IP address
• Rename the host
• Join the host to a domain
The sections that follow will walk you through performing each of these tasks.

11


Understanding Hyper-V in Windows Server 2012

Configure the host’s IP address

In most cases, Hyper-V host servers need to have at least one NIC that is
dedicated to hosting management traffic. As a best practice, you should assign
a static IP address to this NIC. You can assign an IP address to the server’s
management NIC as follows:
1. Move the mouse to the lower left corner of the screen and right click.
Choose the Control Panel option from the right-click menu.
2. When the Control Panel appears, click on Network and Internet.
3. Click on Network and Sharing Center.
4. Click on the Change Adapter Settings link.
5. Right click on the icon representing your management NIC and choose
the Properties command from the shortcut menu.
6. Assuming that IPv4 is being used, select the Internet Protocol Version 4
(TCP/IPv4) option and click the Properties button (Figure 1.14).
7. Enter the IP address that you want to assign to the NIC and click OK
(Figure 1.15).
Figure 1.14

Select Internet Protocol Version 4 (TCP/IPv4) and click the Properties button.

12


Understanding Hyper-V in Windows Server 2012

Figure 1.15

Provision your management NIC with a static IP address and click OK.

Rename the host
Windows Server 2012 automatically assigns a unique host name to each server,

but it is generally advisable to assign a more meaningful name to each Hyper-V
host. Doing so will make the host management process easier. To assign a new
name to your Hyper-V host server, follow these steps:
1. M
ove the mouse to the lower left corner of the screen and right click.
Choose the System option from the right-click menu.
2. When the System properties sheet appears, click on the Change Settings
link (Figure 1.16).

13


Understanding Hyper-V in Windows Server 2012

Figure 1.16

Click the Change Settings link.

3. Verify that the Computer Name tab is selected and then click the Change
button (Figure 1.17).
Figure 1.17

Click the Change button.

14


Understanding Hyper-V in Windows Server 2012

4. Enter a new name for the server and click OK (Figure 1.18).

Figure 1.18

Enter a new computer name and click OK.

5. Click OK to acknowledge the message indicating that you must restart
your computer to apply the new name.
6. Click Close.
7. When prompted, click Restart Now (Figure 1.19).
Figure 1.19

You must restart the server before your changes will take effect.

15


Understanding Hyper-V in Windows Server 2012

Join the host to a domain
The process of joining a Windows Server 2012 host to a domain is very similar
to that used in joining a Windows Server 2008 R2 host to a domain. To join
a domain, follow these steps:
1. From the Metro interface, click the Desktop tile.
2. Move your mouse to the lower left corner of the screen and right-click on
the Start tile.
3. Click on the System option on the right-click menu.
4. When the System dialog box appears, click on the Change Settings link
(Figure 1.16).
5. When the System Properties sheet appears, go to the Computer Name
tab and click the Change button (Figure 1.17).
6. Select the Domain option and enter the fully qualified domain name

(Figure 1.18).
7. Click OK.
8. When prompted, enter a set of administrative credentials for the domain.
9. Click OK to clear the message indicating that the computer has been
joined to a domain.
10.Reboot the server (Figure 1.19).

Performing an in-place upgrade from
Hyper-V 2.0
If your organization is currently running Hyper-V 2.0, it is usually possible to
perform an in-place upgrade to Hyper-V 3.0. In preparation for an upgrading
a standalone Hyper-V 2.0 server, you must shut down any virtual machines that
are currently running. To complete the upgrade, follow these steps:
1. Shut down any virtual machines that are running on the server to be
upgraded. If any virtual machines are left running, the Compatibility
Report will prevent the upgrade from continuing (Figure 1.20).

16


Understanding Hyper-V in Windows Server 2012

Figure 1.20

You must shut down the virtual machines prior to beginning the upgrade.

2. With Windows Server 2008 R2 still running, insert your Windows Server
2012 installation media and run the Setup program.
3. When the Windows Server 2012 splash screen appears, click Install Now
(Figure 1.21).

Figure 1.21

Click the Install Now button.

4. When prompted, click on the option to go online to install updates
(Figure 1.22).

17


Understanding Hyper-V in Windows Server 2012

Figure 1.22

You should go online to get the latest updates.

5. Enter your product key and click Next.
6. Select whether you want to perform a server core deployment or a fullserver deployment that includes the GUI (Figure 1.23). It is worth
noting that Windows Server 2012 is designed to perform a server
core deployment by default. However, you cannot perform an in-place
upgrade of a full Windows Server deployment (with a GUI) to a server
core deployment. If you want a server core deployment, you will have to
upgrade to the full GUI version of Windows Server 2012 and then uninstall
the GUI later. The instructions provided in this book assume that you will
be working with a full GUI-based installation. If you are interested in using
Server Core, see Chapter 5 for a discussion of how to manage Hyper-V
from PowerShell.
Figure 1.23

Choose the edition of Windows Server 2012 that you want to install.


18


Understanding Hyper-V in Windows Server 2012

7. Click Next.
8. When prompted, accept the license agreement and click Next
(Figure 1.24).
Figure 1.24

You must accept Microsoft’s license agreement.

9. Choose the option to Upgrade: Install Windows and keep files, settings,
and applications (Figure 1.25).
Figure 1.25

Choose the option to upgrade the existing operating system.

10.Take a moment to review the Compatibility Report, which informs you
of issues you need to address prior to moving forward with the upgrade
(Figure 1.26). When you are finished, click Next.

19


Understanding Hyper-V in Windows Server 2012

Figure 1.26


Take a moment to read the compatibility report.

11.At this point, Windows will be installed. The remainder of the upgrade
process is automated.

Migrating virtual machines from Hyper-V
2.0 to Hyper-V 3.0
One of the big disadvantages to performing an in-place upgrade is that it can
cause virtual machines to be down for a significant amount of time. One way
to reduce the amount of time during which virtual machines are unavailable
is to perform a migration rather than an upgrade. A migration involves
deploying Hyper-V 3.0 onto new hardware while your existing hardware
continues to run Hyper-V 2.0. Once the deployment is complete, you can
migrate the individual virtual machines from the Hyper-V 2.0 deployment to
the Hyper-V 3.0 deployment.

Exporting the virtual machines
The first step in migrating virtual machines from Hyper-V 2 to Hyper-V 3 is to
export the virtual machines to either a network share or to removable media.
To complete the export process, follow these steps:
1. Open the Hyper-V Manager on the Hyper-V 2.0 Server.
2. Select the virtual machines that you want to export (Figure 1.27).

20


Understanding Hyper-V in Windows Server 2012

Figure 1.27


Select the virtual machines that you wish to export.

3. Click on the Export link.
4. Specify a path to write the exported content (Figure 1.28). Be sure to
choose a location with plenty of free storage space.
Figure 1.28

Enter an export path and click the Export button.

5. Click Export.
You can monitor the progress of the export by scrolling the Hyper-V Manager
to view the virtual machine Status (Figure 1.29).

21


Understanding Hyper-V in Windows Server 2012

Figure 1.29

You can monitor the export process through the Hyper-V Manager.

Importing virtual machines
Importing virtual machines into Hyper-V 3.0 is a relatively easy
and straightforward process. You can import one or more virtual machines
as follows:
1. Open the Hyper-V Manager.
2. Right-click on the name of the Hyper-V host and select the Import Virtual
Machine command from the right-click menu (Figure 1.30).
Figure 1.30


Right click-on your the server and select the Import Virtual Machine command from
the right‑click menu.

3. When the Import Virtual Machine wizard launches, click Next to bypass
the wizard’s Welcome screen.
4. Click the Browse button.

22


Understanding Hyper-V in Windows Server 2012

5. Navigate to the folder containing the virtual machine that you want to
import and click the Select Folder button.
6. Choose the virtual machine that you want to import (Figure 1.31).
Figure 1.31

Select the virtual machine that you want to import.

7. Click Next.
8. The next screen asks you to choose an import type (Figure 1.32). Unless
you have a compelling reason to choose one of the other options, it is
usually best to choose the option to Copy the Virtual Machine (Create
a New Unique ID). This allows the exported virtual machine to be
re‑imported later should the need ever arise.

23



Understanding Hyper-V in Windows Server 2012

Figure 1.32

Choose the appropriate import type.

9. Click Next.
10.The following screen asks if you want to store any of the virtual machine
components in a different location. Generally, it is safe to accept
the defaults. Click Next.
11.The wizard will now ask where you want to store the imported Virtual
Hard Disks. Select a folder on an appropriate volume and click Next.
12.Verify the summary information screen and click Finish (Figure 1.33).

24


Understanding Hyper-V in Windows Server 2012

Figure 1.33

The import process begins when you click Finish.

The import process can take a considerable amount of time to complete,
depending upon the size of the virtual machine and the speed of the hardware.
When the import process finishes, you should see the newly imported virtual
machine within the Hyper-V Manager.
Before you power-up the newly imported virtual machine, you need to connect
the virtual machine to a virtual switch. To do so, right click on the virtual
machine and choose the Settings command from the right-click menu. When

the Settings page appears, click on the Network Adapter option and then
connect the virtual machine to the appropriate virtual switch (Figure 1.34).
When you have finished, click OK.

25


×