Thursday, 28 April 2011

Enabling Wireless Network for a Hyper-V Virtual Machine










Introduction

By default, Hyper-V does not have any wireless capability, we simply can not attach a wireless adapter to a Hyper-V child virtual machine ! Imagine  yourself in a situation where you need internet connection to your virtual machines, and there is no network cables or switches around you so that you can connect your virtual machine to the network ! or you could be someone like me who uses his machine for presentations and demos, what we can do in these situations, is to simply share the Internet connection from the wireless adapter on the parent server (host).



Note : Before proceeding, you will need to enable wireless networking on Windows Server 2008, read my article Enabling Wireless Networking In Windows Server 2008 .

In this article, we will be completing three steps:
Step 1. Setup virtual networks : In this step we will be creating a new virtual network adapter
Step 2. Add a network adapter to the virtual machine : In this step we will connect the new virtual adapter that we have created in the previous step to the Virtual Machine.
Step 3. Share the wireless network connection  : In this step we will share the Wireless Network Adapter on the parent server (host), and choose to share it with the New Virtual Network that we have created in step1.

Now that we have an idea about what we are going to do, lets start with step # 1.
Step 1. Setup your Virtual Networks
Virtual Network Manager enables you to create and manage virtual networks. The following table describes the available settings of Virtual Network Manager:
Setting Description
External
Creates a connection to a physical network adapter so that virtual machines can access a physical network.
Internal
Provides communications between the virtualization server and virtual machines.
Private
Provides communications between virtual machines only.
We first need to create a new internal virtual network adapter, to allow communication between the parent (host) and the child. This is done using Virtual Network Manager.
To do this, follow these steps:
  • Open the Hyper-V Manager ( Click on Start > Administrative Tools > Click on Hyper-V Manager )
  • From the right side pane, click on Virtual Network Manager...


  • Add caption
    From the right side pane, select New virtual network , then under Create virtual network, select Internal and click Add


  • Give a meaningful name to the new virtual network adapter, then click on OK


  • Going to the parent's (host machine) network connection page, you will noticed that a new network card is listed there now. If you want, rename this network adapter to something more meaningful, something like VLAN1




    Right click on the network adapter, and click on Rename > type the new name for the Network Adapter (VLAN1)




Step 2. Add a network adapter to the virtual machine
To add a network adapter to a Hyper-V virtual machine, make sure that your virtual machine is turned off and then follow these steps :
  1. Open Hyper-V Manager  ( Click on Start > Administrative Tools > Click on Hyper-V Manager )

  2. In the middle pane, under Virtual Machines, select the virtual machine that you want to add to it a network adapter.



  3. In the right side pane ( Action pane ), under the selected virtual machine name, click Settings...



  4. In the left side pane, make sure that Add Hardware is selected, and on the Add Hardware page, choose a Network Adapter or a Legacy Network Adapter ( Choose Network Adapter if you have already installed Integration Services on your virtual machine, if you have not yet installed it, then choose Legacy Network Adapter ). I didn't install the Integration services yet, so I'm going to choose Legacy Network Adapter and click Add



  5. From the drop down list, select the name of the virtual adapter that we have created earlier in step 1 (Internal Only NIC) and then click on OK



Step 3. Share the wireless network connection
  1. Open the parent's (host) Control Panel and open Network and Sharing Center
  2. Click on Manage Network Connections


  3. Select the network adapter that you use to access the Internet. I use Windows Server 2008 as my daily OS on my laptop, that's why I always use the wireless connection. Right click on the wireless network adapter, click on Properties then click on the Sharing Tab
  4. Select the checkbox beside Allow other network users to connect through this computer's Internet connection. And from the drop down list, select the Virtual network adapter that we have previously created in step 1 (VLAN1)



    and the network connections will look like this ( notice the word shared beside the wireless network adapter )

  5. Your virtual machine is now connected to the internet !! Give it a try and check for your self.





Summary

Many times you find yourself in a situation where you need internet connection for your virtual machines. For example I use my personal laptop daily which has Windows Server 2008 on it, and I use this laptop for presentations and demos. So for providing my virtual machines with internet connection, I simply share my wireless connection with my virtual machines using the steps shown in this article.

Related Links

No comments:

Post a Comment