Nested virtualization issue in Lab Services

Copper Contributor

Hi, 

 

I have created a lab using the lab plan with Windows Server 2022 Datacenter (Gen2) template. I need to create two VMs with hyper-V on the template. I followed this article. We are teaching basic Windows Server administration tasks such as installing Active Directory services, File Server, GPO, etc.

 

After I published the lab, I realized all users are connected to the same DHCP server named something like "xyz.fx.internal.cloudapp.net". So, If VM1 changes the DHCP configuration, VM2 is affected by the same configuration even though the scope is bound to the Virtual Switch (192.168.0.1) which should be a Hyper-V internal interface. Meaning that other VMs in the network should NOT see that process. 

 

Can somebody please explain that to me?

Best regards,

Masih 

4 Replies

@masih-shek,

 

In the article you mention, the DHCP role is installed on the host machine for convenience, so the client/nested VMs will automatically be assigned an IP address when they boot up.  However, you don't have to do this.  You could manually assign the IP addresses to the client/nested VMs.

 

The *.internal.cloudapp.net is the default FQDN for all Azure VMs.  It's not coming from the host machine.

 

The network being setup in the article you reference is a NAT network.  This means that will proper configuration, the client/nested VMs can see the internet and each other.  However, anything outside of the host VM will not be able to access the client VMs.

 

I would suggest checking out a new advanced networking feature in Azure Lab Services August 2022.  It allows you to connect servers and multiple labs to the same virtual network.  Please see, https://learn.microsoft.com/en-us/azure/lab-services/how-to-connect-vnet-injection.

 

Did that answer your questions?

 

Hope that helps, 

Elizabeth

@planetmaher

Hello,

Thank you for replying.

We used the DHCP server for convenience to our students because they are at the beginning of their IT studies. We were delighted to find the article showing that using the DHCP server was possible in Azure Lab Services. We plan to continue using the DHCP method until the end of this semester but will update our instructions for static IP for the next term.

After implementing our labs following the article, we learned that the DHCP server was not functioning as expected, and that was the reason for my post here. Because we bind the service to the internal Hyper-V switch and create a scope for its address, it is confusing why the scope options affect other VMs in the lab. Another issue we face is that the DHCP scope vanishes from our labs when many students try to use it.

I don't know if the issue is because of how we have created our labs or because of the limitations of the DHCP in Azure. Still, I wish the article explains more about the DHCP server in Azure Lab Services architecture.

Thank you!

Regards
Masih

@masih-shek,

 

Sorry to hear you are having issues.  Like I mentioned before, installing the DHCP role is for convenience only so the Hyper-V client VMs automatically get an ip and access to the internet. 

 

If you are trying to teach a class about DHCP you have a couple of options:

  1. Use the advanced networking feature when creating a lab.  Create a regular compute VM to be the DHCP server and put it on the same vnet as the lab.
  2. Create a self-contained environment using nested virtualization.  However, instead of assigning the DHCP role to the host VM, assign it to one of the Hyper-V client VMs.
  3. Consider using DevTest Lab environments. More information at https://learn.microsoft.com/azure/devtest-labs/devtest-lab-create-environment-from-arm

I hope that answers your question.  If it doesn't, could you replay with information about the architecture of what you're trying to setup?

@planetmaher 

Thank you for your reply. 

I'm trying to achieve the results instructed in this guide. 

 

I have installed the Hyper-V and DHCP server on the template. I don't configure the DHCP scope and the NAT. We want the students to accomplish that. But I have also tested a situation where I followed the instructions entirely and still faced the problem explained below. 

The problem: 
After publishing the Template to the class, the DHCP server's name is the same across the labs, and all 50 lab machines see the same DHCP server. So when the students create an Internal Hyper-V switch and configure the DHCP scope for that internal network, the configurations are distributed across all students' machines. Sometimes the scope vanishes, and the Hyper-V machines don't get an IP address. 

I think that has something to do with the fact that the Template is not Generalized (or Specialized) before publishing. Do I have to also Sysprep the Template before publishing it? 

I tested the same concept with Azure Virtual Machine Scale Set, where I used a Generalized image, and the problem above didn't happen as each DHCP took a unique name. 

I will be using Lab Plan later instead of Lab Account used above. We don't use DHCP server in our future classes. I'm just very keen to understand the Lab Services Architect and if I have been doing something wrong. 

Regards,

Masih