Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 825203b

Browse files
committedMar 17, 2020
Manual steps for setting up nested virtualization in Azure Lab Services
1 parent dd77cfb commit 825203b

File tree

5 files changed

+237
-43
lines changed

5 files changed

+237
-43
lines changed
 

‎articles/lab-services/classroom-labs/TOC.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,13 @@
8787
- name: Enable automatic shutdown on disconnect
8888
href: how-to-enable-shutdown-disconnect.md
8989
- name: Enable nested virtualization on a template VM
90-
href: how-to-enable-nested-virtualization-template-vm.md
90+
items:
91+
- name: Enable nested virtualization on a template VM overview
92+
href: how-to-enable-nested-virtualization-template-vm.md
93+
- name: Enable nested virtualization on a template VM using the UI
94+
href: how-to-enable-nested-virtualization-template-vm-ui.md
95+
- name: Enable nested virtualization on a template VM using a script
96+
href: how-to-enable-nested-virtualization-template-vm-using-script.md
9197
- name: Prepare a Windows template VM
9298
href: how-to-prepare-windows-template.md
9399
- name: Connect to VMs in classroom labs (student)
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
---
2+
title: Enable nested virtualization on a template VM in Azure Lab Services (UI) | Microsoft Docs
3+
description: Learn how to create a template VM with multiple VMs inside. In other words, enable nested virtualization on a template VM in Azure Lab Services.
4+
services: lab-services
5+
author: emaher
6+
7+
ms.service: lab-services
8+
ms.topic: article
9+
ms.date: 1/23/2020
10+
ms.author: enewman
11+
---
12+
# Enable nested virtualization on a template virtual machine in Azure Lab Services manually
13+
14+
Nested virtualization enables you to create a multi-VM environment inside a lab's template virtual machine. Publishing the template will provide each user in the lab with a virtual machine set up with multiple VMs within it. For more information about nested virtualization and Azure Lab Services, see [Enable nested virtualization on a template virtual machine in Azure Lab Services](how-to-enable-nested-virtualization-template-vm.md).
15+
16+
This article covers how to set up nested virtualization on a template machine in Azure Lab Services using Windows roles and tools directly. There are a few things needed to enable a class to use nested virtualization. The steps below will describe how to manually set up a Lab Services machine template with Hyper-V. Steps are intended for Windows Server 2016 or Windows Server 2019.
17+
18+
>[!IMPORTANT]
19+
>Select **Large (nested virtualization)** or **Medium (nested virtualization)** for the virtual machine size when creating the lab. Nested virtualization will not work otherwise.
20+
21+
## Enable Hyper-V role
22+
23+
The following steps describe actions needed to enable Hyper-V on Windows Server using either Server Manager. Once the installation is successful, Hyper-V manager will be available to add, modify, and delete client virtual machines.
24+
25+
1. In **Server Manager**, on the Dashboard page, click **Add Roles and Features**.
26+
2. On the **Before you begin** page, click **Next**.
27+
3. On the **Select installation type** page, keep the default selection of Role-based or feature-based installation and then click **Next**.
28+
4. On the **Select destination server** page, select Select a server from the server pool. The current server will already be selected. Click Next.
29+
5. On the **Select server roles** page, select **Hyper-V**.
30+
6. The **Add Roles and Features Wizard** pop-up will appear. Select **Include management tools (if applicable)**. Click the **Add Features** button.
31+
7. On the **Select server roles** page, click **Next**.
32+
8. On the **Select features page**, click **Next**.
33+
9. On the **Hyper-V** page, click **Next**.
34+
10. On the **Create Virtual Switches** page, accept the defaults, and click **Next**.
35+
11. On the **Virtual Machine Migration** page, accept the defaults, and click **Next**.
36+
12. On the **Default Stores** page, accept the defaults, and click **Next**.
37+
13. On the **Confirm installation selections** page, select **Restart the destination server automatically if required**.
38+
14. When the **Add Roles and Features Wizard** pop-up appears, click **Yes**.
39+
15. Click **Install**.
40+
16. Wait for the **Installation progress** page to indicate that the Hyper-V role is complete. The machine may restart in the middle of the installation.
41+
17. Click **Close**.
42+
43+
## Enable DHCP role
44+
45+
Any Hyper-V client virtual machines created, needs an IP address in the NAT network. We'll create the NAT network later. One way to assign IP addresses is to set up the host, in this case the lab virtual machine template, as a DHCP server. Below are the steps required to enable the DHCP role.
46+
47+
1. In **Server Manager**, on the **Dashboard** page, click **Add Roles and Features**.
48+
2. On the **Before you begin** page, click **Next**.
49+
3. On the **Select installation type** page, select **Role-based or feature-based installation** and then click **Next**.
50+
4. On the **Select destination server** page, select the current server from the server pool and then click **Next**.
51+
5. On the **Select server roles** page, select **DHCP Server**.
52+
6. The **Add Roles and Features Wizard** pop-up will appear. Select **Include management tools (if applicable)**. Click **Add Features**.
53+
54+
>[!NOTE]
55+
>You may see a validation error stating that no static IP addresses were found. This warning can be ignored for our scenario.
56+
57+
7. On the **Select server roles** page, click **Next**.
58+
8. On the **Select features** page, click **Next**.
59+
9. On the **DHCP Server** page, click **Next**.
60+
10. On the **Confirm installation selections** page, click **Install**.
61+
11. Wait for the **Installation progress page** to indicate that the DHCP role is complete.
62+
12. Click Close.
63+
64+
## Enable Routing and Remote Access role
65+
66+
1. In **Server Manager**, on the **Dashboard** page, click **Add Roles and Features**.
67+
2. On the **Before you begin** page, click **Next**.
68+
3. On the **Select installation type** page, select **Role-based or feature-based installation** and then click **Next**.
69+
4. On the **Select destination server** page, select the current server from the server pool and then click **Next**.
70+
5. On the **Select server roles** page, select **Remote Access**. Click **OK**.
71+
6. On the **Select features** page, click **Next**.
72+
7. On the **Remote Access** page, click **Next**.
73+
8. On the **Role Services** page, select **Routing**.
74+
9. The **Add Roles and Features Wizard** pop-up will appear. Select **Include management tools (if applicable)**. Click **Add Features**.
75+
10. Click **Next**.
76+
11. On the **Web Server Role (IIS)** page, click **Next**.
77+
12. On the **Select role services** page, click **Next**.
78+
13. On the **Confirm installation selections** page, click **Install**.
79+
14. Wait for the **Installation progress** page to indicate that the Remote Access role is complete.
80+
15. Click **Close**.
81+
82+
## Create virtual NAT network
83+
84+
Now that all the necessary roles have been installed, it's time to create the NAT network. The creation process will involve creating a switch and the NAT network, itself. A NAT (network address translation) network assigns a public IP address to a group of VMs on a private network to allow connectivity to the internet. In our case, the group of private VMs will be the nested VMs. The NAT network will allow the nested VMs to communicate with one another. A switch is a network device that handles receiving and routing of traffic in a network.
85+
86+
### Create a new virtual switch
87+
88+
1. Open **Hyper-V Manager** from Windows Administrative Tools.
89+
2. Select the current server in the left-hand navigation menu.
90+
3. Click **Virtual Switch Manager…** from the **Actions** menu on the right-hand side of the **Hyper-V Manager**.
91+
4. On the **Virtual Switch Manager** pop-up, select **Internal** for the type of switch to create. Click **Create Virtual Switch**.
92+
5. For the newly created virtual switch, set the name to something memorable. For this example, we'll use 'LabServicesSwitch'. Click **OK**.
93+
6. A new network adapter will be created. The name will be similar to 'vEthernet (LabServicesSwitch)'. To verify open the **Control Panel**, click **Network and Internet**, click **View network status and tasks**. On the left, click **Change adapter settings**.
94+
95+
### Create a NAT network
96+
97+
1. Open the **Routing and Remote Access** tool from Windows Administrative Tools.
98+
2. Select the local server in the left navigation page.
99+
3. Choose **Action** -> **Configure and Enable Routing and Remote Access**.
100+
4. When **Routing and Remote Access Server Setup Wizard** appears, click **Next**.
101+
5. On the **Configuration** page, select **Network address translation (NAT)** configuration. Click **Next**.
102+
103+
>[!WARNING]
104+
>Do not choose the 'Virtual private network (VPN) access and NAT' option.
105+
106+
6. On **NAT Internet Connection** page, choose 'Ethernet'. Don't choose the 'vEthernet (LabServicesSwitch)' connection we created in Hyper-V Manager. Click **Next**.
107+
7. Click **Finish** on the last page of the wizard.
108+
8. When the **Start the service** dialog appears, click **Start Service**.
109+
9. Wait until service is started.
110+
111+
## Update network adapter settings
112+
113+
The network adapter will be associated with the IP used for the default gateway IP for the NAT network created earlier. In this example, we create an IP address of 192.168.0.1 with a subnet mask of 255.255.255.0. We will use the virtual switch created earlier.
114+
115+
1. Open the **Control Panel**, click **Network and Internet**, click **View network status and tasks**.
116+
2. On the left, click **Change adapter settings**.
117+
3. In the **Network Connections** window, double-click on 'vEthernet (LabServicesSwitch)' to show the **vEthernet (LabServicesSwitch) Status** details dialog.
118+
4. Click the **Properties** button.
119+
5. Select **Internet Protocol Version 4 (TCP/IPv4)** item and click the **Properties** button.
120+
6. In the **Internet Protocol Version 4 (TCP/IPv4) Properties** dialog, select **Use the following IP address**. For the ip address, enter 192.168.0.1. For the subnet mask, enter 255.255.255.0. Leave the default gateway blank. Leave the DNS servers blank as well.
121+
122+
>[!NOTE]
123+
> Our range for our NAT network will be, in CIDR notation, 192.168.0.0/24. This creates a range of usable IP addresses from 192.168.0.1 to 192.168.0.254. By convention, gateways have the first IP address in a subnet range.
124+
125+
7. Click OK.
126+
127+
## Create DHCP Scope
128+
129+
The following steps are instruction to add DHCP scope. In this article, our NAT network is 192.168.0.0/24 in CIDR notation. This creates a range of usable IP addresses from 192.168.0.1 to 192.168.0.254. The scope created must be in that range of usable addresses excluding the IP address already created earlier.
130+
131+
1. Open **Administrative Tools** and open the **DHCP** administrative tool.
132+
2. In the **DHCP** tool, expand the node for the current server and select **IPv4**.
133+
3. From the Action menu, choose **New Scope…**
134+
4. When the **New Scope Wizard** appears, click **Next** on the **Welcome** page.
135+
5. On the **Scope Name** page, enter 'LabServicesDhcpScope' or something else memorable for the name. Click **Next**.
136+
6. On the **IP Address Range** page, enter the following values.
137+
138+
- 192.168.0.100 for the Start IP address
139+
- 192.168.0.200 for the End IP address
140+
- 24 for the Length
141+
- 255.255.255.0 for the Subnet mask
142+
143+
7. Click **Next**.
144+
8. On the **Add Exclusions and Delay** page, click **Next**.
145+
9. On the **Lease Duration** page, click **Next**.
146+
10. On the **Configure DHCP Options** page, select **Yes, I want to configure these options now**. Click **Next**.
147+
11. On the **Router (Default Gateway)**
148+
12. Add 192.168.0.1, if not done already. Click **Next**.
149+
13. On the **Domain Name and DNS Servers** page, add 168.63.129.16 as a DNS server IP address, if not done already. 168.63.129.16 is the IP address for an Azure static DNS server. Click **Next**.
150+
14. On the **WINS Servers** page, click **Next**.
151+
15. One the **Activate Scope** page, select **Yes, I want to activate this scope now**. Click **Next**.
152+
16. On the **Completing the New Scope Wizard** page, click **Finish**.
153+
154+
## Conclusion
155+
156+
Now your template machine is ready to create Hyper-V virtual machines. See [Create a Virtual Machine in Hyper-V](https://docs.microsoft.com/windows-server/virtualization/hyper-v/get-started/create-a-virtual-machine-in-hyper-v) for instructions about how to create Hyper-V virtual machines. Also see the [Microsoft Evaluation Center](https://www.microsoft.com/evalcenter/) to check out available operating systems and software.
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
---
2+
title: Enable nested virtualization on a template VM in Azure Lab Services (Script) | Microsoft Docs
3+
description: Learn how to create a template VM with multiple VMs inside. In other words, enable nested virtualization on a template VM in Azure Lab Services.
4+
services: lab-services
5+
documentationcenter: na
6+
author: spelluru
7+
manager:
8+
editor: ''
9+
10+
ms.service: lab-services
11+
ms.workload: na
12+
ms.tgt_pltfrm: na
13+
ms.devlang: na
14+
ms.topic: article
15+
ms.date: 10/04/2019
16+
ms.author: spelluru
17+
---
18+
19+
# Enable nested virtualization on a template virtual machine in Azure Lab Services using a script
20+
21+
Nested virtualization enables you to create a multi-VM environment inside a lab's template virtual machine. Publishing the template will provide each user in the lab with a virtual machine set up with multiple VMs within it. For more information about nested virtualization and Azure Lab Services, see [Enable nested virtualization on a template virtual machine in Azure Lab Services](how-to-enable-nested-virtualization-template-vm.md).
22+
23+
The steps in this article focus on setting up nested virtualization for Windows Server 2016 or Windows Server 2019. You will use a script to set up template machine with Hyper-V. The following steps will guide you through how to use the [Lab Services Hyper-V scripts](https://github.com/Azure/azure-devtestlab/tree/master/samples/ClassroomLabs/Scripts/HyperV).
24+
25+
>[!IMPORTANT]
26+
>Select **Large (nested virtualization)** or **Medium (nested virtualization)** for the virtual machine size when creating the lab. Nested virtualization will not work otherwise.
27+
28+
1. If you're using Internet Explorer, you may have to add `https://github.com` to the trusted sites list.
29+
1. Open Internet Explorer.
30+
1. Select the gear icon, and choose **Internet options**.
31+
1. When the **Internet Options** dialog appears, select **Security**, select **Trusted Sites**, click **Sites** button.
32+
1. When the **Trusted sites** dialog appears, add `https://github.com` to the trusted websites list, and select **Close**.
33+
34+
![Trusted sites](../media/how-to-enable-nested-virtualization-template-vm-using-script/trusted-sites-dialog.png)
35+
1. Download the Git repository files as outlined in the following steps.
36+
1. Go to [https://github.com/Azure/azure-devtestlab/](https://github.com/Azure/azure-devtestlab/).
37+
1. Click the **Clone or Download** button.
38+
1. Click **Download ZIP**.
39+
1. Extract the ZIP file
40+
41+
>[!TIP]
42+
>You can also clone the Git repository at [https://github.com/Azure/azure-devtestlab.git](https://github.com/Azure/azure-devtestlab.git).
43+
44+
1. Launch **PowerShell** in **Administrator** mode.
45+
1. In the PowerShell window, navigate to the folder with the downloaded script. If you're navigating from the top folder of the repository files, the script is located at `azure-devtestlab\samples\ClassroomLabs\Scripts\HyperV\`.
46+
1. You may have to change the execution policy to successfully run the script. Run the following command:
47+
48+
```powershell
49+
Set-ExecutionPolicy bypass -force
50+
```
51+
52+
1. Run the script:
53+
54+
```powershell
55+
.\SetupForNestedVirtualization.ps1
56+
```
57+
58+
> [!NOTE]
59+
> The script may require the machine to be restarted. Follow instructions from the script and re-run the script until **Script completed** is seen in the output.
60+
1. Don't forget to reset the execution policy. Run the following command:
61+
62+
```powershell
63+
Set-ExecutionPolicy default -force
64+
```
65+
66+
## Conclusion
67+
68+
Now your template machine is ready to create Hyper-V virtual machines. See [Create a Virtual Machine in Hyper-V](/windows-server/virtualization/hyper-v/get-started/create-a-virtual-machine-in-hyper-v) for instructions on how to create Hyper-V virtual machines. Also, see [Microsoft Evaluation Center](https://www.microsoft.com/evalcenter/) to check out available operating systems and software.

‎articles/lab-services/classroom-labs/how-to-enable-nested-virtualization-template-vm.md

Lines changed: 6 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ ms.author: spelluru
2020

2121
Currently, Azure Lab Services enables you to set up one template virtual machine in a lab and make a single copy available to each of your users. If you are a professor teaching networking, security, or IT classes, you may need to provide each of your students with an environment in which multiple virtual machines can talk to each other over a network.
2222

23-
Nested virtualization enables you to create a multi-VM environment inside a labs template virtual machine. Publishing the template will provide each user in the lab with a virtual machine set up with multiple VMs within it. This article covers how to set up nested virtualization on a template machine in Azure Lab Services.
23+
Nested virtualization enables you to create a multi-VM environment inside a lab's template virtual machine. Publishing the template will provide each user in the lab with a virtual machine set up with multiple VMs within it. This article covers how to set up nested virtualization on a template machine in Azure Lab Services.
2424

2525
## What is nested virtualization?
2626

@@ -48,48 +48,12 @@ This article assumes that you have created a lab account and lab. For more info
4848
>[!IMPORTANT]
4949
>Select **Large (nested virtualization)** or **Medium (nested virtualization)** for the virtual machine size when creating the lab. Nested virtualization will not work otherwise.
5050
51-
To connect to the template machine, see [create and manage a classroom template](how-to-create-manage-template.md).
51+
To connect to the template machine, see [create and manage a classroom template](how-to-create-manage-template.md).
5252

53-
The steps in this section focus on setting up nested virtualization for Windows Server 2016 or Windows Server 2019. You will use a script to set up template machine with Hyper-V. The following steps will guide you through how to use the [Lab Services Hyper-V scripts](https://github.com/Azure/azure-devtestlab/tree/master/samples/ClassroomLabs/Scripts/HyperV).
53+
### Using script to enable nested virtualization
5454

55-
1. If you're using Internet Explorer, you may have to add `https://github.com` to the trusted sites list.
56-
1. Open Internet Explorer.
57-
1. Select the gear icon, and choose **Internet options**.
58-
1. When the **Internet Options** dialog appears, select **Security**, select **Trusted Sites**, click **Sites** button.
59-
1. When the **Trusted sites** dialog appears, add `https://github.com` to the trusted websites list, and select **Close**.
55+
To use the automated setup for nested virtualization with Windows Server 2016 or Windows Server 2019, see [Enable nested virtualization on a template virtual machine in Azure Lab Services using a script](how-to-enable-nested-virtualization-template-vm-using-script.md). You will use scripts from [Lab Services Hyper-V scripts](https://github.com/Azure/azure-devtestlab/tree/master/samples/ClassroomLabs/Scripts/HyperV) to install the Hyper-V role. The scripts will also set up networking so the Hyper-V virtual machines can have internet access.
6056

61-
![Trusted sites](../media/how-to-enable-nested-virtualization-template-vm/trusted-sites-dialog.png)
62-
1. Download the Git repository files as outlined in the following steps.
63-
1. Go to [https://github.com/Azure/azure-devtestlab/](https://github.com/Azure/azure-devtestlab/).
64-
1. Click the **Clone or Download** button.
65-
1. Click **Download ZIP**.
66-
1. Extract the ZIP file
57+
### Using Windows tools to enable nested virtualization
6758

68-
>[!TIP]
69-
>You can also clone the Git repository at [https://github.com/Azure/azure-devtestlab.git](https://github.com/Azure/azure-devtestlab.git).
70-
71-
1. Launch **PowerShell** in **Administrator** mode.
72-
1. In the PowerShell window, navigate to the folder with the downloaded script. If you're navigating from the top folder of the repository files, the script is located at `azure-devtestlab\samples\ClassroomLabs\Scripts\HyperV\`.
73-
1. You may have to change the execution policy to successfully run the script. Run the following command:
74-
75-
```powershell
76-
Set-ExecutionPolicy bypass -force
77-
```
78-
79-
1. Run the script:
80-
81-
```powershell
82-
.\SetupForNestedVirtualization.ps1
83-
```
84-
85-
> [!NOTE]
86-
> The script may require the machine to be restarted. Follow instructions from the script and re-run the script until **Script completed** is seen in the output.
87-
1. Don’t forget to reset the execution policy. Run the following command:
88-
89-
```powershell
90-
Set-ExecutionPolicy default -force
91-
```
92-
93-
## Conclusion
94-
95-
Now your template machine is ready to create Hyper-V virtual machines. See [Create a Virtual Machine in Hyper-V](/windows-server/virtualization/hyper-v/get-started/create-a-virtual-machine-in-hyper-v) for instructions on how to create Hyper-V virtual machines. Also, see [Microsoft Evaluation Center](https://www.microsoft.com/evalcenter/) to check out available operating systems and software.
59+
The setup nested virtualization for Windows Server 2016 or Windows Server 2019 using Windows roles and administrative tools, see [Enable nested virtualization on a template virtual machine in Azure Lab Services manually](how-to-enable-nested-virtualization-template-vm-ui.md). Instructions will also cover how to set up networking so the Hyper-V virtual machines can have internet access.

0 commit comments

Comments
 (0)
Please sign in to comment.