The Virtual Network Manager in Hyper-V has three possible network types that you can choose from when networking your Virtual Machines (VMs), these are as follows:
- External
- This will interface with your host’s Network Interface Card (NIC), and allow external machines to view the VMs.
- Internal
- This will create a secondary Local Area Connection (LAN) in your network connections that does not interface with your host’s NIC, only allowing the VMs to communicate with each other and the host.
- Private
- This will create a network completely separate to the host machine, only allowing the virtual machines to communicate between themselves.
For the purpose of this article, we will focus on the external type of virtual network, and how it can be set up within Windows Server 2008.
Before this however, we need to look at our current network setup. From the Network and Sharing Centre, click ‘Manage network connections’, then go to the properties of the existing LAN, you should see something similar to the following:
This default network has full access to the internet and external networks. As you can see from the image, this is a remote connection from an external network.
Creating the Virtual Network
Choosing an external network (as described by the Hyper-V Virtual Network Manager):
Creates a virtual network that binds to the physical network adapter so that virtual machines can access a physical network.
To create this network, simply go to the Virtual Network Manager, add a new network, and fill in the details when prompted. The following should appear.
Once this new network is created, a new LAN will appear in the Network Connections:
Note that any additions of virtual networks will cause the physical network to reset. If this occurs, connection may be lost between the host and other machines on the network. To resolve this, disable both of the connections then reactivate them.
If you examine the two network connections now, you will see that the physical connection only has one item enabled (Microsoft Virtual Network Switch Protocol), whereas the new virtual connection has everything else enabled. Hyper-V has readjusted the network structure to accommodate the new virtual network. The following diagram displays this new layout:
The left side of the diagram displays the physical portion of the network (i.e. the PC that this article is currently being written on, the router, and the internet connection), with the right side displaying the server following the addition of the virtual network (however at present there are no virtual servers connected).
So there are a few aspects to this new virtual network:
- Physical NIC
- This is now bound to the Microsoft Virtual Network Switch Protocol, and links with the external router.
- Virtual Switch (Microsoft Virtual Network Switch Protocol)
- This is now bound to the physical NIC, and will be used by Hyper-V to connect with VMs on the host.
- Virtual NIC (Physical Server)
- This is now bound to all standard protocols except the switch. All server network management can be done from here.
- Virtual NIC (Virtual Server)
- This will link to the switch, connecting to the physical server using the protocols defined by the virtual NIC (physical server).
Assigning the Virtual Network to a VM
Now that our Virtual Network is complete, we need to assign it to one of our VMs. This is very straightforward, simply go to the Hyper-V Manager, select your VM, and hit the ‘Settings’ link. Select ‘Network Adapter’ in the ‘Hardware’ section, and choose the new network from the dropdown as follows (‘SharePoint’ is the name of the virtual machine in this example):
Now when we start up our VM, we will be able to connect to the tcdev.co.uk domain. The host and VM will be able to communicate with each other just like in any physical network, and physical machines connected via the router (like the laptop and PC in the previous network diagram) will also be able to connect to the VM.
Additional Resources
For more information on virtual networking, Ben “Virtual PC Guy” Armstrong runs a very detailed blog on the MSDN network here: