Network configuration in a Hyper-V lab with domain controller, DHCP, and DNS

By | April 16, 2017

If you are running a virtual environment with a DC and DNS server you are likely to encounter a problem with the internet connection or the network connection between your machines. The issue is that your machines can either get an IP address from the DHCP server in your environment or from your router. In case it takes the internal address you don’t have internet access. If the machine takes the external address it may not see the other machines in your lab.
A possible workaround is to create two virtual adapters: The first one to connect the machines internally, the second one to grant them internet access.
Here’s what to do to get it achieved:
1. Create an internal and an external virtual switch in the Virtual Switch Manager in the right pane of your Hyper-V management console. Leave the settings default.


2. Right-click the virtual machines and select Settings. Click Add Hardware and select Network Adapter. Create a second network adapter for each machine in the lab that needs internet access. In case your host is running on Windows 10 1709 or later, you should use the default switch that is already preconfigured (mind that you find an adapter vEthernet (Default Switch) in the list of Network adapter of your device). To my experience, this prevents the virtual switch from degrading the speed of physical adapter (you may check speedtest.net before and after the configuration to be sure).

The configuration gives you the option use RDP connections from your host computer which are more comfortable than Hyper-V connection. To allow RDP on servers, open the Server Manager, select Local Server and set Remote Desktop to on.

On workstations, open Control Panel, select System, go to the Remote tab and select Allow remote connections to this computer. Alternatively, configure the settings by GPO.
Btw, Microsoft provides an excellent lab with DC, DHCP, DNS, SCCM, MDT and many other installation as download on https://technet.microsoft.com/en-us/windows/mt604890.aspx

Links:

Managing the Hyper-V Default Switch in Windows 10 version 1709 and higher with PowerShell: https://mikefrobbins.com/2018/11/08/managing-the-hyper-v-default-switch-in-windows-10-version-1709-and-higher-with-powershell/

4 thoughts on “Network configuration in a Hyper-V lab with domain controller, DHCP, and DNS

  1. Lee

    This is exactly the scenario that I was attempting.

    I built Server1 as a Win2016 DC. I created a Private and an External Switch and assigned both to Server1. The Private vAdapter (as seen by Server1) gets assigned a static IP, and Server 1 is also a DHCP and DNS server for the ‘virtual’ domain. This all seems OK, and Server1 has internet access.

    Server2 (will eventually be SQL Server) currently only has the Private Switch assigned. It seems to be getting the IP config from the DHCP server on Server1 (10.x.x.x range) and can see Server1, so no problem there. But, I don’t want to add the External switch to Server2 – I wan’t to configure it so I can test the firewall / RAS / VPN / Etc, so any access (other than the HyperV management connection) would have to route through Server1, just as if it was a server out on the net (I may end up setting up a separate RAS server, since I don’t think it’s actually best practice to have these services on a DC).

    So, I add Routing services to Server1, figuring I would just configure the ‘virtual’ network w/ NAT or as a direct LAN-to-LAN connection, but this doesn’t seem to be working. Server2 can resolve internet names, but can’t actually get to any sites. I have a feeling this is a firewall issue, but as far as I haven’t found any Firewall rules that seems to be blocking web traffic. Any thoughts?

    BTW, I will check out that MS Lab! Seems like just what I need!

    Thanks for any additional thoughts.

    -Lee

    Reply
  2. buildguy

    The Lab you referred to from Microsoft. Is it supposed to work right out of the box? I set up just the External switch before installing the lab (I assume everything else is set up by the setup).

    When I log into each VM I have no internet access … its would seem to me that the are some initial set up steps that need to be taken that are not documented. Can you shed some light on that?

    Reply
    1. max

      Is the virtual switch linked to the right network adapter (probably wireless)? If yes and it doesn’t work try the default adapter.

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *