networking - How can I configure my Server 2012 Hyper-V lab setup with NAT?

04
2013-08
  • swasheck

    I am attempting to create a lab using Windows Server 2012 (GUI) with Hyper-V on my laptop. I am trying to figure out how to create an "Internal" network with NAT through the adapter on the physical laptop.

    As it stands, the only way I can get my guest VMs online are through the "External" network so I'm getting an IP address from the DHCP server itself, and not using the host as a gateway.

    Internet Connection Sharing is disabled by Group Policy so using the EMC article regarding sharing my connection doesn't seem to be a viable option right now.

    Additionally, I've stumbled across this article with "IP Rewrite" but I'm unable to find any other resources on how to employ this to my advantage. What is "IP Rewrite" and how would I employ this in my situation?

  • Answers
  • Vincent Vancalbergh

    Hyper-V may not have a NAT networking option (like Virtualbox does), but Windows does: check this out:

    • Basically you make a virtual Internal network.
    • Right-click your network adapter.
    • tab Sharing
    • Enable Sharing and link it to your virtual internal network.
    • Then manually give you machines IP- and DNS settings (including your host).
  • Jason Taylor

    Could you accomplish this by running a small Linux VM acting as a gateway?

    Give the Linux VM an adapter on both the private and external network, and set ip forwarding. Put your other VM's on the internal network, and point their gateways to your Linux VM.

    I haven't tested this, but I would imagine this would work. If you get a sufficiently small linux install (DSL, or something?) resource usage should be minimal.

  • voretaq7

    It's not a solution using Hyper-V (and there may be some license considerations), but you could always try VirtualBox -- it's pretty decent desktop virtualization, and it does offer a NAT networking option that can do what you're asking for in the question.

    Your mileage may vary in terms of performance and vendor support, but I've had good experiences with VirtualBox. It's probably adequate for running SQL servers in a VM to try out new functionality.

  • longneck

    Hyper-V does not have a NAT networking option.


  • Related Question

    dns - Hyper V Server not findable by name
  • dkackman

    I am setting up a Hyper V 2008 R2 Server on my home network to evaluate it for general virtualization usage at work (software development test lab etc).

    I don't have a domain at home so its just a workgrouped network. I've got the server installed and running but the problem is the server name won't resolve. NetBios over tcp/ip is enabled and I can remote desktop to it by IP address.

    The Hyper V server is just stripped down Windows Server 2008 so it only has a command line and not much else for management UI. Plus not being much of a networking guy I am mostly fumbling around in the dark.

    How can I configure it to register itself such that its name will resolve?

    Thanks, Don


  • Related Answers
  • Diago

    Hyper-V does not need to be connected to a domain, however to configure network setting in R2 is fairly straigh forward.

    • Log on to Hyper-V
    • At Powershell menu select 8
    • Select the Network Adapter by Index number
    • Configure Settings

    As for resolving the name, Windows Server 2008 Core disables everything via the firewall, so I would suggest that you disable the firewall first to ensure that this is not what is causing the problem. You can disable the firewall using:

    netsh firewall set opmode disable

    And to re-enable:

    netsh firewall set opmode enable

    Lastly use option 4 to enable all the Remote Management features which means you can manage the complete machine remotely once you have fixed the name resolution, or alternatively using the IP address.

    If you are using DHCP you can also try running:

    ipconfig /flushdns

    And

    ipconfig /registerdns

    Which may fix the connectivity problem as well, but if not in a domain I am not convinced it will work.