MicrosoftDocs / azure-docs

Open source documentation of Microsoft Azure
https://docs.microsoft.com/azure
Creative Commons Attribution 4.0 International
10.31k stars 21.49k forks source link

Do yo really need to add a NAT virtual switch #17684

Closed AronT-TLV closed 6 years ago

AronT-TLV commented 6 years ago

Since forever, Hyper-V creates it's own NAT virtual switch called nat which you can use for the stuff noted above. It's a bit confusing when you follow the instructions above, issue the Get-NetAdapter, and see two internal adaptors.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

mimckitt commented 6 years ago

Thanks for the question! We are investigating and will update you shortly.

mimckitt commented 6 years ago

@AronT-TLV you can still run nested virtualization without this step. However, you need to follow these steps to allow the nested VMs to access the internet. Otherwise, using the default will result in no connectivity.

mimckitt commented 6 years ago

@AronT-TLV I will close this out for now. If you want to discuss anything further let me know and we can always reopen and continue.

AronT-TLV commented 6 years ago

Sorry for not responding earlier, got caught up in other work and couldn't test this. I have two questions/comments:

  1. The default "nat" is defined as an "Internal" switch type just like this one. I am in the process of testing it (it takes a while since I have to add a VM but it already seems to have all the settings you need as a Nat. Why do you say it won't access internet (I will check and update)
  2. Even if it is correct the documentation should be updated, because I see three interfaces, not two when I follow the listed documentation, which is confusing
mimckitt commented 6 years ago

@AronT-TLV I ran through the doc again and I suppose it would be possible to use the existing adapter. I haven't played around with nested virtualization for a while so I need to test it out. If you can use the first network adapter, we likely have you create a new one to simplify the setup process for users trying this feature for the first time. Rather than having to go back and configure an existing NIC.

I will do some tests and get back to you on it.

CC @zr-msft as he is working on a similar ask offline

AronT-TLV commented 6 years ago

I am playing around with this as well, since I am pretty sure I used the default Nat in the past. Here’s what I tried so far

  1. Used the default “nat” when setting up the VM
  2. Did the manual IP setup on Ubuntu once the installation was complete using the IP range of the nat
  3. Configure with opendns.

So far can’t get out. It could be some mistake in my settings. It’s midnight here will try more tomorrow.

From: Micah notifications@github.com Reply-To: MicrosoftDocs/azure-docs reply@reply.github.com Date: Monday, 29 October 2018 at 23:36 To: MicrosoftDocs/azure-docs azure-docs@noreply.github.com Cc: Aron T aront@fourm.info, Mention mention@noreply.github.com Subject: Re: [MicrosoftDocs/azure-docs] Do yo really need to add a NAT virtual switch (#17684)

@AronT-TLVhttps://github.com/AronT-TLV I ran through the doc again and I suppose it would be possible to use the existing adapter. I haven't played around with nested virtualization for a while so I need to test it out. If you can use the first network adapter, we likely have you create a new one to simplify the setup process for users trying this feature for the first time. Rather than having to go back and configure an existing NIC.

I will do some tests and get back to you on it.

CC @zr-msfthttps://github.com/zr-msft as he is working on a similar ask offline

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/MicrosoftDocs/azure-docs/issues/17684#issuecomment-434089679, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AVGMY_QLga_f3MjSOtFsuiWbFQN7Iq3Qks5up3TogaJpZM4X8N72.

mimckitt commented 6 years ago

@AronT-TLV thanks for those updates.

I tried this with a Fresh VM just now.

I created a brand new Windows Server 2016 machine and enabled Hyper-V using the following command

Install-WindowsFeature -Name Hyper-V -IncludeManagementTools -Restart One it restarted I opened up PowerShell an ran Get-NetAdapter to list any current adapters I had available

image

By default, the only NIC showing up in the interface the Azure VM is using.

I then created a nested VM . I created an Ubuntu nested VM. The default NIC it creates shows I am unable to select any connection options so it remains not connected

image

After creating the nested VM I ran the Get-NetAdapter command again but I still only see the default NIC in use by the Azure VM.

If played around a bit more but overall I could not get internet connectivity on the VM until I created a new virtual NIC to connected the nested one to. And if you mess with the default NIC that the Azure VM is using then connectivity is lost

So I am not sure where you get getting the second NIC showing up as if you follow this doc from start to finish the only way to actually get that second NIC that the nested VM can use for internet connectivity is to create it and assign an IP. Let me know what else you might have found once you get a chance :)

mimckitt commented 6 years ago

17461

AronT-TLV commented 6 years ago

So I turned on DHCP and networking works great. Here is our conversation on Github in a Firefox window on my Ubuntu Hyper-V VM:

image

I don't understand why you don't get the default "nat". Here is what I see right after turning on Hyper-VM (I did it using the Server Manager):

screenshot 2018-10-30 10 45 38

Perhaps it is the version of Windows Server 2016. This particular VM was created using the Geo AI Data Science VM. As I mentioned I did the once before and I checked and there too I was using the default nat. I don't recall which Server 2016 VM I used at the time, but not only did I use the default nat, I also did not use DHCP and I port forwarded the VM. This was just when nested Hyper-V first became available on Azure VMs and I needed a 32-bit Linux VM to host an ancient website with ancient plone software. Proof that it worked, here's the website: http://old.fourm.info:8082

Perhaps you should check with the Azure backend people to find out which windows Server 2016 images automatically create a nat switch for you. I also wonder why the DHCP worked whilst the

mimckitt commented 6 years ago

@AronT-TLV you are correct. It appears to depend on the VM image. In fact, the data science VM has the two virtual NICs before doing any extra configuration.

This is what I see as soon as I created the Data Science VM and checked for network adapters.

image

So as you found out, if the VM already has an extra virtual NIC then you could just use that for nested virtualization.

For simplicity reasons, I would still suggest users follow this doc to create a new NIC to enable their nested VMs to access the internet. That way you are not taking over the NIC that was there in the first place possibly for another reason. I am not sure what the Data Science VM uses that extra NIC for but I am sure it has a purpose. So utilizing it for something else may make some of the features this image was designed for not to work as designed.

Of course, you can always manage the network interfaces inside the VM so if you found you had extra ones you do not need you could also remove them.

From a doc perspective, I think it is best to still direct users to create a new interface to avoid confusion and accidentally messing with the NIC that the VM itself is using. We also will have this comment on the doc if others are curious as well. If it is something that continues to come up in discussion we can always revisit the issue however at this point I think it is still best to direct the user to create a new NIC and follow the steps.

AronT-TLV commented 6 years ago

I see your point and it makes sense. And as you point out, now that we’ve had this discussion, anyone who is confused as I was, can see the thread. Thanks for the discussion. I love this feature btw. As noted, this is the only way I found to have a 32-bit legacy Linux application lifted & shifted to the cloud! And it has many other practical uses e.g. bringing Linux to older versions of Windows Server that don’t yet support WSL :)

Get Outlook for iOShttps://aka.ms/o0ukef


From: Micah notifications@github.com Sent: Tuesday, October 30, 2018 9:31:39 PM To: MicrosoftDocs/azure-docs Cc: Aron T; Mention Subject: Re: [MicrosoftDocs/azure-docs] Do yo really need to add a NAT virtual switch (#17684)

@AronT-TLVhttps://github.com/AronT-TLV you are correct. It appears to depend on the VM image. In fact, the data science VM has the two virtual NICs before doing any extra configuration.

This is what I see as soon as I created the Data Science VM and checked for network adapters.

[image]https://user-images.githubusercontent.com/32313503/47744200-041ea380-dc3e-11e8-9e5b-b0aecb4e40f2.png

So as you found out, if the VM already has an extra virtual NIC then you could just use that for nested virtualization.

For simplicity reasons, I would still suggest users follow this doc to create a new NIC to enable their nested VMs to access the internet. That way you are not taking over the NIC that was there in the first place possibly for another reason. I am not sure what the Data Science VM uses that extra NIC for but I am sure it has a purpose. So utilizing it for something else may make some of the features this image was designed for not to work as designed.

Of course, you can always manage the network interfaces inside the VM so if you found you had extra ones you do not need you could also remove them.

From a doc perspective, I think it is best to still direct users to create a new interface to avoid confusion and accidentally messing with the NIC that the VM itself is using. We also will have this comment on the doc if others are curious as well. If it is something that continues to come up in discussion we can always revisit the issue however at this point I think it is still best to direct the user to create a new NIC and follow the steps.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/MicrosoftDocs/azure-docs/issues/17684#issuecomment-434437649, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AVGMYwmUNmlRt4f9-EutBYQPVZml3Qqrks5uqKkbgaJpZM4X8N72.

mimckitt commented 6 years ago

@AronT-TLV and thanks for bringing this up! A very interesting conversation indeed :) It is always fun seeing what customers are doing and how they are utilizing a feature and the things they are able to accomplish. If you have any other thoughts or feedback on this doc or any others let me know :)

ramraj4k commented 5 years ago

Has Internet connectivity is accessible on Nested VM inside the Hyper-v Console ? ...noticed still there is an issue to access the internet. Any advise ??