gateway for VM

Shahin Mortazave 491 Reputation points
2020-10-21T14:18:52.473+00:00

Hi,

I now how to setup the VMs of an hyper-v host and they will have internet connection.

But today I rent a dedicated host at a datacenter, that has 2 NICs and only one of the NICs get public IP from the DHCP of the datacenter. I did install the Win2019 and setup the Hyper, but I have no idea on how to allow VMs on this host have internet access.

I did create a external VM switch with the nic that has public IP and connect a single VM to this switch. I want to give IP 10.0.10.0/24 to the VM but I have no idea what to use as GW for this VM.

Any suggestion on how to allow this VM to have internet access?

Thanks

Hyper-V
Hyper-V
A Windows technology providing a hypervisor-based virtualization solution enabling customers to consolidate workloads onto a single server.
2,682 questions
0 comments No comments
{count} votes

Accepted answer
  1. Candy Luo 12,701 Reputation points Microsoft Vendor
    2020-10-22T02:02:13.067+00:00

    Hi ,

    Based on my understanding, you want to manually assign private IP to the VM and allow this VM to have internet access. Is that right? Please feel free to let me know if I have any misunderstanding.

    If yes, you can deploy a NAT Virtual Switch which allows virtual machines to have an internal network and have internet access. Each VM is connected to an internal virtual switch and will use WinNAT to connect to a private IP subnet. WinNAT gives a machine access to network resources using the host computer's IP address.

    As the picture below:

    34185-image.png

    For more details about how to using a NAT Virtual Switch with Hyper-V, you could refer to the following article:

    Using a NAT Virtual Switch with Hyper-V

    Please Note: Since the web site is not hosted by Microsoft, the link may change without notice. Microsoft does not guarantee the accuracy of this information.

    Best Regards,

    Candy

    --------------------------------------------------------------

    If the Answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Shahin Mortazave 491 Reputation points
    2020-10-22T11:38:53.7+00:00

    @Candy Luo Thanks for your reply,
    your suggestion has solve my problem with having internet access on the VMs.
    But now I come acrosse this issue
    We have multiple webservers on different VMs on this hyper-v host, how can we allow access to the webservers?
    normally we can use some kind of nat device or utm that is in front of the hyper-v host but right now we have only a simple firewall that allow us to open a port to the hyper-v host.
    How can we send the web requests to the the webservers on the VMs?
    Any suggestions?
    Thanks


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.